After applying the command: set -o vi
in ZSH, I can't get FZF keybinding works as before, ex ^CR
for reverse history search.. How can I make this works again?
2 Answers
First set your keymap, then source Fzf's shell script. Otherwise, Fzf's shell script will install all the keybindings into the default emacs
keymap (after which you then switch to vi
).
I used this Plugin as my base. https://github.com/jeffreytse/zsh-vi-mode Its just a better vi-mode for zsh.
Then I inserted the Keymap of fzf into the file zsh-vi-mode.zsh of the Plugin under the "#Other key bindings" Comment. I had to change the Keybinding command of the fzf-keymap from bindkey'<key>' <funktion>
to zvm_bindkey viins '<key>' <fzf-funktion>
.
Depending, where you insert the fzf-keymap, you have to uncomment the line zvm_bindkey viins '^R' history-incremental-search-backward
One word to the keymap of fzf. Depending how you installed fzf, you will find it under the installation directory or under /usr/share/fzf.
Then I loaded first the fzf plugin and second the zsh-vi-mode plugin. The second one should overwrite the first.
There could be a better way doing this but it works for me. I hope I was able to help.