sublime text shortcuts in IPython / Jupyter notebook

If you are a daily user of sublime text, you probably feel very frustrating to not have your classical shortcuts into the IPython/Jupyter notebook.

Hopefully the version 4 of Jupyter allows you to retrieve your favorite sublime text keybinding in your browser.

You just have to copy/paste the following line and add it into your ~/.jupyter/custom/custom.js file :

require(["codemirror/keymap/sublime", "notebook/js/cell"],
function(sublime_keymap, cell) {
cell.Cell.options_default.cm_config.keyMap = 'sublime';

Thats it , now you can launch your notebook and start editing without complains 🙂

If it does not work, you may also try to replace the code above by this one :

require(["codemirror/keymap/sublime", "notebook/js/cell", "base/js/namespace"],
function(sublime_keymap, cell, IPython) {
// setTimeout(function(){ // uncomment line to fake race-condition
cell.Cell.options_default.cm_config.keyMap = 'sublime';
var cells = IPython.notebook.get_cells();
for(var c=0; c< cells.length ; c++){
cells[c].code_mirror.setOption('keyMap', 'sublime');

    // }, 1000)// uncomment  line to fake race condition 


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s