How to enable VIM mode for editing notebooks in jupyter-lab?

Viewed 6709

I'm new to jupyter lab. In settings -> text editor key map it has a vim option which, when enabled, allows me to edit .py files with vim-style editor. However, this behavior does not carry over to .ipynb files. How can I enable this for all files edited in jupyter-lab (most importantly .ipynb)?

Internet search has revealed a plenty of vim addons for jupyter (mostly jupyter-notebook I believe), but since this behavior is already available out of the box for .py, I would assume this can be somehow configured without third-party addons. In any case, I will be grateful for information because what I find on the Internet seems to be mostly outdated/related to jupyter-notebook.

1 Answers

jupyterlab 3.x+:

pip install --upgrade jupyterlab-vim

jupyterlab 2.x:

jupyter labextension install @axlair/jupyterlab_vim

jupyterlab 1.x:

jupyter labextension install jupyterlab_vim

History:

The original extension was: https://github.com/jwkvam/jupyterlab-vim

however it was never updated for jlab2.x so the community shifted to a fork: https://github.com/axelfahy/jupyterlab-vim which has subsequently moved to https://github.com/jupyterlab-contrib/jupyterlab-vim

There is also an effort to vim this into jlab core. See: https://github.com/jupyterlab/jupyterlab/issues/8592

Related