completion: zsh: update slave script locations
Update the default locations of typical system bash-completion, including the default bash-completion location for user scripts, and the recommended way to find the system location (with pkg-config). Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
44b37abb2a
commit
98fc2684a9
|
@ -13,7 +13,7 @@
|
||||||
# fpath=(~/.zsh $fpath)
|
# fpath=(~/.zsh $fpath)
|
||||||
#
|
#
|
||||||
# You need git's bash completion script installed. By default bash-completion's
|
# You need git's bash completion script installed. By default bash-completion's
|
||||||
# location will be used (e.g. /usr/share/bash-completion/completions/git).
|
# location will be used (e.g. pkg-config --variable=completionsdir bash-completion).
|
||||||
#
|
#
|
||||||
# If your bash completion script is somewhere else, you can specify the
|
# If your bash completion script is somewhere else, you can specify the
|
||||||
# location in your ~/.zshrc:
|
# location in your ~/.zshrc:
|
||||||
|
@ -33,12 +33,16 @@ zstyle -T ':completion:*:*:git:*' tag-order && \
|
||||||
zstyle -s ":completion:*:*:git:*" script script
|
zstyle -s ":completion:*:*:git:*" script script
|
||||||
if [ -z "$script" ]; then
|
if [ -z "$script" ]; then
|
||||||
local -a locations
|
local -a locations
|
||||||
local e
|
local e bash_completion
|
||||||
|
|
||||||
|
bash_completion=$(pkg-config --variable=completionsdir bash-completion 2>/dev/null) ||
|
||||||
|
bash_completion='/usr/share/bash-completion/completions/'
|
||||||
|
|
||||||
locations=(
|
locations=(
|
||||||
"$(dirname ${funcsourcetrace[1]%:*})"/git-completion.bash
|
"$(dirname ${funcsourcetrace[1]%:*})"/git-completion.bash
|
||||||
'/etc/bash_completion.d/git' # fedora, old debian
|
"$HOME/.local/share/bash-completion/completions/git"
|
||||||
'/usr/share/bash-completion/completions/git' # arch, ubuntu, new debian
|
"$bash_completion/git"
|
||||||
'/usr/share/bash-completion/git' # gentoo
|
'/etc/bash_completion.d/git' # old debian
|
||||||
)
|
)
|
||||||
for e in $locations; do
|
for e in $locations; do
|
||||||
test -f $e && script="$e" && break
|
test -f $e && script="$e" && break
|
||||||
|
|
Loading…
Reference in New Issue