Merge branch 'fc/zsh-leftover-bits'
* fc/zsh-leftover-bits: completion: zsh: improve bash script loading completion: synchronize zsh wrapper completion: cleanup zsh wrapper
This commit is contained in:
@ -2663,7 +2663,7 @@ if [[ -n ${ZSH_VERSION-} ]]; then
|
|||||||
--*=*|*.) ;;
|
--*=*|*.) ;;
|
||||||
*) c="$c " ;;
|
*) c="$c " ;;
|
||||||
esac
|
esac
|
||||||
array[$#array+1]="$c"
|
array+=("$c")
|
||||||
done
|
done
|
||||||
compset -P '*[=:]'
|
compset -P '*[=:]'
|
||||||
compadd -Q -S '' -p "${2-}" -a -- array && _ret=0
|
compadd -Q -S '' -p "${2-}" -a -- array && _ret=0
|
||||||
@ -2689,22 +2689,14 @@ if [[ -n ${ZSH_VERSION-} ]]; then
|
|||||||
compadd -Q -p "${2-}" -f -- ${=1} && _ret=0
|
compadd -Q -p "${2-}" -f -- ${=1} && _ret=0
|
||||||
}
|
}
|
||||||
|
|
||||||
__git_zsh_helper ()
|
|
||||||
{
|
|
||||||
emulate -L ksh
|
|
||||||
local cur cword prev
|
|
||||||
cur=${words[CURRENT-1]}
|
|
||||||
prev=${words[CURRENT-2]}
|
|
||||||
let cword=CURRENT-1
|
|
||||||
__${service}_main
|
|
||||||
}
|
|
||||||
|
|
||||||
_git ()
|
_git ()
|
||||||
{
|
{
|
||||||
emulate -L zsh
|
local _ret=1 cur cword prev
|
||||||
local _ret=1
|
cur=${words[CURRENT]}
|
||||||
__git_zsh_helper
|
prev=${words[CURRENT-1]}
|
||||||
let _ret && _default -S '' && _ret=0
|
let cword=CURRENT-1
|
||||||
|
emulate ksh -c __${service}_main
|
||||||
|
let _ret && _default && _ret=0
|
||||||
return _ret
|
return _ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,18 +4,17 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2012-2013 Felipe Contreras <felipe.contreras@gmail.com>
|
# Copyright (c) 2012-2013 Felipe Contreras <felipe.contreras@gmail.com>
|
||||||
#
|
#
|
||||||
# You need git's bash completion script installed somewhere, by default on the
|
# You need git's bash completion script installed somewhere, by default it
|
||||||
# same directory as this script.
|
# would be the location bash-completion uses.
|
||||||
#
|
#
|
||||||
# If your script is on ~/.git-completion.sh instead, you can configure it on
|
# If your script is somewhere else, you can configure it on your ~/.zshrc:
|
||||||
# your ~/.zshrc:
|
|
||||||
#
|
#
|
||||||
# zstyle ':completion:*:*:git:*' script ~/.git-completion.sh
|
# zstyle ':completion:*:*:git:*' script ~/.git-completion.sh
|
||||||
#
|
#
|
||||||
# The recommended way to install this script is to copy to
|
# The recommended way to install this script is to copy to '~/.zsh/_git', and
|
||||||
# '~/.zsh/completion/_git', and then add the following to your ~/.zshrc file:
|
# then add the following to your ~/.zshrc file:
|
||||||
#
|
#
|
||||||
# fpath=(~/.zsh/completion $fpath)
|
# fpath=(~/.zsh $fpath)
|
||||||
|
|
||||||
complete ()
|
complete ()
|
||||||
{
|
{
|
||||||
@ -27,7 +26,19 @@ zstyle -T ':completion:*:*:git:*' tag-order && \
|
|||||||
zstyle ':completion:*:*:git:*' tag-order 'common-commands'
|
zstyle ':completion:*:*:git:*' tag-order 'common-commands'
|
||||||
|
|
||||||
zstyle -s ":completion:*:*:git:*" script script
|
zstyle -s ":completion:*:*:git:*" script script
|
||||||
test -z "$script" && script="$(dirname ${funcsourcetrace[1]%:*})"/git-completion.bash
|
if [ -z "$script" ]; then
|
||||||
|
local -a locations
|
||||||
|
local e
|
||||||
|
locations=(
|
||||||
|
'/etc/bash_completion.d/git' # fedora, old debian
|
||||||
|
'/usr/share/bash-completion/completions/git' # arch, ubuntu, new debian
|
||||||
|
'/usr/share/bash-completion/git' # gentoo
|
||||||
|
$(dirname ${funcsourcetrace[1]%:*})/git-completion.bash
|
||||||
|
)
|
||||||
|
for e in $locations; do
|
||||||
|
test -f $e && script="$e" && break
|
||||||
|
done
|
||||||
|
fi
|
||||||
ZSH_VERSION='' . "$script"
|
ZSH_VERSION='' . "$script"
|
||||||
|
|
||||||
__gitcomp ()
|
__gitcomp ()
|
||||||
|
Reference in New Issue
Block a user