jupyter-lab里的vim,colemak 配置

Mon, 2020-08-03
jupyter-lab里的vim,colemak 配置

我原先发于 CSDN

上一篇文章 介绍了 jupyter-notebook 怎样 mapjupyterlab 是新一代的 jupyter-notebook, 有点像R-Studio, 有更多的功能了。

TL; DR

  • install
# For jupyterlab 2.0
jupyter-labextension install @axlair/jupyterlab_vim
# vimrc
jupyter-labextension install jupyterlab-vimrc
  • config
    "nmap": [
        ["n","j"],
        ["e","k"]
    ],

安装jupyterlab

pip install --user jupyterlab
# or
conda activate <env>
conda install jupyterlab

安装 extension

1. vim binding

# jupyterlab 1.0
jupyter labextension install jupyterlab_vim
# jupyterlab 2.0
jupyter-labextension install @axlair/jupyterlab_vim

2. vim keymap

jupyter-labextension install jupyterlab-vimrc

配置

  1. 在这里插入图片描述
  2. 在这里插入图片描述
  3. 仅供参考
{
    // vimrc
    // jupyterlab-vimrc:vimrc
    // Settings to be applied to codemirror vim mode
    // *********************************************

    // imap commands
    // [lhs, rhs] - e.g. "imap": [["ii", "<Esc>"]]
    "imap": [
    ],

    // inoremap commands
    // [lhs, rhs]
    "inoremap": [
        []
    ],

    // nmap commands
    // [lhs, rhs]
    "nmap": [
        ["n","j"],
        ["e","k"]

    ],

    // nnoremap commands
    // [lhs, rhs]
    "nnoremap": [
        ["i","l"],
        ["m","n"],
        ["k","m"],
        ["f","e"],
        ["t","f"],
        ["l","u"],
        ["u","i"],
        
        ["N","J"],
        ["E","K"],
        ["I","L"],
        ["M","N"],
        ["K","M"],
        ["F","E"],
        ["T","F"],
        ["L","U"],
        ["U","I"],
        ["\'","'"]
    ],

    // vmap commands
    // [lhs, rhs]
    "vmap": [
        
    ],

    // vnoremap commands
    // [lhs, rhs]
    "vnoremap": [
        ["n","j"],
        ["e","k"],
        ["i","l"],
        ["k","n"],
        ["f","e"],
        ["t","f"],
        ["l","u"],
        ["u","i"],
        
        ["N","J"],
        ["E","K"],
        ["I","L"],
        ["K","N"],
        ["F","E"],
        ["T","F"],
        ["L","U"],
        ["U","I"],
        
        ["\'",":"]
    ]
}

其中需要注意的是

    "nmap": [
        ["n","j"],
        ["e","k"]
    ],

可能是因为 jupyterlab_vim, 会涉及到cell之间的跳转,所以需要使用nmap

avatar
除非注明,本博客所有文章皆为原创。
本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可。