我原先发于 CSDN
上一篇文章 介绍了
jupyter-notebook
怎样
map
。jupyterlab
是新一代的
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
配置
- 仅供参考
{
// 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