<div dir="ltr">Hey,<div><br></div><div>I'm not sure if there's any more principled way to do this. There was some discussion on github</div><div>a while ago about making the key bindings more configurable, but I'm not sure exactly what got</div>
<div>merged.</div><div><br></div><div>Here's the hacky way I came up with to add a couple of CodeMirror's emacs keybindings to</div><div>the notebook using custom.js, in case anyone else ways to use it. Just sending it here for</div>
<div>googling / feedback.</div><div><br></div><div>-Robert</div><div><br></div><div>------------------</div><div><br></div><div>// custom.js</div><div><div>"using strict";</div><div><br></div><div>$([IPython.events]).on('notebook_loaded.Notebook', function(){</div>
<div>    console.log('Adding emacs-style keybindings');</div><div>    var extraKeys = {'Ctrl-A': 'goLineStart', 'Ctrl-E': "goLineEnd"};</div><div><br></div><div>    for (var k in extraKeys) {</div>
<div><span class="" style="white-space:pre">    </span>IPython.CodeCell.options_default.cm_config.extraKeys[k] = extraKeys[k];</div><div>    }    </div><div><br></div><div>    var cells = IPython.notebook.get_cells();</div><div>
    var numCells = cells.length;</div><div>    for (var i = 0; i < numCells; i++) {</div><div><span class="" style="white-space:pre">      </span>cells[i].code_mirror.setOption('extraKeys', IPython.CodeCell.options_default.cm_config.extraKeys);</div>
<div>    }</div><div>});</div></div><div><br></div></div>