[IPython-dev] making emacs keybindings the ipython default
Phil Austin
mkpaustin at gmail.com
Thu Aug 14 19:55:37 EDT 2014
I need a hint on how to turn on codemirror's emacs keybindings in custom.js for
IPython 2.1. I've found
https://gist.github.com/minrk/5940801
and
https://nbviewer.jupyter.org/github/ivanov/scipy2014/blob/master/
v%20in%20IPython.ipynb#ipython-vimception
but when I insert
%%javascript
// change the mode of all current and future CodeMirror instances
function to(mode) {
var mode = mode || 'vim'
// first let's apply vim mode to all current cells
function to_mode(c) { return c.code_mirror.setOption('keyMap', mode);};
IPython.notebook.get_cells().map(to_mode);
// apply the mode to future cells created
IPython.Cell.options_default.cm_config.keyMap = mode;
}
require(["/static/components/codemirror/keymap/emacs"],
function (emacs) {
to('emacs');
console.log('emacs.js loaded');
});
into ~/.ipython/profile_default/static/custom/custom.js
the console.log (OSX Mavericks, Chrome) reports a 404:
2014-08-14 16:43:08.685 [NotebookApp] Use Control-C to stop this server and
shut down all kernels (twice to skip confirmation).
WARNING:tornado.access:404 GET /static/components/codemirror/keymap/emacs
(::1) 0.88ms referer=http://localhost:8889/notebooks/timetable.ipynbn
2014-08-14 16:43:10.988 [NotebookApp] Kernel started: 16eaa587-e1c8-4f51-8951-
3d6e60ab3ad6
and how to actually call the callback from custom.js seems to have gotten
deleted from the bottom of the notebook?
thanks, Phil
More information about the IPython-dev
mailing list