diff options
Diffstat (limited to 'fzf-git/key-binding.zsh')
-rw-r--r-- | fzf-git/key-binding.zsh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/fzf-git/key-binding.zsh b/fzf-git/key-binding.zsh new file mode 100644 index 0000000..b2d00c5 --- /dev/null +++ b/fzf-git/key-binding.zsh @@ -0,0 +1,17 @@ +join-lines() { + local item + while read item; do + echo -n "${(q)item} " + done +} + +bind-git-helper() { + local c + for c in $@; do + eval "fzf-g$c-widget() { local result=\$(_g$c | join-lines); zle reset-prompt; LBUFFER+=\$result }" + eval "zle -N fzf-g$c-widget" + eval "bindkey '^g^$c' fzf-g$c-widget" + done +} +bind-git-helper f b t r h +unset -f bind-git-helper |