From b3a01bb8586ba1c6c896444facd57cf30a675b20 Mon Sep 17 00:00:00 2001 From: Alex Ford Date: Fri, 7 Jun 2024 10:28:17 -0600 Subject: [PATCH] Adding note for zsh-vi-mode users https://github.com/junegunn/fzf-git.sh/issues/23 --- README.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/README.md b/README.md index 65da40b..720d265 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ and select the objects you want to paste to your command-line. [fzf]: https://github.com/junegunn/fzf [fzf-tmux]: https://github.com/junegunn/fzf/blob/master/bin/fzf-tmux +[zsh-vi-mode]: https://github.com/jeffreytse/zsh-vi-mode Installation ------------ @@ -88,3 +89,30 @@ gswt() { cd "$(_fzf_git_worktrees --no-multi)" } ``` + +Note for [zsh-vi-mode] users +---------------------------- + +If you use the [zsh-vi-mode] plugin for ZSH then you will need to add the +following to your `.zshrc` file in order to use the key bindings: + +```sh +# Set key bindings for zsh-vi-mode insert mode. +function zvm_after_init() { + zvm_bindkey viins "^P" up-line-or-beginning-search + zvm_bindkey viins "^N" down-line-or-beginning-search + for o in files branches tags remotes hashes stashes lreflogs each_ref; do + eval "zvm_bindkey viins '^g^${o[1]}' fzf-git-$o-widget" + eval "zvm_bindkey viins '^g${o[1]}' fzf-git-$o-widget" + done +} +# Set key bindings for zsh-vi-mode normal and visual modes. +function zvm_after_lazy_keybindings() { + for o in files branches tags remotes hashes stashes lreflogs each_ref; do + eval "zvm_bindkey vicmd '^g^${o[1]}' fzf-git-$o-widget" + eval "zvm_bindkey vicmd '^g${o[1]}' fzf-git-$o-widget" + eval "zvm_bindkey visual '^g^${o[1]}' fzf-git-$o-widget" + eval "zvm_bindkey visual '^g${o[1]}' fzf-git-$o-widget" + done +} +```