%%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(["components/codemirror/keymap/vim"], function (vim) { to('vim'); console.log('vim.js loaded'); }); %%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(["components/codemirror/keymap/emacs"], function (emacs) { to('emacs'); console.log('emacs.js loaded'); });