Skip to content

Commit

Permalink
Merge pull request #13861 from jtherrmann/fix-vi-mode-escape-delay
Browse files Browse the repository at this point in the history
  • Loading branch information
Carreau committed Jan 3, 2023
2 parents d0015e2 + 11dd252 commit e35bdfb
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions IPython/terminal/shortcuts.py
Expand Up @@ -68,10 +68,15 @@ def reformat_and_execute(event):
reformat_text_before_cursor(event.current_buffer, event.current_buffer.document, shell)
event.current_buffer.validate_and_handle()

kb.add('escape', 'enter', filter=(has_focus(DEFAULT_BUFFER)
& ~has_selection
& insert_mode
))(reformat_and_execute)
@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 e35bdfb

Please sign in to comment.