summaryrefslogtreecommitdiff
path: root/Completion/Core
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Core')
-rw-r--r--Completion/Core/_all_labels42
-rw-r--r--Completion/Core/_expand6
-rw-r--r--Completion/Core/_file_descriptors4
-rw-r--r--Completion/Core/_history6
-rw-r--r--Completion/Core/_multi_parts4
-rw-r--r--Completion/Core/_next_label14
-rw-r--r--Completion/Core/_options5
-rw-r--r--Completion/Core/_path_files8
-rw-r--r--Completion/Core/_requested8
-rw-r--r--Completion/Core/_sep_parts14
-rw-r--r--Completion/Core/_set_options5
-rw-r--r--Completion/Core/_unset_options5
-rw-r--r--Completion/Core/_wanted14
13 files changed, 72 insertions, 63 deletions
diff --git a/Completion/Core/_all_labels b/Completion/Core/_all_labels
index f85478cb5..cdb89e7fa 100644
--- a/Completion/Core/_all_labels
+++ b/Completion/Core/_all_labels
@@ -1,43 +1,43 @@
#autoload
-local gopt=-J len tmp pre suf ret=1 descr spec prev
+local __gopt=-J __len __tmp __pre __suf __ret=1 __descr __spec __prev
if [[ "$1" = - ]]; then
- prev=-
+ __prev=-
shift
fi
if [[ "$1" = -([12]|)[VJ] ]]; then
- gopt="$1"
+ __gopt="$1"
shift
fi
-tmp=${argv[(ib:4:)-]}
-len=$#
-if [[ tmp -lt len ]]; then
- pre=$(( tmp-1 ))
- suf=$tmp
-elif [[ tmp -eq $# ]]; then
- pre=-2
- suf=$(( len+1 ))
+__tmp=${argv[(ib:4:)-]}
+__len=$#
+if [[ __tmp -lt __len ]]; then
+ __pre=$(( __tmp-1 ))
+ __suf=$__tmp
+elif [[ __tmp -eq $# ]]; then
+ __pre=-2
+ __suf=$(( __len+1 ))
else
- pre=4
- suf=5
+ __pre=4
+ __suf=5
fi
-while comptags "-A$prev" "$1" curtag spec; do
- _comp_tags="$_comp_tags $spec "
+while comptags "-A$__prev" "$1" curtag __spec; do
+ _comp_tags="$_comp_tags $__spec "
if [[ "$curtag" = *:* ]]; then
- zformat -f descr "${curtag#*:}" "d:$3"
- _description "$gopt" "${curtag%:*}" "$2" "$descr"
+ zformat -f __descr "${curtag#*:}" "d:$3"
+ _description "$__gopt" "${curtag%:*}" "$2" "$__descr"
curtag="${curtag%:*}"
- "$4" "${(P@)2}" "${(@)argv[5,-1]}" && ret=0
+ "$4" "${(P@)2}" "${(@)argv[5,-1]}" && __ret=0
else
- _description "$gopt" "$curtag" "$2" "$3"
+ _description "$__gopt" "$curtag" "$2" "$3"
- "${(@)argv[4,pre]}" "${(P@)2}" "${(@)argv[suf,-1]}" && ret=0
+ "${(@)argv[4,__pre]}" "${(P@)2}" "${(@)argv[__suf,-1]}" && __ret=0
fi
done
-return ret
+return __ret
diff --git a/Completion/Core/_expand b/Completion/Core/_expand
index 869c9c843..fb146e0de 100644
--- a/Completion/Core/_expand
+++ b/Completion/Core/_expand
@@ -104,7 +104,7 @@ if [[ -z "$compstate[insert]" ]] ;then
_description -V expansions expl expansions "o:$word"
fi
- compadd "$expl[@]" -UQ -qS "$suf" - "$exp[@]"
+ compadd "$expl[@]" -UQ -qS "$suf" -a exp
else
_tags all-expansions expansions original
@@ -142,8 +142,8 @@ else
normal=( "$normal[@]" "$i" )
fi
done
- (( $#dir )) && compadd "$expl[@]" -UQ -qS/ - "$dir[@]"
- (( $#normal )) && compadd "$expl[@]" -UQ -qS "$suf" - "$normal[@]"
+ (( $#dir )) && compadd "$expl[@]" -UQ -qS/ -a dir
+ (( $#normal )) && compadd "$expl[@]" -UQ -qS "$suf" -a normal
fi
_requested original expl original && compadd "$expl[@]" -UQ - "$word"
diff --git a/Completion/Core/_file_descriptors b/Completion/Core/_file_descriptors
index 37e44c068..56f6905c6 100644
--- a/Completion/Core/_file_descriptors
+++ b/Completion/Core/_file_descriptors
@@ -17,7 +17,7 @@ if zstyle -T ":completion:${curcontext}" verbose && [[ -e /proc/$$/fd ]]; then
list=( ${list[@]} "$i -- $(ls -l /proc/$$/fd/$i|sed 's/.*-> //' )" )
done
fi
- _wanted file-descriptors expl 'file descriptors' compadd "$@" -d list - "$fds[@]"
+ _wanted file-descriptors expl 'file descriptors' compadd "$@" -d list -a fds
else
- _wanted file-descriptors expl 'file descriptors' compadd "$@" - "$fds[@]"
+ _wanted file-descriptors expl 'file descriptors' compadd "$@" -a fds
fi
diff --git a/Completion/Core/_history b/Completion/Core/_history
index 978a75400..86fd9efc5 100644
--- a/Completion/Core/_history
+++ b/Completion/Core/_history
@@ -16,7 +16,7 @@
# remove /all/ duplicate matches rather than just
# consecutives
-local opt expl
+local opt expl h_words
if zstyle -t ":completion:${curcontext}:" remove-all-dups; then
opt=-
@@ -32,5 +32,5 @@ fi
# We skip the first element of historywords so the current word doesn't
# interfere with the completion
-_wanted "$opt" history-words expl 'history word' \
- compadd -Q - "${(@)historywords[2,-1]}"
+h_words=( "${(@)historywords[2,-1]}" )
+_wanted "$opt" history-words expl 'history word' compadd -Q -a h_words
diff --git a/Completion/Core/_multi_parts b/Completion/Core/_multi_parts
index bdfa26fc3..9f70534fc 100644
--- a/Completion/Core/_multi_parts
+++ b/Completion/Core/_multi_parts
@@ -59,7 +59,7 @@ pref=''
# If the string from the line matches at least one of the strings,
# we use only the matching strings.
-compadd -O tmp1 -M "r:|${sep}=* r:|=* $matcher" - "$matches[@]"
+compadd -O tmp1 -M "r:|${sep}=* r:|=* $matcher" -a matches
(( $#tmp1 )) && matches=( "$tmp1[@]" )
@@ -138,7 +138,7 @@ while true; do
PREFIX="$pre"
SUFFIX="$suf"
- compadd -O matches -M "r:|${sep}=* r:|=* $matcher" - "$matches[@]"
+ compadd -O matches -M "r:|${sep}=* r:|=* $matcher" -a matches
if [[ "$pre" = *${sep}* ]]; then
PREFIX="${cpre}${pre%%${sep}*}"
diff --git a/Completion/Core/_next_label b/Completion/Core/_next_label
index 95569df3b..ca40d9a33 100644
--- a/Completion/Core/_next_label
+++ b/Completion/Core/_next_label
@@ -1,21 +1,21 @@
#autoload
-local gopt=-J descr spec
+local __gopt=-J __descr __spec
if [[ "$1" = -([12]|)[VJ] ]]; then
- gopt="$1"
+ __gopt="$1"
shift
fi
-if comptags -A "$1" curtag spec; then
- _comp_tags="$_comp_tags $spec "
+if comptags -A "$1" curtag __spec; then
+ _comp_tags="$_comp_tags $__spec "
if [[ "$curtag" = *:* ]]; then
- zformat -f descr "${curtag#*:}" "d:$3"
- _description "$gopt" "${curtag%:*}" "$2" "$descr"
+ zformat -f __descr "${curtag#*:}" "d:$3"
+ _description "$__gopt" "${curtag%:*}" "$2" "$__descr"
curtag="${curtag%:*}"
set -A $2 "${(P@)2}" "${(@)argv[4,-1]}"
else
- _description "$gopt" "$curtag" "$2" "$3"
+ _description "$__gopt" "$curtag" "$2" "$3"
set -A $2 "${(@)argv[4,-1]}" "${(P@)2}"
fi
diff --git a/Completion/Core/_options b/Completion/Core/_options
index 0a852e6ce..f86ec42a3 100644
--- a/Completion/Core/_options
+++ b/Completion/Core/_options
@@ -2,4 +2,7 @@
# This should be used to complete all option names.
-compgen "$@" -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' -o
+local expl
+
+_wanted zsh-options expl 'zsh option' \
+ compadd "$@" -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' -k options
diff --git a/Completion/Core/_path_files b/Completion/Core/_path_files
index 807172bbb..be7eaff85 100644
--- a/Completion/Core/_path_files
+++ b/Completion/Core/_path_files
@@ -515,7 +515,7 @@ for prepath in "$prepaths[@]"; do
compadd -Qf "$mopts[@]" -p "$linepath$tmp2" \
-W "$prepath$realpath$testpath" \
"$pfxsfx[@]" -M "r:|/=* r:|=*" \
- - "$tmp1[@]"
+ -a tmp1
fi
else
if [[ "$tmp3" = */* ]]; then
@@ -529,7 +529,7 @@ for prepath in "$prepaths[@]"; do
compadd -Qf "$mopts[@]" -p "$linepath$tmp2" \
-W "$prepath$realpath$testpath" \
"$pfxsfx[@]" -M "r:|/=* r:|=*" \
- - "$tmp1[@]"
+ -a tmp1
fi
fi
tmp4=-
@@ -591,7 +591,7 @@ for prepath in "$prepaths[@]"; do
tmp4="$testpath"
compquote tmp4 tmp1
compadd -Qf "$mopts[@]" -p "$linepath$tmp4" -W "$prepath$realpath$testpath" \
- "$pfxsfx[@]" -M "r:|/=* r:|=*" - "$tmp1[@]"
+ "$pfxsfx[@]" -M "r:|/=* r:|=*" -a tmp1
fi
fi
done
@@ -605,7 +605,7 @@ if zstyle -t ":completion:${curcontext}:paths" expand prefix &&
"$exppaths" != "$eorig" ]]; then
PREFIX="${opre}"
SUFFIX="${osuf}"
- compadd -Q "$mopts[@]" -S '' -M "r:|/=* r:|=*" -p "$linepath" - "$exppaths[@]"
+ compadd -Q "$mopts[@]" -S '' -M "r:|/=* r:|=*" -p "$linepath" -a exppaths
fi
[[ nm -ne compstate[nmatches] ]]
diff --git a/Completion/Core/_requested b/Completion/Core/_requested
index 2772b1bd7..5614098bc 100644
--- a/Completion/Core/_requested
+++ b/Completion/Core/_requested
@@ -1,17 +1,17 @@
#autoload
-local gopt=-J
+local __gopt=-J
if [[ "$1" = -([12]|)[VJ] ]]; then
- gopt="$1"
+ __gopt="$1"
shift
fi
if comptags -R "$1"; then
if [[ $# -gt 3 ]]; then
- _all_labels - "$gopt" "$@" || return 1
+ _all_labels - "$__gopt" "$@" || return 1
elif [[ $# -gt 1 ]]; then
- _description "$gopt" "$@"
+ _description "$__gopt" "$@"
fi
return 0
else
diff --git a/Completion/Core/_sep_parts b/Completion/Core/_sep_parts
index 0f9ef0fc4..4e505dd64 100644
--- a/Completion/Core/_sep_parts
+++ b/Completion/Core/_sep_parts
@@ -58,9 +58,9 @@ while [[ $# -gt 1 ]]; do
# Get the matching array elements.
PREFIX="${str%%(|\\)${sep}*}"
- builtin compadd -O testarr - "${(@P)arr}"
+ builtin compadd -O testarr -a "$arr"
[[ $#testarr -eq 0 && -n "$_comp_correct" ]] &&
- compadd -O testarr - "${(@P)arr}"
+ compadd -O testarr -a "$arr"
# If there are no matches we give up. If there is more than one
# match, this is the part we will complete.
@@ -88,9 +88,9 @@ if [[ $# -le 1 || "$str" != *${2}* ]]; then
# No more separators, build the matches.
PREFIX="$str"
- builtin compadd -O testarr - "${(@P)arr}"
+ builtin compadd -O testarr -a "$arr"
[[ $#testarr -eq 0 && -n "$_comp_correct" ]] &&
- compadd -O testarr - "${(@P)arr}"
+ compadd -O testarr -a "$arr"
fi
[[ $#testarr -eq 0 || ${#testarr[1]} -eq 0 ]] && return 1
@@ -125,9 +125,9 @@ while [[ $# -gt 0 && "$str" == *${1}* ]]; do
arr=tmparr
fi
- builtin compadd -O tmparr - "${(@P)arr}"
+ builtin compadd -O tmparr -a "$arr"
[[ $#tmparr -eq 0 && -n "$_comp_correct" ]] &&
- compadd -O tmparr - "${(@P)arr}"
+ compadd -O tmparr - "$arr"
suffixes=("${(@)^suffixes[@]}${(q)1}${(@)^tmparr}")
@@ -155,7 +155,7 @@ PREFIX="$pre"
SUFFIX="$suf"
for i in "$suffixes[@]"; do
compadd -U "$group[@]" "$expl[@]" "$matchers[@]" "$autosuffix[@]" "$opts[@]" \
- -i "$IPREFIX" -I "$ISUFFIX" -p "$prefix" -s "$i" - "$testarr[@]"
+ -i "$IPREFIX" -I "$ISUFFIX" -p "$prefix" -s "$i" -a testarr
done
# This sets the return value to indicate that we added matches (or not).
diff --git a/Completion/Core/_set_options b/Completion/Core/_set_options
index 5f634a2cd..37de45cd0 100644
--- a/Completion/Core/_set_options
+++ b/Completion/Core/_set_options
@@ -4,4 +4,7 @@
# names of the options that were set when it was called in the array
# `_set_options'.
-compadd "$@" -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' - $=_set_options
+local expl
+
+_wanted zsh-options expl 'set zsh option' \
+ compadd "$@" -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' -a _set_options
diff --git a/Completion/Core/_unset_options b/Completion/Core/_unset_options
index c5150c2e5..49cf70598 100644
--- a/Completion/Core/_unset_options
+++ b/Completion/Core/_unset_options
@@ -4,4 +4,7 @@
# names of the options that were set when it was called in the array
# `_set_options'.
-compadd "$@" -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' - $=_unset_options
+local expl
+
+_wanted zsh-options expl 'unset zsh option' \
+ compadd "$@" -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' -a _unset_options
diff --git a/Completion/Core/_wanted b/Completion/Core/_wanted
index 958f9e18e..3e25fdbbc 100644
--- a/Completion/Core/_wanted
+++ b/Completion/Core/_wanted
@@ -1,26 +1,26 @@
#autoload
-local targs gopt=-J
+local __targs __gopt=-J
if [[ "$1" = -C?* ]]; then
- targs=( -C "${1[3,-1]}" )
+ __targs=( -C "${1[3,-1]}" )
shift
elif [[ "$1" = -C ]]; then
- targs=( -C "$2" )
+ __targs=( -C "$2" )
shift 2
else
- targs=()
+ __targs=()
fi
if [[ "$1" = -([12]|)[VJ] ]]; then
- gopt="$1"
+ __gopt="$1"
shift
fi
-_tags "$targs[@]" "$1"
+_tags "$__targs[@]" "$1"
while _tags; do
- _all_labels "$gopt" "$@" && return 0
+ _all_labels "$__gopt" "$@" && return 0
done
return 1