Skip to content

Commit

Permalink
completion: zsh: improve completion
Browse files Browse the repository at this point in the history
We don't need all Zsh's bash completion emulation (which is buggy), it's
better to use Git's Zsh completion.

Signed-off-by: Felipe Contreras <[email protected]>
  • Loading branch information
felipec committed Nov 3, 2020
1 parent 51e499c commit e073f1b
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions contrib/tig-completion.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,23 @@
# then add following to your ~/.zshrc file:
#
# fpath=(~/.zsh $fpath)
#
# You also need Git's Zsh completion installed:
#
# https://github.com/felipec/git-completion/blob/master/git-completion.zsh


_tig () {
local e
autoload -U bashcompinit && bashcompinit
e=$(dirname ${funcsourcetrace[1]%:*})/git-completion.bash
if [ -f $e ]; then
GIT_SOURCING_ZSH_COMPLETION=y . $e
fi

compdef _git tig

e=$(dirname ${funcsourcetrace[1]%:*})/tig-completion.bash
if [ -f $e ]; then
# Temporarily override __git_complete so the bash script doesn't complain
local old="$functions[__git_complete]"
functions[__git_complete]=:
. $e
functions[__git_complete]="$old"
fi
}

0 comments on commit e073f1b

Please sign in to comment.