From 8af5442ee0d7c34d0066c6651ac2d364790c6d6c 2023-01-03 11:07:31 From: Jake Herrmann Date: 2023-01-03 11:07:31 Subject: [PATCH] Fix vi mode escape delay --- diff --git a/IPython/terminal/shortcuts.py b/IPython/terminal/shortcuts.py index 7d6de8b..01072cd 100644 --- a/IPython/terminal/shortcuts.py +++ b/IPython/terminal/shortcuts.py @@ -68,9 +68,14 @@ def create_ipython_shortcuts(shell): reformat_text_before_cursor(event.current_buffer, event.current_buffer.document, shell) event.current_buffer.validate_and_handle() + @Condition + def ebivim(): + return shell.emacs_bindings_in_vi_insert_mode + kb.add('escape', 'enter', filter=(has_focus(DEFAULT_BUFFER) & ~has_selection & insert_mode + & ebivim ))(reformat_and_execute) kb.add("c-\\")(quit) @@ -333,10 +338,6 @@ def create_ipython_shortcuts(shell): if sys.platform == "win32": kb.add("c-v", filter=(has_focus(DEFAULT_BUFFER) & ~vi_mode))(win_paste) - @Condition - def ebivim(): - return shell.emacs_bindings_in_vi_insert_mode - focused_insert_vi = has_focus(DEFAULT_BUFFER) & vi_insert_mode @kb.add("end", filter=has_focus(DEFAULT_BUFFER) & (ebivim | ~vi_insert_mode))