[IPython-dev] making emacs keybindings the ipython default

Paul Ivanov pi at berkeley.edu
Thu Aug 14 20:23:37 EDT 2014


Hi Phil,

Sorry about the goof, you need to either put ".js" after emacs
the way I had it before, or not using a leading forward slash,
and just do the example below (adjusted for how you should add it
to custom.js)


$([IPython.events]).on('app_initialized.NotebookApp', function(){
function to(mode) {
    var mode = mode || 'vim'
    // first let's apply vim mode to all current cells
    function to_mode(c) { return c.code_mirror.setOption('keyMap', mode);};
    IPython.notebook.get_cells().map(to_mode);
    // apply the mode to future cells created
    IPython.Cell.options_default.cm_config.keyMap = mode;
}

require(["components/codemirror/keymap/emacs"],
     function (emacs) { 
         to('emacs'); 
         console.log('emacs.js loaded'); 
     });
})

Thanks for the bug report, let me go fix that in the notebook you
referenced,
-- 
                   _
                  / \
                A*   \^   -
             ,./   _.`\\ / \
            / ,--.S    \/   \
           /  `"~,_     \    \
     __o           ?
   _ \<,_         /:\
--(_)/-(_)----.../ | \
--------------.......J
Paul Ivanov
ipython and matplotlib core developer
@ivanov on github and twitter
http://pirsquared.org



More information about the IPython-dev mailing list