Skip to main content

Code cell vim bindings

Project description

jupyterlab-vim

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

Github Actions Status Binder npm version npm downloads PyPI

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

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

Vim command bindings

Chord Action
Ctrl-O, U Undo Cell Action
- Split Cell at Cursor
Ctrl-O, - Split Cell at Cursor
Ctrl-O, D Cut Cell
Ctrl-O, Y Copy Cell
Ctrl-O, P Paste Cell
Ctrl-Shift-J Extend Marked Cells Below
Ctrl-Shift-K Extend Marked Cells Above
Ctrl-O, O Insert Cell Below
Ctrl-O, Ctrl-O Insert Cell Above
Ctrl-J Select Cell Below
Ctrl-K Select Cell Above
Ctrl-O, G Select First Cell
Ctrl-O, Ctrl-G Select Last Cell
Ctrl-E Move Cell Down
Ctrl-Y Move Cell Up
Ctrl-O, Z, Z Center Cell
Ctrl-G Show Tooltip
Command/Ctrl-1 Code Cell Mode
Command/Ctrl-2 Markdown Cell Mode
Command/Ctrl-3 Raw Cell Mode
Shift-Escape Leave Vim Mode
Escape, Ctrl-[ Exit Vim Insert Mode

Jupyter command bindings

Chord Action
G, G Select First Cell
Shift-G Select Last Cell
D, D Delete Cell
Y, Y Yank (Copy) Cell
P Paste Cell
Shift-P Paste Cell Above
O Insert Cell
Shift-O Insert Cell Above
U Undo Cell Action
Ctrl-E Move Cells Down
Ctrl-Y Move Cells Up
Z, Z Center Cell
Z, C Hide Code Cell
Z, O Show Code Cell
Z, M Hide All Code Cells
Z, R Show 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jupyterlab_vim-0.14.4.tar.gz (95.4 kB view details)

Uploaded Source

Built Distribution

jupyterlab_vim-0.14.4-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

Details for the file jupyterlab_vim-0.14.4.tar.gz.

File metadata

  • Download URL: jupyterlab_vim-0.14.4.tar.gz
  • Upload date:
  • Size: 95.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

File hashes

Hashes for jupyterlab_vim-0.14.4.tar.gz
Algorithm Hash digest
SHA256 434ff78df9baaa5bbb88ef8b0d1e6181fd430739c3ed1a41594ed1d211f3998c
MD5 d9ed0bc9d72cd3baeb03badaef74528b
BLAKE2b-256 dfff47960ac49d2bf7af058ab0ba6cf8892b7125899d263b39726c4ec35d3fe7

See more details on using hashes here.

File details

Details for the file jupyterlab_vim-0.14.4-py3-none-any.whl.

File metadata

  • Download URL: jupyterlab_vim-0.14.4-py3-none-any.whl
  • Upload date:
  • Size: 23.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

File hashes

Hashes for jupyterlab_vim-0.14.4-py3-none-any.whl
Algorithm Hash digest
SHA256 176df00d4abb31b25621041904b62aab1d27539ef25094b31fd33263ad335a8b
MD5 a062e8aa0d71fd220a4f237eb9b45145
BLAKE2b-256 4400459cfbe0cdc42752f2c7a612b29e167872c8cee12341004b5bacff671e31

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page