fix completing git branches w/fzf in tmux

Alpha Chen 2 years ago
parent 8efd869899
commit 5f3cf157b8
No known key found for this signature in database

@ -81,6 +81,7 @@ if [ $commands[fzf] ]; then
fzf --height 50% --min-height 20 --border --bind ctrl-/:toggle-preview "$@"
}
# files
_gf() {
is_in_git_repo || return
git -c color.status=always status --short |
@ -89,8 +90,8 @@ if [ $commands[fzf] ]; then
cut -c4- | sed 's/.* -> //'
}
# this B is capitalized so it maybe will work w/tmux?
_gB() {
# branches
_gg() {
is_in_git_repo || return
git branch -a --color=always | grep -v '/HEAD\s' | sort |
fzf-down --ansi --multi --tac --preview-window right:70% \
@ -99,6 +100,7 @@ if [ $commands[fzf] ]; then
sed 's#^remotes/##'
}
# tags
_gt() {
is_in_git_repo || return
git tag --sort -version:refname |
@ -106,6 +108,7 @@ if [ $commands[fzf] ]; then
--preview 'git show --color=always {}'
}
# history
_gh() {
is_in_git_repo || return
git log --date=short --format="%C(green)%C(bold)%cd %C(auto)%h%d %s (%an)" --graph --color=always |
@ -115,6 +118,7 @@ if [ $commands[fzf] ]; then
grep -o "[a-f0-9]\{7,\}"
}
# remotes
_gr() {
is_in_git_repo || return
git remote -v | awk '{print $1 "\t" $2}' | uniq |
@ -123,6 +127,7 @@ if [ $commands[fzf] ]; then
cut -d$'\t' -f1
}
# stashes
_gs() {
is_in_git_repo || return
git stash list | fzf-down --reverse -d: --preview 'git show --color=always {1}' |
@ -145,7 +150,7 @@ if [ $commands[fzf] ]; then
eval "bindkey '^g^$c' fzf-g$c-widget"
done
}
bind-git-helper f B t r h s
bind-git-helper f g t r h s
unset -f bind-git-helper
if [ $commands[fasd] ]; then

Loading…
Cancel
Save