Skip to content

Instantly share code, notes, and snippets.

@juhasch
Last active August 29, 2015 13:58
Show Gist options
  • Save juhasch/10010357 to your computer and use it in GitHub Desktop.
Save juhasch/10010357 to your computer and use it in GitHub Desktop.
IPython Notebook: Redefine Shift-Enter
var add_edit_shortcuts = {
'shift-enter' : {
help : 'run cell, select next codecell',
help_index : 'bb',
handler : function (event) {
IPython.notebook.execute_cell_and_select_below();
// find next CodeCell and go into edit mode if possible, else stay in next cell
var i;
for (i = IPython.notebook.get_selected_index(); i < IPython.notebook.ncells() ;i++) {
var cell = IPython.notebook.get_cell(i);
if (cell instanceof IPython.CodeCell) {
IPython.notebook.select(i);
IPython.notebook.edit_mode();
break;
}
}
return false;
}
},
};
IPython.keyboard_manager.edit_shortcuts.add_shortcuts(add_edit_shortcuts);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment