hlissner / zsh-autopair

Auto-close and delete matching delimiters in zsh
MIT License
509 stars 37 forks source link

Not compatible with vi-mode #33

Closed musjj closed 1 year ago

musjj commented 1 year ago

What did you expect to happen?

It should work with the jeffreytse/zsh-vi-mode plugin active

What actually happened?

When jeffreytse/zsh-vi-mode is active, autopairing doesn't work

Describe your attempts to resolve the issue

Removing jeffreytse/zsh-vi-mode makes autopairing work again

Steps to reproduce

I've basically copied this from your dotfiles, only with romkatv/powerlevel10k removed, so I'm not sure why it's not working

if ! zgenom saved; then
  zgenom load lukechilds/zsh-nvm
  zgenom load junegunn/fzf shell
  zgenom load jeffreytse/zsh-vi-mode
  zgenom load zdharma-continuum/fast-syntax-highlighting
  zgenom load zsh-users/zsh-completions src
  zgenom load zsh-users/zsh-autosuggestions
  zgenom load zsh-users/zsh-history-substring-search
  # zgenom load romkatv/powerlevel10k powerlevel10k
  zgenom load hlissner/zsh-autopair autopair.zsh
  zgenom save
fi

Package commit

396c38a7468458ba29011f2ad4112e4fd35f78e6

System Information

Arch

musjj commented 1 year ago

Figured out a hack by adding autopair-init to zvm_after_init_commands:

zvm_after_init_commands=(autopair-init)
musjj commented 1 year ago

Looks like this is caused by the fact that jeffreytse/zsh-vi-mode is lazy-loaded. This adds some surprises to the load order of my plugins, which is the source of issues like this.

The solution is to turn off lazy-loading by doing:

ZVM_INIT_MODE=sourcing