Use emacs or vim keybindings in IPython notebook

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

Use emacs or vim keybindings in IPython notebook
Use vim keybindings on Docker-launched Jupyter Notebook
How to use IPython Notebook
Use Bokeh with IPython Notebook
Batch processing notes in IPython Notebook
Use apache Spark with jupyter notebook (IPython notebook)
How to revive cells in iPython notebook
How to debug with Jupyter or iPython Notebook
Launch and use IPython notebook on the network
ipython notebook installation
IPython Notebook Recommendations
Task registration or Notification in Python in Outlook (from VIM)