zsh-vi-mode: keybindings seem to conflict with fzf's

hi, thanks for creating this wonderful plugin. I am having trouble getting it working with fzf. My .zshrc file looks like this:

...


# zsh vi mode
source $HOME/.zsh-vi-mode/zsh-vi-mode.plugin.zsh

# fzf
source /usr/share/doc/fzf/examples/key-bindings.zsh
source /usr/share/doc/fzf/examples/completion.zsh

if I comment out ZVM, fzf will work, and if I comment out fzf, ZVM will work. I also tried switching order and same situation. Any ideas how to get these two plugins working in harmony? Thanks.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Hi @sktrinh12

😃 I’m glad to hear that you have settled down this issue. And Welcome to star this project for further updates in the future.

For better code style, I think you can use below one:

# The plugin will auto execute this zvm_after_init function
zvm_after_init() {
  source /usr/share/doc/fzf/examples/key-bindings.zsh
  source /usr/share/doc/fzf/examples/completion.zsh
}

Alternatively, you can ā€œgit cloneā€ this repository to any directory and run install script.

git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install

After installation, just use below one:

zvm_after_init_commands+=('[ -f ~/.fzf ] && source ~/.fzf')

Thanks and regards

thanks for the suggestion! i starred your repo!

Hi @jeffreytse: the plugin is working well for me, I haven’t had issues since implementing the fix.

Thanks for the fast response @jeffreytse! From what I can tell, placing ZVM_INIT_MODE=sourcing before initializing oh-my-zsh and plugins mostly fixes this problem. It is probably with indicating somewhere in your docs that this only fixes the problem if zsh-vi-mode comes after fzf in the list of oh-my-zsh plugins (I tried it the other way first, and that did not resolve the issue with fzf’s bindings, only my custom bindings—where were defined after sourcing oh-my-zsh).

Hi @haberdashPI

Now this plugin has provided an option called ZVM_INIT_MODE to configure the initialization mode (#113), you can use this snippet ZVM_INIT_MODE=sourcing for doing the initialization inistantly when this plugin is sourcing.

Thanks and regards