about summary refs log blame commit diff stats
path: root/fzf-git/key-binding.zsh
blob: e44052e700c1c665579c4e3f2980517682edba31 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15














                                                                                                       

                         

                         
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
}
bindkey -r "^g"
bindkey "^g^g" send-break
bind-git-helper f b t r h
unset -f bind-git-helper