emacs mode inside ipython(jupyter) notebook
Here's a github gist that you'll need to paste into
This works for 4.0.0.dev :)
custom.jswhich is located in
~/.ipython/profile_default/static/custom/custom.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// register a callback when the IPython.notebook instance is created. | |
$([IPython.events]).on('app_initialized.NotebookApp', function(){ | |
function to(mode) { | |
// this can be either 'vim' or 'emacs' | |
var mode = mode || 'emacs'; | |
// first let's apply mode to all current cells | |
function to_mode(c) { return c.code_mirror.setOption('keyMap', mode);}; | |
var cells = IPython.notebook.get_cells(); | |
if (cells != null) { | |
cells.map(to_mode); | |
} | |
// apply the mode to future cells created | |
IPython.Cell.options_default.cm_config.keyMap = mode; | |
}; | |
require(["codemirror/keymap/emacs"], | |
function (_) { | |
if (IPython.notebook != undefined) { | |
to('emacs'); | |
}; | |
}); | |
}); |
This works for 4.0.0.dev :)
1 Comments:
Thank you! Works for ipython 3.0.0 for me on ubuntu 14.04.
Post a Comment
<< Home