Skip to content

Instantly share code, notes, and snippets.

@minrk
Created July 6, 2013 18:36
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save minrk/5940801 to your computer and use it in GitHub Desktop.
Save minrk/5940801 to your computer and use it in GitHub Desktop.
// add this to <profile>/static/custom/custom.js to load vim keybindings:
$.getScript("/static/components/codemirror/keymap/vim.js", function() {
if (! IPython.Cell) return;
IPython.Cell.options_default.cm_config.keyMap = "vim";
});
@minrk
Copy link
Author

minrk commented Jul 6, 2013

requires IPython 1.0-dev

@asmeurer
Copy link

Will it break older versions of IPython, or just not do anything?

@asmeurer
Copy link

I tried replacing vim with emacs and it doesn't seem to work, though I'm not sure how to tell for sure.

@asmeurer
Copy link

It definitely works with vim, though...

@nicolasfauchereau
Copy link

thanks for that !
To get out of insert mode for me CTRL - [ or COMMAND - [ on macs works

@apleonhardt
Copy link

Just to confirm, it works equally well for the included emacs keybindings:

$.getScript("/static/components/codemirror/keymap/emacs.js", function() {
if (! IPython.Cell) return;
IPython.Cell.options_default.cm_config.keyMap = "emacs";
});

@minrk
Copy link
Author

minrk commented Jul 10, 2014

For a better snippet that more reliably affects all your cells, see @ivanov's vimception presentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment