Skip to content

Commit

Permalink
ZVM_FAST_ESCAPE: zvm_readkeys early exit to workaround jeffreytse#111
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-hrt committed Jan 6, 2025
1 parent cd730cd commit 3701db5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions zsh-vi-mode.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@
# an escape character (default is 0.03 seconds), and this option is just
# available for the NEX readkey engine
#
# ZVM_FAST_ESCAPE:
# speed up modal changes to normal by short circuiting zle handling when a
# single escape character is received and no other characters are received
# within the escape timeout. This only works with the NEX readkey engine and
# could conflict with alternate zvm widget keybindings.
#
# ZVM_LINE_INIT_MODE
# the setting for init mode of command line (default is empty), empty will
# keep the last command mode, for the first command line it will be insert
Expand Down Expand Up @@ -515,6 +521,12 @@ function zvm_readkeys() {

keys="${keys}${key}"

if [[ "$key" == $'\e' && -n $ZVM_FAST_ESCAPE ]]; then
key=
widget=zvm_readkeys_handler
break
fi

# Handle the pattern
if [[ -n "$key" ]]; then
# Transform the non-printed characters
Expand Down

0 comments on commit 3701db5

Please sign in to comment.