forked from liuchengxu/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustom.js
20 lines (18 loc) · 866 Bytes
/
custom.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Cusotomization for https://github.com/lambdalisue/jupyter-vim-binding
// postioned at ~/.jupyter/custom/custom.js
// Configure CodeMirror
require([
'nbextensions/vim_binding/vim_binding', // depends your installation
], function() {
// Map jj/jk/kk to <Esc>
CodeMirror.Vim.map("jj", "<Esc>", "insert");
CodeMirror.Vim.map("jk", "<Esc>", "insert");
CodeMirror.Vim.map("kk", "<Esc>", "insert");
// Swap j/k and gj/gk (Note that <Plug> mappings)
CodeMirror.Vim.map("j", "<Plug>(vim-binding-gj)", "normal");
CodeMirror.Vim.map("k", "<Plug>(vim-binding-gk)", "normal");
CodeMirror.Vim.map("gj", "<Plug>(vim-binding-j)", "normal");
CodeMirror.Vim.map("gk", "<Plug>(vim-binding-k)", "normal");
CodeMirror.Vim.map("H", "<Plug>(vim-binding-0)", "normal");
CodeMirror.Vim.map("L", "<Plug>(vim-binding-$)", "normal");
});