Skip to content

ZVM_FAST_ESCAPE: zvm_readkeys early exit to workaround #111 #308

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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