Skip to content

Commit 8af5442

Browse files
jtherrmannCarreau
authored andcommitted
Fix vi mode escape delay
1 parent f1eee2c commit 8af5442

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

IPython/terminal/shortcuts.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,14 @@ def reformat_and_execute(event):
6868
reformat_text_before_cursor(event.current_buffer, event.current_buffer.document, shell)
6969
event.current_buffer.validate_and_handle()
7070

71+
@Condition
72+
def ebivim():
73+
return shell.emacs_bindings_in_vi_insert_mode
74+
7175
kb.add('escape', 'enter', filter=(has_focus(DEFAULT_BUFFER)
7276
& ~has_selection
7377
& insert_mode
78+
& ebivim
7479
))(reformat_and_execute)
7580

7681
kb.add("c-\\")(quit)
@@ -333,10 +338,6 @@ def _(event):
333338
if sys.platform == "win32":
334339
kb.add("c-v", filter=(has_focus(DEFAULT_BUFFER) & ~vi_mode))(win_paste)
335340

336-
@Condition
337-
def ebivim():
338-
return shell.emacs_bindings_in_vi_insert_mode
339-
340341
focused_insert_vi = has_focus(DEFAULT_BUFFER) & vi_insert_mode
341342

342343
@kb.add("end", filter=has_focus(DEFAULT_BUFFER) & (ebivim | ~vi_insert_mode))

0 commit comments

Comments
 (0)