Skip to content

Commit

Permalink
Fix vi mode escape delay
Browse files Browse the repository at this point in the history
  • Loading branch information
jtherrmann authored and Carreau committed Jan 3, 2023
1 parent f1eee2c commit 8af5442
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions IPython/terminal/shortcuts.py
Expand Up @@ -68,9 +68,14 @@ def reformat_and_execute(event):
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)
Expand Down Expand Up @@ -333,10 +338,6 @@ def _(event):
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))
Expand Down

0 comments on commit 8af5442

Please sign in to comment.