如何在 jupyter-lab 中启用 VIM 编辑笔记本的模式?

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

我是 jupyter 实验室的新手。在 settings -> text editor key map 中它有一个 vim 选项,启用后允许我使用 vim 风格的编辑器编辑 .py 文件。但是,此行为不会延续到 .ipynb 个文件。如何为在 jupyter-lab 中编辑的所有文件启用此功能(最重要的是 .ipynb)?

Internet 搜索显示了大量 vim jupyter 插件(我相信主要是 jupyter-notebook),但由于这种行为已经在 .py 中开箱即用,我认为这可以在没有第三方插件的情况下以某种方式配置。无论如何,我将不胜感激,因为我在 Internet 上找到的信息似乎主要是 outdated/related 到 jupyter-notebook。

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

历史:

原来的扩展名是: https://github.com/jwkvam/jupyterlab-vim

然而它从未为 jlab2.x 更新,所以社区转向了一个分支:https://github.com/axelfahy/jupyterlab-vim which has subsequently moved to https://github.com/jupyterlab-contrib/jupyterlab-vim

也有人努力 vim 将其纳入 jlab 核心。参见:https://github.com/jupyterlab/jupyterlab/issues/8592