jupyterlab-vim

:neckbeard: Vim notebook cell bindings for JupyterLab

Showing:

Popularity

Downloads/wk

0

GitHub Stars

287

Maintenance

Last Commit

4d ago

Contributors

16

Package

Dependencies

0

License

MIT

Categories

Readme

jupyterlab-vim

Community fork of https://github.com/jwkvam/jupyterlab-vim updated for jupyterlab 2 and 3

Extension status Github Actions Status Binder npm version npm downloads PyPI Conda Version

Notebook cell vim bindings

jlabvim

Special Thanks

I want to acknowledge Alisue and his excellent work creating vim bindings for Jupyter notebooks. I hope this extension can meet the high bar his work set.

Modes

This extension splits Jupyter edit mode into two modes: Vim command mode and Vim insert mode. Three editing modes now exist: Jupyter command, Vim command, and Vim insert.

Install

For jupyterlab 3+

pip install jupyterlab_vim

For jupyterlab 2

Install or upgrade

jupyter labextension install @axlair/jupyterlab_vim

Uninstall

jupyter labextension uninstall @axlair/jupyterlab_vim

Key Bindings

Please note that all keys are lowercase unless Shift is explicitly indicated. For example, Y, Y is two lowercase ys, Shift-Y, Y is one uppercase Y followed by a lowercase y.

Shortcuts this extension introduces:

Vim Ex commands

CommandAction
:w[rite]Save Notebook
:q[uit]Enter Jupyter command mode

Vim command bindings

ChordAction
Ctrl-O, UUndo Cell Action
-Split Cell at Cursor
Ctrl-O, -Split Cell at Cursor
Ctrl-O, DCut Cell
Ctrl-O, YCopy Cell
Ctrl-O, PPaste Cell
Ctrl-Shift-JExtend Marked Cells Below
Ctrl-Shift-KExtend Marked Cells Above
Ctrl-O, OInsert Cell Below
Ctrl-O, Ctrl-OInsert Cell Above
Ctrl-JSelect Cell Below
Ctrl-KSelect Cell Above
Ctrl-O, GSelect First Cell
Ctrl-O, Ctrl-GSelect Last Cell
Ctrl-EMove Cell Down
Ctrl-YMove Cell Up
Ctrl-O, Z, ZCenter Cell
Ctrl-GShow Tooltip
Command/Ctrl-1Code Cell Mode
Command/Ctrl-2Markdown Cell Mode
Command/Ctrl-3Raw Cell Mode
Shift-EscapeLeave Vim Mode
Escape, Ctrl-[Exit Vim Insert Mode

Jupyter command bindings

ChordAction
G, GSelect First Cell
Shift-GSelect Last Cell
D, DDelete Cell
Y, YYank (Copy) Cell
PPaste Cell
Shift-PPaste Cell Above
OInsert Cell
Shift-OInsert Cell Above
UUndo Cell Action
Ctrl-EMove Cells Down
Ctrl-YMove Cells Up
Z, ZCenter Cell
Z, CHide Code Cell
Z, OShow Code Cell
Z, MHide All Code Cells
Z, RShow All Code Cells

Contributing

Contributions and feedback are most welcome!

Development install

Note: You will need NodeJS to build the extension package. To install with conda do:

conda install -c conda-forge nodejs

The jlpm command is JupyterLab's pinned version of yarn that is installed with JupyterLab. You may use yarn or npm in lieu of jlpm below.

# Clone the repo to your local environment
# Change directory to the jupyterlab_vim directory
# Install package in development mode
pip install jupyter_packaging
pip install -e .
# Link your development version of the extension with JupyterLab
jupyter labextension develop . --overwrite
# Rebuild extension Typescript source after making changes
jlpm run build

You can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.

# Watch the source directory in one terminal, automatically rebuilding when needed
jlpm run watch
# Run JupyterLab in another terminal
jupyter lab

With the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).

By default, the jlpm run build command generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:

jupyter lab build --minimize=False

Uninstall

pip uninstall jupyterlab_vim

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100