-
-
Notifications
You must be signed in to change notification settings - Fork 118
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
Remove delay after pressing Esc key #111
Comments
Hi @Hubro Thanks for the reporting, could your provide me your dotfiles (e.g. Thanks and regards |
Of course: .zshrcHISTFILE=~/.histfile
HISTSIZE=10000
SAVEHIST=10000
KEYTIMEOUT=1
setopt SHARE_HISTORY nomatch notify
#bindkey -v
bindkey '^R' history-incremental-search-backward
WORDCHARS='*?_-.[]~=&;!#$%^(){}<>'
fpath=(~/Dropbox/Config/zsh-completions $fpath)
#
# Completion config
#
zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate
zstyle ':completion:*' max-errors 2
zstyle :compinstall filename '/home/tomas/.zshrc'
autoload -Uz compinit
compinit
#
# Antigen plugin manager
#
# This block of config works automatically with the "antigen-git" AUR package
# on Arch and with the "antigen" homebrew package on macOS.
#
# Possible init script locations
ANTIGEN_INIT_SCRIPT=(
"/usr/share/zsh/share/antigen.zsh"
"/usr/local/share/antigen/antigen.zsh"
)
for ANTIGEN_INIT_SCRIPT_PATH in "${ANTIGEN_INIT_SCRIPT[@]}"; do
if [[ -f "$ANTIGEN_INIT_SCRIPT_PATH" ]]; then
source "$ANTIGEN_INIT_SCRIPT_PATH"
antigen bundle jeffreytse/zsh-vi-mode
#NVM_NO_USE=true
#NVM_AUTO_USE=true
##NVM_LAZY_LOAD=true
#antigen bundle lukechilds/zsh-nvm
antigen apply
# Configure zsh-vi-mode
ZVM_INSERT_MODE_CURSOR=$ZVM_CURSOR_BLINKING_BEAM
ZVM_NORMAL_MODE_CURSOR=$ZVM_CURSOR_BLOCK
ZVM_LINE_INIT_MODE=$ZVM_MODE_INSERT
ZVM_CURSOR_STYLE_ENABLED=true
#ZVM_INSERT_MODE_CURSOR=$ZVM_CURSOR_BLINKING_BLOCK
#ZVM_NORMAL_MODE_CURSOR=$ZVM_CURSOR_BLOCK
break
fi
done
unset ANTIGEN_INIT_SCRIPT
unset ANTIGEN_INIT_SCRIPT_PATH
# Executed automatically by zsh-vi-mode for setting up keybindings
function zvm_after_lazy_keybindings() {
# Put custom keybinds in here
}
#
# Kubectl completion
#
#if which kubectl &>/dev/null; then
# eval "$(kubectl completion zsh 2>/dev/null)"
#fi
#
# Shell init script
#
SHELL_SETUP="$HOME/Dropbox/Config/shell-setup.zsh"
[[ -f "$SHELL_SETUP" ]] && source "$SHELL_SETUP"
unset SHELL_SETUP
#
# Pyenv
#
if which pyenv &>/dev/null; then
eval "$(pyenv init - --no-rehash)"
eval "$(pyenv virtualenv-init - --no-rehash)"
fi
#
# NVM (Node Version Manager)
#
NVM_INIT_SCRIPT="/usr/share/nvm/init-nvm.sh"
if [[ -f "$NVM_INIT_SCRIPT" ]]; then
source "$NVM_INIT_SCRIPT" --no-use
#source "$NVM_INIT_SCRIPT"
fi
#
# Starship
#
if which starship &>/dev/null; then
eval "$(starship init zsh)"
fi
#
# Direnv (https://direnv.net/)
#
if which direnv &>/dev/null; then
eval "$(direnv hook zsh)"
fi
#
# Broot
#
if which broot &>/dev/null; then
source /home/tomas/.config/broot/launcher/bash/br
fi
#
# Allow parent to initialize shell
#
# This is awesome for opening terminals in VSCode.
#
if [[ -n $ZSH_INIT_COMMAND ]]; then
echo "Running: $ZSH_INIT_COMMAND"
eval "$ZSH_INIT_COMMAND"
fi
#
# Syntax highlighting
#
SYNTAX_HIGHLIGHTING_INIT="/usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
if [[ -f "$SYNTAX_HIGHLIGHTING_INIT" ]]; then
source "$SYNTAX_HIGHLIGHTING_INIT"
fi .zprofileexport PATH="$HOME/Dropbox/bin:$PATH"
export PATH="$HOME/bin:$PATH"
export PATH="$HOME/.local/bin:$PATH"
export PATH="$HOME/.poetry/bin:$PATH"
# Used by direnv
export NODE_VERSIONS="$HOME/.nvm/versions/node"
export NODE_VERSION_PREFIX="v"
# Tell Neovide to use extra fancy animations
export NeovideMultiGrid=1
# Very Linux specific stuff here
if [[ "$(uname)" != "Darwin" ]]; then
export SWAYSOCK="/run/user/$UID/sway.sock"
export EDITOR=vim
export LESSCHARSET=UTF-8
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
fi
#[[ -f ~/.zshrc ]] && . ~/.zshrc
|
Hi @Hubro This issue has been addressed and fixed. Please update to the latest version and try again. Thanks and regards |
@jeffreytse Awesome! The delay is still there, but now my keystrokes are never lost. They are just slightly delayed. That's a massive improvement 😄 |
@jeffreytse Hi, I am using |
Thanks for your question, can you provide me some more details such as a video record for this behavior, your environment info and so on. Thanks & Regards |
Hi @jeffreytse |
It's glad to hear your good news. Welcome to star this project for further update in the future. Thanks & Regards |
I had the exact same issue with the exact same plugin. I don't think it's really the plugin's fault, but NVM itself. When you source the NVM script it takes a second or two for some reason. I worked around the issue by installing NVM through my package manager and sourcing it myself with the
|
@Hubro Hi, I face this problem with npm plugin in ohmyzsh and it has nothing to do with NVM. https://github.com/ohmyzsh/ohmyzsh/blob/914b6399e88a16fdced427c2ae7738785dcb16b0/plugins/npm/npm.plugin.zsh#L108-L111 Best Regards |
I have the same issue, not using ohmyzsh but Prezto |
Thanks for this link. I experienced the same issue and for me, tmux was the problem. Adding |
I have the same issue, using presto, without nvm or tmux. zsh-vi-mode is installed by cloning them renaming zsh-vi-mode.plugin.zsh to init.zsh. Normal to Insert mode is fine, but Insert to Normal manifests a noticeable delay where the bar cursor is turned into block after the delay. |
Thanks for developing this great plugin! I experience about half a second delay when changing from the insert mode to normal mode. I experience this delay on a Linux server, an M1 Mac, and both inside and outside tmux (my tmux These are the plugins I have installed: plugins=(
git
colored-man-pages
colorize
zsh-syntax-highlighting
zsh-autosuggestions
autoupdate
sudo
fzf
zsh-vi-mode
) Today I learned that I can reduce my Vim's delay of going from insert mode to normal mode from about two to three seconds to near zero by |
I still experience this delay. If anyone has a suggestion, please let me know. |
Hi @pwang2, I'm not sure what happened in your terminal. Could you provide a video record and reproducing steps for my further investigation? Thanks & Regards |
Thanks, Jeffrey! I do have a video before I restart my WSL If I profile now. here is the output. |
New to zsh-vi-mode—awesome project! Thanks for all the hard work on it. One of the rough edges that's been giving me grief is the delay when switching to normal mode reported here. Running zprof gave similar results to #111 (comment). I traced the delay back to: Lines 547 to 571 in cd730cd
The value of I provided a workaround in #308 that skips over this logic entirely and brings the time cost of entering entering normal mode in line with what I'm experiencing for the other modes. It'd be great to get some more-informed feedback on the safety of this change and whether it might be adapted into a total fix. My reading of the code suggests we should entirely skip the additional key read logic here: Lines 560 to 569 in cd730cd
if we're dealing with an escape keypress. We've already confirmed this isn't a proper escape sequence with: Lines 507 to 514 in cd730cd
and I think its unlikely folks using this extension will also want to rely only manual esc+<foo> keybindings. If they do they could set their $ZVM_ESCAPE_KEYTIMEOUT accordingly.
|
General information
Basic examination
Problem description
After pressing Esc, there is a short delay before ZVM enters Normal mode.
This means that very often when I press: EsckEnter in order to run the previous command, nothing happens. If I intentionally do it slowly, it works, but this is a key combination I press very, very often, so I naturally do it really fast.
Reproduction steps
Read above
Expected behavior
Ideally ZVM would enter Normal mode immediately when the Esc key is pressed down, with no delay.
To compare, I have tried:
None of the above have any perceivable delay after pressing Esc. I can press EsckEnter as fast as I possibly can, and they never miss any of the keystrokes.
The text was updated successfully, but these errors were encountered: