Skip to content

Commit

Permalink
Adding note for zsh-vi-mode users
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Ford authored and Alex Ford committed Jun 7, 2024
1 parent bd8ac4b commit eeb89f6
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
------------
Expand Down Expand Up @@ -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
}
```

0 comments on commit eeb89f6

Please sign in to comment.