From 633fdffc4ccd7ba2ca188d691af036dcdeeaa4ec Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Mon, 10 Oct 2022 19:04:57 -0700 Subject: [PATCH] fix completing git branches w/fzf in tmux --- runcoms/zshrc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/runcoms/zshrc b/runcoms/zshrc index 626acc2..b1c519e 100644 --- a/runcoms/zshrc +++ b/runcoms/zshrc @@ -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