Last active
August 29, 2015 13:58
-
-
Save juhasch/10010357 to your computer and use it in GitHub Desktop.
IPython Notebook: Redefine Shift-Enter
This file contains hidden or 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
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