[IPython-dev] Emacs/Vim keybindings in the notebook

Aaron Meurer asmeurer at gmail.com
Thu Jan 26 15:45:54 EST 2012


Cool.  I played with the emacs one.

C-n and C-w work just fine in Mac OS X (where Command-n and Command-w
are the browser shortcut keys).  I found a bug: C-k doesn't put the
deleted text into the kill ring (so C-y won't give it back).  It does
work for C-w.

I should also note that in Mac OS X, many emacs bindings work by
default in any Cocoa text box.  Among these are C-a, C-e, C-n, C-p,
C-f, C-b, C-k, and C-y.  So it's not 100% clear which ones were
implemented by you and which came from the OS.

Finally, this breaks the Mac OS X cursor moving commands, like
option-arrow key an cmd-arrow key.

Aaron Meurer

On Thu, Jan 26, 2012 at 12:35 AM, Fernando Perez <fperez.net at gmail.com> wrote:
> Hi all,
>
> here's a branch:
>
> https://github.com/fperez/ipython/tree/cm-keymaps
>
> for some enterprising user who wants to add support for the new
> emacs/vim keybinding modes in the notebook.  The reason I'm not making
> a PR out of it is that it would require client-side configuration, so
> that users can choose which keymap to use (or none at all, which is
> the default today and leaves the text area to be managed by the
> browser bindings-wise).  Since the problem of client-side
> configuration isn't trivial and I don't have time to work on it right
> now, this can't really be merged.
>
> In the meantime, anyone who wants to keep this in their local tree can
> just pull this branch in, right now it's set for emacs mode, but you
> just need to replace 'emacs' with 'vim' in two places:
>
> https://github.com/fperez/ipython/commit/b5a09444a8e6963d6fbde9db168d0c37e6949cc3
>
> to get vim keybindings.
>
> The emacs bindings are pretty limited, with lots of imoprtant ones
> missing.  But the vim.js file looks a lot larger, so it may be that
> one is more solid.  You can play with the bindings in the CodeMirror
> demos right away without having to patch IPython:
>
> http://codemirror.net/demo/emacs.html
> http://codemirror.net/demo/vim.html
>
> My real hope with this is that someone will want this bad enough that
> they'll do the work of building the config system to get there.  Think
> of this branch as a fishing hook, I'm just hoping it will go deep
> enough into someone's belly to reel them all the way into a config
> system ;)
>
> Cheers,
>
> f
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev



More information about the IPython-dev mailing list