-
-
Save stuntgoat/ee43f7e406f300237628 to your computer and use it in GitHub Desktop.
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'); | |
}; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment