From f7867ad30dbfcbadbb96f08fd5ab0a7bc3bb27f0 2017-02-09 20:03:45 From: Thomas Kluyver Date: 2017-02-09 20:03:45 Subject: [PATCH] Backport PR #10225: Add 'v' binding in vi-navigation-mode to %edit. See https://github.com/ipython/ipython/pull/9929 issuecomment-276264230. --- diff --git a/IPython/terminal/shortcuts.py b/IPython/terminal/shortcuts.py index 5914e6b..0201fc8 100644 --- a/IPython/terminal/shortcuts.py +++ b/IPython/terminal/shortcuts.py @@ -4,7 +4,7 @@ import sys from prompt_toolkit.enums import DEFAULT_BUFFER, SEARCH_BUFFER from prompt_toolkit.filters import (HasFocus, HasSelection, Condition, ViInsertMode, EmacsInsertMode, HasCompletions) -from prompt_toolkit.filters.cli import ViMode +from prompt_toolkit.filters.cli import ViMode, ViNavigationMode from prompt_toolkit.keys import Keys from prompt_toolkit.key_binding.bindings.completion import display_completions_like_readline @@ -66,6 +66,10 @@ def register_ipython_shortcuts(registry, shell): filter=HasFocus(DEFAULT_BUFFER) )(open_input_in_editor) + registry.add_binding('v', + filter=HasFocus(DEFAULT_BUFFER) & ViNavigationMode() + )(open_input_in_editor) + if shell.display_completions == 'readlinelike': registry.add_binding(Keys.ControlI, filter=(HasFocus(DEFAULT_BUFFER)