4
4
#
5
5
# Copyright (c) 2012-2013 Felipe Contreras <[email protected] >
6
6
#
7
- # You need git's bash completion script installed somewhere, by default on the
8
- # same directory as this script .
7
+ # You need git's bash completion script installed somewhere, by default it
8
+ # would be the location bash-completion uses .
9
9
#
10
- # If your script is on ~/.git-completion.sh instead, you can configure it on
11
- # your ~/.zshrc:
10
+ # If your script is somewhere else, you can configure it on your ~/.zshrc:
12
11
#
13
12
# zstyle ':completion:*:*:git:*' script ~/.git-completion.sh
14
13
#
15
- # The recommended way to install this script is to copy to
16
- # '~/.zsh/completion/_git', and then add the following to your ~/.zshrc file:
14
+ # The recommended way to install this script is to copy to '~/.zsh/_git', and
15
+ # then add the following to your ~/.zshrc file:
17
16
#
18
- # fpath=(~/.zsh/completion $fpath)
17
+ # fpath=(~/.zsh $fpath)
19
18
20
19
complete ()
21
20
{
@@ -27,7 +26,19 @@ zstyle -T ':completion:*:*:git:*' tag-order && \
27
26
zstyle ' :completion:*:*:git:*' tag-order ' common-commands'
28
27
29
28
zstyle -s " :completion:*:*:git:*" script script
30
- test -z " $script " && script=" $( dirname ${funcsourcetrace[1]%:* } ) " /git-completion.bash
29
+ if [ -z " $script " ]; then
30
+ local -a locations
31
+ local e
32
+ locations=(
33
+ ' /etc/bash_completion.d/git' # fedora, old debian
34
+ ' /usr/share/bash-completion/completions/git' # arch, ubuntu, new debian
35
+ ' /usr/share/bash-completion/git' # gentoo
36
+ $( dirname ${funcsourcetrace[1]%:* } ) /git-completion.bash
37
+ )
38
+ for e in $locations ; do
39
+ test -f $e && script=" $e " && break
40
+ done
41
+ fi
31
42
ZSH_VERSION=' ' . " $script "
32
43
33
44
__gitcomp ()
0 commit comments