diff --git a/README.md b/README.md index 6d9b4e1..8648456 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,17 @@ Usage * CTRL-GCTRL-R for **R**emotes * CTRL-GCTRL-H for commit **H**ashes * CTRL-GCTRL-S for **S**tashes + > :warning: You may have issues with these bindings in the following cases: + > + > * CTRL-GCTRL-B will not work if + > CTRL-B is used as the tmux prefix + > * CTRL-GCTRL-S will not work if flow control is enabled, + > CTRL-S will freeze the terminal instead + > * (`stty -ixoff -ixon` will disable it) + > + > To workaround the problems, you can use + > CTRL-G*{key}* instead of + > CTRL-GCTRL-*{KEY}*. * Inside fzf * TAB or SHIFT-TAB to select multiple objects * CTRL-/ to change preview window layout diff --git a/fzf-git.sh b/fzf-git.sh index 4de30fe..d0295dd 100644 --- a/fzf-git.sh +++ b/fzf-git.sh @@ -189,13 +189,14 @@ _fzf_git_stashes() { } if [[ -n $BASH_VERSION ]]; then - bind '"\er": redraw-current-line' - bind '"\C-g\C-f": "$(_fzf_git_files)\e\C-e\er"' - bind '"\C-g\C-b": "$(_fzf_git_branches)\e\C-e\er"' - bind '"\C-g\C-t": "$(_fzf_git_tags)\e\C-e\er"' - bind '"\C-g\C-h": "$(_fzf_git_hashes)\e\C-e\er"' - bind '"\C-g\C-r": "$(_fzf_git_remotes)\e\C-e\er"' - bind '"\C-g\C-s": "$(_fzf_git_stashes)\e\C-e\er"' + __fzf_git_init() { + bind '"\er": redraw-current-line' + local o + for o in "$@"; do + bind '"\C-g\C-'${o:0:1}'": "$(_fzf_git_'$o')\e\C-e\er"' + bind '"\C-g'${o:0:1}'": "$(_fzf_git_'$o')\e\C-e\er"' + done + } elif [[ -n $ZSH_VERSION ]]; then __fzf_git_join() { local item @@ -206,14 +207,15 @@ elif [[ -n $ZSH_VERSION ]]; then __fzf_git_init() { local o - for o in $@; do + for o in "$@"; do eval "fzf-git-$o-widget() { local result=\$(_fzf_git_$o | __fzf_git_join); zle reset-prompt; LBUFFER+=\$result }" eval "zle -N fzf-git-$o-widget" eval "bindkey '^g^${o[1]}' fzf-git-$o-widget" + eval "bindkey '^g${o[1]}' fzf-git-$o-widget" done } - __fzf_git_init files branches tags remotes hashes stashes fi +__fzf_git_init files branches tags remotes hashes stashes # ----------------------------------------------------------------------------- fi