Everyone is using the ** super convenient ** ipython notebook. And vim and emacs users are suffering from not being able to use vim keybindings and emacs keybindings, right?
*** Give you a magical js code. *** ***
Add the following js to the end of $ IPYTHONDIR / profile_default / static / custom / custom.js
.
Magic code
var my_keymap = 'emacs';
// var my_keymap = 'vim';
$.getScript("/static/components/codemirror/keymap/" + my_keymap + ".js");
IPython.RawCell.options_default.cm_config = {keyMap: my_keymap};
IPython.Cell.options_default.cm_config.keyMap = my_keymap;
IPython.TextCell.options_default.cm_config.keyMap = my_keymap;
IPython.MarkdownCell.options_default.cm_config.keyMap = my_keymap;
IPython.HeadingCell.options_default.cm_config = {keyMap: my_keymap};
IPython.CodeCell.options_default.cm_config.keyMap = my_keymap;
If the environment variable ʻIPYTHONDIRdoes not exist, you can start ipython and check it with the following code. (Typically, there are many
$ HOME / .ipython,
$ HOME / .config / ipython`. For details, see here. .html # configuration-file-location).)
import IPython
IPython.utils.path.get_ipython_dir()
By the way, the confirmation environment is ipython 2.1.0.
Recommended Posts