From 9d446163a509b6edf80397380813b435a5860c37 2014-01-07 22:48:00 From: Brian E. Granger Date: 2014-01-07 22:48:00 Subject: [PATCH] Adding j/k for select next/prev. Faster than up/down. --- diff --git a/IPython/html/static/notebook/js/keyboardmanager.js b/IPython/html/static/notebook/js/keyboardmanager.js index dba3b91..2a356f2 100644 --- a/IPython/html/static/notebook/js/keyboardmanager.js +++ b/IPython/html/static/notebook/js/keyboardmanager.js @@ -167,7 +167,6 @@ var IPython = (function (IPython) { }; } }, - } // Command mode defaults @@ -204,6 +203,30 @@ var IPython = (function (IPython) { return false; } }, + 'k' : { + help : 'select previous cell', + handler : function (event) { + var index = IPython.notebook.get_selected_index(); + if (index !== 0 && index !== null) { + IPython.notebook.select_prev(); + var cell = IPython.notebook.get_selected_cell(); + cell.focus_cell(); + }; + return false; + } + }, + 'j' : { + help : 'select next cell', + handler : function (event) { + var index = IPython.notebook.get_selected_index(); + if (index !== (IPython.notebook.ncells()-1) && index !== null) { + IPython.notebook.select_next(); + var cell = IPython.notebook.get_selected_cell(); + cell.focus_cell(); + }; + return false; + } + }, 'x' : { help : 'cut cell', handler : function (event) {