zsh-vi-mode icon indicating copy to clipboard operation
zsh-vi-mode copied to clipboard

ZVM_READKEY_ENGINE_NEX causing extremly slow paste

Open billkewl opened this issue 5 months ago • 0 comments

General information

  • Terminal program: Apple_Terminal 453 (xterm-256color)
  • Operating system: macOS 14.6.1 (23G93)
  • ZSH framework:
  • ZSH version: zsh 5.9 (x86_64-apple-darwin23.0)
  • ZVM version: zsh-vi-mode 0.11.0

Basic examination

  • [x] I have read through the README page
  • [x] I have the latest version of zsh-vi-mode
  • [x] I have tested with another terminal program

Problem description

When readkey engine set to ZVM_READKEY_ENGINE_NEX, current default engine, pasting in insert mode takes forever to finish. At first I thought it was zsh-vi-mode conflict with fast-syntax-highlighting, zsh-autosuggestions and zsh-history-substring-search. But after some trial and errors it turns out that the culprit is ZVM_READKEY_ENGINE_NEX

Changing ZVM_READKEY_ENGINE=$ZVM_READKEY_ENGINE_ZLE temporarily fixed the issue. This issue only happens on macOS. On Arch Linux there isn't such issue when I use the same .zshrc

Here's an excerpt from my .zshrc

source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh
ZSH_AUTOSUGGEST_IGNORE_WIDGETS+=(backward-kill-word kill-word)

source /opt/homebrew/opt/zsh-fast-syntax-highlighting/share/zsh-fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
source /opt/homebrew/share/zsh-history-substring-search/zsh-history-substring-search.zsh

function zvm_config() {
  ZVM_LINE_INIT_MODE=$ZVM_MODE_INSERT
  ZVM_VI_INSERT_ESCAPE_BINDKEY=jj
  ZVM_VI_VISUAL_ESCAPE_BINDKEY=jj
  ZVM_READKEY_ENGINE=$ZVM_READKEY_ENGINE_DEFAULT
  ZVM_INIT_MODE=sourcing
}
source $(brew --prefix)/opt/zsh-vi-mode/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh

autoload -Uz is-at-least
if [[ ${ZSH_VERSION} != 5.1.1 && ${TERM} != "dumb" ]]; then
  if is-at-least 5.2; then
    autoload -Uz bracketed-paste-url-magic
    zle -N bracketed-paste bracketed-paste-url-magic
  elif is-at-least 5.1; then
    autoload -Uz bracketed-paste-magic
    zle -N bracketed-paste bracketed-paste-magic
  fi
  autoload -Uz url-quote-magic
  zle -N self-insert url-quote-magic
fi

Reproduction steps

  1. Open zsh and enter insert mode
  2. Paste a long line such as curl request
  3. Wait until paste finishes

Expected behavior

Immediately finished paste on ZVM_READKEY_ENGINE_NEX just like on Arch Linux

billkewl avatar Sep 15 '24 11:09 billkewl