zsh-autopair
zsh-autopair copied to clipboard
Not compatible with vi-mode (follow-up)
What did you expect to happen?
This is a follow-up to https://github.com/hlissner/zsh-autopair/issues/33
I'm running both zsh-autopair and zsh-vi-mode as plugins on oh-my-zsh. The expected behavior is that i can use vi-mode while still retaining autocomplete functionality for delimiters
What actually happened?
Like the previous issue raised, what actually happens is both plugins don't work with each other -- i.e. when vi-mode is functional, i don't get autocomplete on delimiters, and vice versa.
Describe your attempts to resolve the issue
I tried turning off lazy-loading with ZVM_INIT_MODE=sourcing. Restart the terminal. The result is that vi-mode works, but autopair doesn't. Then when I run source .zshrc (without changing/touching anything else), suddenly autopair works, but vi-mode doesn't.
I also tried removing zsh-vi-mode from the plugins and loading it manually after all the other plugins: source $ZSH/custom/plugins/zsh-vi-mode/zsh-vi-mode.plugin.zsh. now autopair just doesn't work no matter how many times i source .zshrc.
Steps to reproduce
git clone both plugins into your oh-my-zsh plugins folder
paste the following in your .zshrc file
# Load plugins
plugins=(
zsh-autopair
... # other plugins
zsh-vi-mode
)
export ZVM_INIT_MODE=sourcing
source $ZSH/oh-my-zsh.sh
restart your terminal, and you should see vi-mode working, but autopair not
then run source .zshrc, and you should see the opposite
for the manual load approach,
# Load plugins
plugins=(
zsh-autopair
... # other plugins
)
source $ZSH/oh-my-zsh.sh
source $ZSH/custom/plugins/zsh-vi-mode/zsh-vi-mode.plugin.zsh # Manually source zsh-vi-mode after all other plugins
Package commit
449a7c3d095bc8f3d78cf37b9549f8bb4c383f3d
System Information
macOS Sequoia 15.3.1 iTerm2 3.5.11 zsh 5.9 (x86_64-apple-darwin21.3.0)
I suspect ZVM is doing something differently here, because the key for me to get the two to work together was to load zsh-vi-mode before zsh-autopair, but I'm using a pretty primitive (and synchronous) plugin loader (zgenom).
I'll find some time over the weekend to try out oh-my-zsh and see if I can get the two to cooperate.
hey @hlissner, any updates on this? no rush, just curious if u've had a chance to try it out
This worked for me:
# See: https://github.com/jeffreytse/zsh-vi-mode/issues/185
# We want autopair to initialize post vi initializes so that ZLE widgets are set up correctly instead of getting overwritten
export AUTOPAIR_INIT_INHIBIT=1
zvm_after_init_commands=(autopair-init)