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.
That issue notes how there are necessarily going to be conflicts with existing shortcuts in a vim mode. So the choice becomes how to best strike the balance between vim-iness and jupyter-iness of vim mode in the notebook. The unfortunate truth is that the end result will not be a perfect representation of either vim or jupyter.
Jupyter Notebook is widely used most popular tool for machine learning and data science development. Starting with IPython 2.0, the Jupyter Notebook has two modes: command mode. Keyboard will behave differently depending upon which mode you have selected. Green cell border is an indication of whether edit mode is enabled or not.
They update some vim commands to be make sense in the notebook context, maintain the most fundamental vim actions, and update some jupyter commands to be more vim-like. Beyond that they have a long history (and large userbase) dating back to the first commit in 2015 for the vim extension for jupyter notebook.
Jupyter Notebook Modes There are two modes in Jupyter. These are edit mode and command mode. If the cell has a green border, that means you’re in edit mode.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With