1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-02 22:11:54 +02:00

use compadd -[ak] (11549)

This commit is contained in:
Sven Wischnowsky 2000-05-31 09:38:25 +00:00
parent 4629133ad3
commit fd25b24df6
67 changed files with 473 additions and 227 deletions

View file

@ -1,5 +1,41 @@
2000-05-31 Sven Wischnowsky <wischnow@zsh.org>
* 11549: Completion/Base/_combination, Completion/Base/_command_names,
Completion/Base/_describe, Completion/Base/_equal,
Completion/Base/_subscript, Completion/Base/_tilde,
Completion/Base/_value, Completion/Builtins/_aliases,
Completion/Builtins/_bindkey, Completion/Builtins/_builtin,
Completion/Builtins/_cd, Completion/Builtins/_command,
Completion/Builtins/_compdef, Completion/Builtins/_functions,
Completion/Builtins/_hash, Completion/Builtins/_popd,
Completion/Builtins/_unhash, Completion/Builtins/_vars,
Completion/Builtins/_which, Completion/Builtins/_zcompile,
Completion/Builtins/_zle, Completion/Builtins/_zmodload,
Completion/Builtins/_zpty, Completion/Builtins/_zstyle,
Completion/Commands/_bash_completions,
Completion/Commands/_history_complete_word,
Completion/Core/_all_labels, Completion/Core/_expand,
Completion/Core/_file_descriptors, Completion/Core/_history,
Completion/Core/_multi_parts, Completion/Core/_next_label,
Completion/Core/_options, Completion/Core/_path_files,
Completion/Core/_requested, Completion/Core/_sep_parts,
Completion/Core/_set_options, Completion/Core/_unset_options,
Completion/Core/_wanted, Completion/User/_archie,
Completion/User/_cvs, Completion/User/_domains,
Completion/User/_gprof, Completion/User/_groups,
Completion/User/_hosts, Completion/User/_lp,
Completion/User/_mailboxes, Completion/User/_make,
Completion/User/_mount, Completion/User/_mysql_utils,
Completion/User/_netscape, Completion/User/_perl,
Completion/User/_perl_basepods,
Completion/User/_perl_builtin_funcs,
Completion/User/_perl_modules, Completion/User/_ports,
Completion/User/_rcs, Completion/User/_urls,
Completion/User/_users, Completion/User/_yp,
Completion/X/_x_color, Completion/X/_x_cursor,
Completion/X/_x_extension, Completion/X/_x_font,
Completion/X/_x_keysym, Completion/X/_xutils: use compadd -[ak]
* Andrej: 11660: Completion/User/_man: fix for ${..//..} with % in
search string

View file

@ -1,25 +1,27 @@
#autoload
# Usage:
# _combination [-s S] V[:K1:...] Ki1[:Ni1]=Pi1 Ki2[:Ni2]=Pi2 ... Kim[:Nim]=Pim Kj[:Nj] EXPL...
# _combination [-s S] TAG STYLE \
# Ki1[:Ni1]=Pi1 Ki2[:Ni2]=Pi2 ... Kim[:Nim]=Pim Kj[:Nj] EXPL...
#
# It is assumed that V is formed as PRE_K1_..._Kn if `:K1:...' is not specified.
# STYLE should be of the form K1-K2-...-Kn.
#
# Example: telnet
#
# Assume an user sets the variable `telnet_hosts_ports_users' as:
# Assume an user sets the style `users-hosts-ports' as for the my-accounts
# tag:
#
# telnet_hosts_ports_users=(
# host0:: host1::user1 host2::user2
# mail-server:{smtp,pop3}:
# news-server:nntp:
# proxy-server:8000:
# )
# zstyle ':completion:*:*:telnet:*:my-accounts' users-hosts-ports \
# @host0: user1@host1: user2@host2:
# @mail-server:{smtp,pop3}
# @news-server:nntp
# @proxy-server:8000
#
#
# `_telnet completes' hosts as:
# `_telnet' completes hosts as:
#
# _combination telnet_hosts_ports_users \
# ${options[-l]:+users=${options[-l]:q}} \
# _combination my-accounts users-hosts-ports \
# ${opt_args[-l]:+users=${opt_args[-l]:q}} \
# hosts "$expl[@]"
#
# This completes `host1', `host2', `mail-server', `news-server' and
@ -28,8 +30,8 @@
#
# `_telnet' completes ports as:
#
# _combination telnet_hosts_ports_users \
# ${options[-l]:+users=${options[-l]:q}} \
# _combination my-accounts users-hosts-ports \
# ${opt_args[-l]:+users=${opt_args[-l]:q}} \
# hosts="${line[2]:q}" \
# ports "$expl[@]"
#
@ -39,7 +41,7 @@
#
# `_telnet' completes users for an argument of option `-l' as:
#
# _combination telnet_hosts_ports_users \
# _combination my-accounts users-hosts-ports \
# ${line[2]:+hosts="${line[2]:q}"} \
# ${line[3]:+ports="${line[3]:q}"} \
# users "$expl[@]"
@ -48,25 +50,23 @@
# the port argument if they are exist. And if it is failed, `_users' is
# called.
local sep var keys pats key num tmp
local sep tag style keys pats key num tmp
if [[ "$1" = -s ]]; then
sep="$2"
shift 2
elif [[ "$1" = -s* ]]; then
sep="${1[3,-1]}"
shift
else
sep=:
fi
var=$1
shift
tag="$1"
style="$2"
shift 2
if [[ $var = *:* ]]; then
keys=( ${(s/:/)var} )
shift keys
var="${var%%:*}"
else
keys=( "${(@s:_:)${var#*_}}" )
fi
keys=( ${(s/-/)style} )
pats=( "${(@)keys/*/*}" )
while [[ "$1" = *=* ]]; do
@ -81,15 +81,14 @@ key="${1%:*}"
num="${${1##*:}:-1}"
shift
if (( ${(P)+${var}} )); then
eval "tmp=( \"\${(@M)${var}:#\${(j($sep))~pats}}\" )"
if zstyle -a ":completion:${curcontext}:$tag" "$style" tmp; then
eval "tmp=( \"\${(@M)tmp:#\${(j($sep))~pats}}\" )"
if (( keys[(in:num:)$key] != 1 )); then
eval "tmp=( \${tmp#\${(j(${sep}))~\${(@)\${(@)keys[2,(rn:num:)\$key]}/*/*}}$sep} )"
eval "tmp=( \${tmp#\${(j(${sep}))~\${(@)\${(@)keys[2,(rn:num:)\$key]}/*/*}}${~sep}} )"
fi
tmp=( ${tmp%%$sep*} )
tmp=( ${tmp%%${~sep}*} )
compadd "$@" - $tmp || { builtin functions _$key >&- && _$key "$@" }
compadd "$@" -a tmp || { (( $+functions[_$key] )) && "_$key" "$@" }
else
builtin functions _$key >&- && _$key "$@"
(( $+functions[_$key] )) && "_$key" "$@"
fi

View file

@ -1,3 +1,31 @@
#defcomp -command-
#compdef -command-
complist -c
# The option `-e' if given as the first argument says that we should
# complete only external commands and executable files. This and a
# `-' as the first argument is then removed from the arguments.
local args defs
defs=(
'commands:external command:compadd -k commands'
'executables:executable file or directory:_path_files -/g \*\(-\*\)'
)
if [[ "$1" = -e ]]; then
shift
else
[[ "$1" = - ]] && shift
defs=( "$defs[@]"
'builtins:builtin command:compadd -k builtins'
'functions:shell function:compadd -k functions'
'aliases:alias:compadd -k aliases'
'reserved-words:reserved word:compadd -k reswords'
'jobs:: _jobs -t'
'parameters:: _parameters -qS= -r "\n\t\- =["'
)
fi
args=( "$@" )
_alternative -O args "$defs[@]"

View file

@ -52,8 +52,8 @@ while _tags; do
fi
fi
compadd "$_args[@]" "$_expl[@]" -ld _tmpd - "$_tmpmd[@]" && _ret=0
compadd "$_args[@]" "$_expl[@]" -d _tmps - "$_tmpms[@]" && _ret=0
compadd "$_args[@]" "$_expl[@]" -ld _tmpd -a _tmpmd && _ret=0
compadd "$_args[@]" "$_expl[@]" -d _tmps -a _tmpms && _ret=0
done
done
(( _ret )) || return 0

View file

@ -1,3 +1,9 @@
#defcomp -equal-
#compdef -equal-
compgen -am
local args
args=( "$@" )
_alternative -O args \
'commands:command:compadd -k commands' \
'aliases:alias:compadd -k aliases'

View file

@ -12,7 +12,7 @@ elif [[ ${(Pt)${compstate[parameter]}} = assoc* ]]; then
[[ "$RBUFFER" != \]* ]] && suf=']'
_wanted association-keys expl 'association key' \
compadd -S "$suf" - "${(@kP)${compstate[parameter]}}"
compadd -S "$suf" -k "$compstate[parameter]"
elif [[ ${(Pt)${compstate[parameter]}} = array* ]]; then
local list i j ret=1 disp
@ -39,10 +39,10 @@ elif [[ ${(Pt)${compstate[parameter]}} = array* ]]; then
if [[ "$RBUFFER" = \]* ]]; then
_all_labels -V indexes expl 'array index' \
compadd -S '' "$disp[@]" - "$ind[@]" && ret=0
compadd -S '' "$disp[@]" -a ind && ret=0
else
_all_labels -V indexes expl 'array index' \
compadd -S ']' "$disp[@]" - "$ind[@]" && ret=0
compadd -S ']' "$disp[@]" -a ind && ret=0
fi
fi
_requested parameters && _parameters && ret=0

View file

@ -2,7 +2,7 @@
# We use all named directories and user names here. If this is too slow
# for you or if there are too many of them, you may want to use
# `compadd -qS/ - "$friends[@]"' or something like that.
# `compadd -qS/ -a friends' or something like that.
[[ -n "$compstate[quote]" ]] && return 1
@ -22,7 +22,7 @@ while _tags; do
_requested users && _users "$suf[@]" "$@" && ret=0
_requested named-directories expl 'named directory' \
compadd "$suf[@]" "$@" - "${(@k)nameddirs}"
compadd "$suf[@]" "$@" -k nameddirs
if _requested directory-stack &&
{ ! zstyle -T ":completion:${curcontext}:directory-stack" prefix-needed ||
@ -50,7 +50,7 @@ while _tags; do
disp=()
fi
_all_labels -V directory-stack expl 'directory stack' \
compadd "$suf[@]" "$disp[@]" -Q - "$list[@]" && ret=0
compadd "$suf[@]" "$disp[@]" -Q -a list && ret=0
fi
(( ret )) || return 0
done

View file

@ -10,7 +10,7 @@ _value () {
"${(Pt)${compstate[parameter]}}" = assoc* ]]; then
if (( CURRENT & 1 )); then
_wanted association-keys expl 'association key' \
compadd - "${(@kP)${compstate[parameter]}}"
compadd -k "$compstate[parameter]"
else
compstate[parameter]="${compstate[parameter]}-${words[CURRENT-1]}"
_value "$@"

View file

@ -1,3 +1,7 @@
#defcomp unalias
#compdef alias unalias
complist -a
local expl
_alternative \
'aliases:regular alias:compadd -k aliases' \
'global-aliases:global alias:compadd -k galiases'

View file

@ -29,9 +29,9 @@ _arguments -C -s \
case $state in
keymap)
_wanted -C -M keymaps expl keymap compadd - "$keymaps[@]"
_wanted -C -M keymaps expl keymap compadd -a keymaps
;;
widget)
_wanted widgets expl widget compadd -M 'r:|-=* r:|=*' - "${(@k)widgets}"
_wanted widgets expl widget compadd -M 'r:|-=* r:|=*' -k widgets
;;
esac

View file

@ -1,7 +1,11 @@
#defcomp builtin
#compdef builtin
if [[ -position 2 -1 ]]; then
_normal "$@"
if (( $CURRENT > 2 )); then
shift words
(( CURRENT -- ))
_normal
else
complist -eB
local expl
_wanted commands expl 'builtin command' compadd "$@" -k builtins
fi

View file

@ -22,7 +22,7 @@ if [[ CURRENT -eq 3 ]]; then
rep=(${~PWD/$words[2]/*}~$PWD(-/N))
# Now remove all the common parts of $PWD and the completions from this
rep=(${${rep#${PWD%%$words[2]*}}%${PWD#*$words[2]}})
(( $#rep )) && _wanted -C replacement strings expl replacement compadd $rep
(( $#rep )) && _wanted -C replacement strings expl replacement compadd -a rep
elif _popd || [[ $PREFIX != (\~|/|./|../)* && $#cdpath -ne 0 ]]; then
local tdir tdir2

View file

@ -1,7 +1,10 @@
#defcomp command
#compdef command
if [[ -position 2 -1 ]]; then
_normal "$@"
if [[ CURRENT -ge 3 ]]; then
compset -n 2
_normal
else
complist -em
local expl
_wanted commands expl 'external command' compadd "$@" -k commands
fi

View file

@ -30,16 +30,16 @@ fi
case $state in
ccom)
_wanted commands expl 'completed command' compadd - ${(k)_comps}
_wanted commands expl 'completed command' compadd -k _comps
;;
cfun)
list=( ${^fpath:/.}/_(|*[^~])(N:t) )
if zstyle -T ":completion:${curcontext}:functions" prefix-hidden; then
disp=( ${list[@]#_} )
_wanted functions expl 'completion function' \
compadd -d disp - "$list[@]"
compadd -d disp -a list
else
_wanted functions expl 'completion function' compadd - "$list[@]"
_wanted functions expl 'completion function' compadd -a list
fi
;;
style)

View file

@ -1,3 +1,5 @@
#defcomp unfunction
#compdef functions unfunction
complist -F
local expl
_wanted functions expl 'shell function' compadd "$@" -k functions

View file

@ -28,11 +28,11 @@ if [[ $state = hashval ]]; then
_wanted -C value files expl directories _path_files -/
else
_wanted -C name named-directories expl 'named directory' \
compadd -q -S '=' - "${(@k)nameddirs}"
compadd -q -S '=' -k nameddirs
fi
elif compset -P 1 '*='; then
_wanted -C value values expl 'executable file' _files -g '*(-*)'
else
_wanted -C name commands expl command compadd -q -S '=' - "${(@k)commands}"
_wanted -C name commands expl command compadd -q -S '=' -k commands
fi
fi

View file

@ -38,4 +38,4 @@ else
fi
_wanted -V directory-stack expl 'directory stack' \
compadd "$@" "$disp[@]" -Q - "$list[@]"
compadd "$@" "$disp[@]" -Q -a list

View file

@ -7,8 +7,8 @@ _arguments -C -s \
'(-d -f *)-a[remove aliases]:*:aliases:_aliases' \
'(-d -a *)-f[remove functions]:*:functions:_functions' \
'-m[treat arguments as patterns]' \
'*:commands:_command_names -e' && return 0
'*:commands: _command_names -e' && return 0
if [[ "$state" = nameddir ]]; then
_wanted nameddir expl 'named directory' compadd - ${(@k)nameddirs}
_wanted nameddir expl 'named directory' compadd -k nameddirs
fi

View file

@ -17,7 +17,7 @@ if [[ $PREFIX = *\[* ]]; then
local expl
_wanted -C subscript association-keys expl 'association key' \
compadd $addclose - ${(kP)var}
compadd $addclose -k "$var"
fi
else
_parameters

View file

@ -28,10 +28,10 @@ if [[ "$state" = command ]]; then
args=( "$@" )
_alternative -O args \
'commands:external command:compadd - ${(k@)commands}' \
'builtins:builtin command:compadd - ${(k@)builtins}' \
'functions:shell function:compadd - ${(k@)functions}' \
'aliases:alias:compadd - ${(k@)aliases}' \
'reserved-words:reserved word:compadd - ${(k@)reswords}'
'commands:external command:compadd -k commands' \
'builtins:builtin command:compadd -k builtins' \
'functions:shell function:compadd -k functions' \
'aliases:alias:compadd -k aliases' \
'reserved-words:reserved word:compadd -k reswords'
fi

View file

@ -17,7 +17,7 @@ _arguments -C -s \
'*:function:->function' && return 0
if (( $+opt_args[-c] )); then
_wanted functions expl 'function to write' compadd - ${(k)functions}
_wanted functions expl 'function to write' compadd -k functions
else
_description files expl 'zsh source file'
_files "$expl[@]"

View file

@ -1,7 +1,10 @@
#defcomp zle
#compdef zle
if [[ -word 1 -N && -position 3 ]]; then
complist -F
local expl
if [[ "$words[2]" = -N && CURRENT -eq 3 ]]; then
_wanted -C -N functions expl 'widget shell function' \
compadd "$@" -k functions
else
complist -b
_wanted widgets expl widget compadd -k widgets
fi

View file

@ -1,9 +1,11 @@
#defcomp zmodload
#compdef zmodload
if [[ -mword 1 -*(a*u|u*a)* || -mword 1 -*a* && -position 3 -1 ]]; then
complist -B
elif [[ -mword 1 -*u* ]]; then
complist -s '$(zmodload)'
local fl="$words[2]" expl
if [[ "$fl" = -*(a*u|u*a)* || "$fl" = -*a* && CURRENT -ge 4 ]]; then
_wanted builtins expl 'builtin command' compadd "$@" -k builtins
elif [[ "$fl" = -*u* ]]; then
_wanted modules expl module compadd -k modules
else
complist -s '${^module_path}/*(N:t:r)'
_wanted files expl 'module file' _files -W module_path -/g '*.s[ol](:r)'
fi

View file

@ -49,9 +49,9 @@ if [[ $state = name ]]; then
names=( ${list%%:*} )
if zstyle -T ":completion:${curcontext}" verbose; then
zformat -a list ' --' ${${(f)"$(zpty)"}#*\) }
_wanted names expl 'zpty command name' compadd -d list - "$names[@]"
_wanted names expl 'zpty command name' compadd -d list -a names
else
_wanted names expl 'zpty command name' compadd - "$names[@]"
_wanted names expl 'zpty command name' compadd -a names
fi
else
return 1

View file

@ -151,7 +151,7 @@ while [[ -n $state ]]; do
completer)
_wanted values expl completer \
compadd _complete _approximate _correct _match \
_expand _list _menu _oldlist _next_tags
_expand _list _menu _oldlist _ignored _prefix _history
;;
fsort)
@ -212,7 +212,7 @@ while [[ -n $state ]]; do
elif compset -P '*:'; then
_message 'tag alias'
else
_wanted tags expl tag compadd - $taglist
_wanted tags expl tag compadd -a taglist
fi
;;

View file

@ -28,12 +28,13 @@
setopt localoptions nullglob rcexpandparam extendedglob
unsetopt markdirs globsubst shwordsplit nounset ksharrays
local key=$KEYS[-1]
local key=$KEYS[-1] expl
case $key in
'!') _main_complete _command_names
;;
'$') compadd - "${(@k)parameters[(R)*export*]}"
'$') _main_complete - _wanted parameters expl 'exported parameters' \
compadd - "${(@k)parameters[(R)*export*]}"
;;
'@') _main_complete _hosts
;;

View file

@ -70,7 +70,7 @@ _history_complete_word () {
}
_history_complete_word_gen_matches () {
local opt
local opt h_words
[[ -n "$_hist_stop" ]] && PREFIX="$_hist_old_prefix"
@ -85,8 +85,9 @@ _history_complete_word_gen_matches () {
opt="${opt}V"
fi
h_words=( "${(@)historywords[2,-1]}" )
_wanted "$opt" history-words expl 'history word' \
compadd -Q - "$historywords[@]"
compadd -Q -a h_words
zstyle -t ":completion:${curcontext}:history-words" list ||
compstate[list]=

View file

@ -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

View file

@ -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"

View file

@ -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

View file

@ -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

View file

@ -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}*}"

View file

@ -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

View file

@ -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

View file

@ -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] ]]

View file

@ -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

View file

@ -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).

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -26,7 +26,7 @@ case "$state" in
serverhost)
: ${(A)archie_servers:=${(M)$(_call hosts archie -L):#archie.*}}
_wanted hosts expl 'archie servers' compadd - $archie_servers && return 0
_wanted hosts expl 'archie servers' compadd -a archie_servers && return 0
;;
esac

View file

@ -49,7 +49,7 @@ _cvs_command () {
watchers "")
if (( CURRENT == 1 )); then
_tags commands && { compadd "$@" ${(k)cmds} || compadd "$@" ${(kv)=cmds} }
_tags commands && { compadd "$@" -k cmds || compadd "$@" ${(kv)=cmds} }
else
local curcontext="$curcontext"
@ -584,7 +584,7 @@ _cvs_root () {
fi
_tags files && {
compadd -M 'r:|[:@./]=** r:|=**' "$@" $_cvs_roots || _files "$@" -/
compadd -M 'r:|[:@./]=** r:|=**' "$@" -a _cvs_roots || _files "$@" -/
}
}
@ -652,7 +652,7 @@ _cvs_modules () {
fi
fi
if (( $#_cvs_modules_cache )); then
_wanted modules expl 'module name' compadd - $_cvs_modules_cache
_wanted modules expl 'module name' compadd -a _cvs_modules_cache
else
_message 'module name'
fi
@ -683,7 +683,7 @@ _cvs_revisions () {
fi
if (( $#_cvs_revisions_cache )); then
_wanted values expl revision compadd - $_cvs_revisions_cache
_wanted values expl revision compadd -a _cvs_revisions_cache
else
_message revision
fi
@ -813,7 +813,7 @@ _cvs_nonexisting_entries () {
${${${${(M)${(f)"$(<"$realdir"CVS/Entries)"}:#(D|)/*}#(D|)/}%%/*}:#${(j:|:)~${files//(#m)[][*?()<|^~#\\]/\\$MATCH}}}
)
compquote files
_wanted files expl file compadd -Qp "$linedir" $files
_wanted files expl file compadd -Qp -a linedir files
}
}

View file

@ -2,7 +2,7 @@
local expl domains tmp
if ! zstyle -a ":completion${curcontext}:domains" domains domains; then
if ! zstyle -a ":completion:${curcontext}:domains" domains domains; then
if (( ! $+_cache_domains )); then
_cache_domains=()
if [[ -f /etc/resolv.conf ]]; then
@ -10,11 +10,11 @@ if ! zstyle -a ":completion${curcontext}:domains" domains domains; then
[[ "$tmp" = (domain|search)* ]] &&
_cache_domains=( "$_cache_domains[@]" "${=${tmp%%[ ]#}#*[ ]}" )
done < /etc/resolv.conf
_cache_domains=( "${(@)_nslookup_domains:#[ ]#}" )
_cache_domains=( "${(@)_cache_domains:#[ ]#}" )
fi
fi
domains=( "$_cache_domains[@]" )
fi
_wanted domains expl domain &&
compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" "$expl[@]" - "$domains[@]"
_wanted domains expl domain \
compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" -a domains

View file

@ -49,7 +49,7 @@ if [[ -n "$state" ]]; then
expl=function
fi
_wanted functions expl "$expl" \
compadd -M 'r:|_=* r:|=*' - "$_gprof_funcs[@]" && ret=0
compadd -M 'r:|_=* r:|=*' -a _gprof_funcs && ret=0
else
return 1
fi

View file

@ -16,4 +16,4 @@ if ! zstyle -a ":completion:${curcontext}:" groups groups; then
groups=( "$_cache_groups[@]" )
fi
_wanted groups expl group compadd "$@" - "$groups[@]"
_wanted groups expl group compadd "$@" -a groups

View file

@ -1,3 +1,13 @@
#defcomp ftp ncftp ping rwho rup xping traceroute nslookup
#compdef ftp ncftp ping rwho rup xping traceroute host
complist -k hosts
local expl hosts
if ! zstyle -a ":completion:${curcontext}:hosts" hosts hosts; then
(( $+_cache_hosts )) ||
: ${(A)_cache_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}}
hosts=( "$_cache_hosts[@]" )
fi
_wanted hosts expl host \
compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" -a hosts

View file

@ -26,7 +26,7 @@ else
else
disp=()
fi
_all_labels users expl user compadd "$disp[@]" - "$strs[@]" ||
_all_labels users expl user compadd "$disp[@]" -a strs ||
_users && ret=0
fi
if _requested jobs; then
@ -38,7 +38,7 @@ else
else
disp=()
fi
_all_labels jobs expl job compadd "$disp[@]" - "$strs[@]" && ret=0
_all_labels jobs expl job compadd "$disp[@]" -a strs && ret=0
fi
(( ret )) || return 0
done

View file

@ -1,32 +1,164 @@
#autoload
# This is needlessly mutt-biased and should be fixed.
_mailboxes() {
#emulate -L zsh
local expl ret=1
local pinedirectory="${pinedirectory:-~/mail}"
local maildirectory="${maildirectory:-~/Mail}"
local expl muttboxes mboxes dirboxes MHboxes maildirboxes muttrc="~/.muttrc" maildirectory="~/Mail"
if (( ! $+_mailbox_cache )) then
_mailbox_cache "$@"
fi
test -f "$compconfig[muttrc_path]" && muttrc=$compconfig[muttrc_path]
test -f "$compconfig[maildirectory]" && maildirectory=$compconfig[maildirectory]
case "${curcontext}" in
(*:mail:*)
if [[ "$PREFIX" == +* ]]; then
_tags mailboxes
else
_tags mailboxes files
fi;;
(*:(mush|zmail|zmlite):*)
if [[ "$PREFIX" == [%+]* ]]; then
_tags mailboxes
else
_tags mailboxes files
fi;;
(*:pine:*)
# Files for pine must be absolute paths.
if [[ "$PREFIX" == (|-f)[/\~]* ]]; then
pinedirectory=''
_tags mailboxes files
else
_tags mailboxes
fi;;
(*)
if [[ "$PREFIX" == (|-f)+* ]]; then
_tags mailboxes
else
_tags mailboxes files
fi;;
esac
if (( ! $+_mailbox_cache )) then
while _tags; do
_requested mailboxes expl 'mailbox specification' _mua_mailboxes && ret=0
test ${muttrc} || test -f ${~muttrc} && muttboxes=( ${(@)$(grep mailboxes ${~muttrc})[2,-1]} )
if _requested files expl 'mailbox file'; then
[[ "${curcontext}" != *:(mail|mush|zmail|zmlite):* ]] &&
compset -P -f
_files "$expl[@]" && ret=0
fi
(( ret )) || return 0
done
mboxes=(${~maildirectory}/*(^/))
dirboxes=(${~maildirectory}/*(/))
return 1
}
for i in $dirboxes
do
if test -d "${i}/cur"
then
maildirboxes=($maildirboxes $i)
else
MHboxes=($MHboxes $i)
fi
done
_mailbox_cache () {
# Depends on $maildirectory and $pinedirectory from _mailboxes!
_mailbox_cache=(\! \< \> $muttboxes $mboxes $maildirboxes $MHboxes)
local i j muttrc="${muttrc:-~/.muttrc}"
local -aU dirboxes
typeset -aU -g _mailbox_cache
typeset -aU -g _maildir_cache _mbox_cache _mh_cache _mutt_cache _pine_cache
fi
setopt localoptions nullglob
_description expl 'mailbox specification'
compadd "$@" "$expl[@]" - "$_mailbox_cache[@]"
[[ -f ${~muttrc:-.} ]] &&
_mutt_cache=( ${$(grep mailboxes ${~muttrc})[2,-1]} )
_mbox_cache=( ${~maildirectory}/*(^/) )
_pine_cache=( ${~pinedirectory}/**/*(.) )
dirboxes=( ${~maildirectory}/*(/) )
while (( $#dirboxes )); do
i=${dirboxes[1]}
shift dirboxes
if [[ -d "$i/cur" ]]; then
_maildir_cache=( "${_maildir_cache[@]}" "$i" )
elif j=( "$i"/<1-> ) && [[ -n "$j" ]]; then
_mh_cache=( "${_mh_cache[@]}" "$i" )
else
_mbox_cache=( "${_mbox_cache[@]}" "$i"/*(.) )
dirboxes=( $dirboxes "$i"/*(/) )
fi
done
[[ -n "$mailpath" ]] &&
_mailbox_cache=( "${_mailbox_cache[@]}" "${(@)mailpath%%\?*}" )
[[ -n "$MAIL" ]] && _mailbox_cache=( "${_mailbox_cache[@]}" $MAIL )
}
_mua_mailboxes() {
# Depends on $maildirectory and $pinedirectory from _mailboxes!
local -a mbox_short
local -aU mbox_names
local ret=1
case "${curcontext}" in
(*:elm:*) # I've probably got this wrong, or at least incomplete
mbox_names=( "${_mbox_cache[@]}" "${_mailbox_cache[@]}" )
mbox_short=( \! \< \> )
;;
(*:mail:*)
if compset -P +; then
mbox_names=( "${(@)_mbox_cache#$~maildirectory/}" )
else
mbox_names=( +"${(@)^_mbox_cache#$~maildirectory/}"
"${_mailbox_cache[@]}" )
fi
;;
(*:mh:*) # I've probably got this wrong, or at least incomplete
(( $#_mh_cache )) && _multi_parts "${expl[@]}" / _mh_cache && ret=0
;;
(*:mush:*)
if compset -P %; then
mbox_short=( "${(@k)userdirs}" )
elif compset -P +; then
mbox_names=( "${(@)_mbox_cache#$~maildirectory/}" )
else
mbox_names=( +"${(@)^_mbox_cache#$~maildirectory/}"
"${_mailbox_cache[@]}" )
mbox_short=( \& % %"${(@k)^userdirs}" )
fi
;;
(*:mutt:*)
mbox_names=( "${_mutt_cache[@]}" "${_mailbox_cache[@]}"
"${_maildir_cache[@]}" )
mbox_short=( \! \< \> );;
(*:pine:*)
# Pine is like mail but with no leading `+' to disambiguate;
# any files not in $pinedirectory must be absolute paths.
mbox_names=( "${(@)_pine_cache#$~pinedirectory/}" "${_mbox_cache[@]}"
"${_mailbox_cache[@]}" "${_mh_cache[@]}" )
;;
(*:tkrat:*) # Has a couple of custom formats I haven't programmed for.
mbox_names=( "${_mbox_cache[@]}"
"${_mailbox_cache[@]}" "${_mh_cache[@]}" )
;;
(*:(zmail|zmlite):*)
if compset -P %; then
mbox_short=( "${(@k)userdirs}" )
elif compset -P +; then
mbox_names=( "${(@)_mbox_cache#$~maildirectory/}" )
else
mbox_names=( +"${(@)^_mbox_cache#$~maildirectory/}"
"${_mailbox_cache[@]}" "${_mh_cache[@]}" )
mbox_short=( \& % %"${(@k)^userdirs}" )
fi
;;
(*) # Some other program wants mailbox names? Use them all?
mbox_names=( "${_mailbox_cache[@]}" "${_mbox_cache[@]}"
"${_mh_cache[@]}" "${_mutt_cache[@]}" "${_pine_cache[@]}" )
;;
esac
(( $#mbox_names )) && _multi_parts "$@" / mbox_names && ret=0
(( $#mbox_short )) && compadd "$@" -a mbox_short && ret=0
return ret
}
[[ -o kshautoload ]] || _mailboxes "$@"

View file

@ -42,7 +42,7 @@ else
FS=: $file)
)
fi
_wanted targets expl 'make target' compadd "$tmp[@]" && return 0
_wanted targets expl 'make target' compadd -a tmp && return 0
fi
compset -P 1 '*='
_files

View file

@ -540,7 +540,7 @@ fstype)
compset -P '*,'
_wanted types expl 'file system type' \
compadd -qS, -M 'L:|no=' - "$fss[@]" && ret=0
compadd -qS, -M 'L:|no=' -a fss && ret=0
;;
fsopt)
_tags options || return 1
@ -569,8 +569,8 @@ udevordir)
mp_tmp=( "${(@)${(@)tmp#* }%% *}" )
_alternative \
'devices:device:compadd - $dev_tmp[@]' \
'directories:mount point:compadd - $mp_tmp[@]' && ret=0
'devices:device:compadd -a dev_tmp' \
'directories:mount point:compadd -a mp_tmp' && ret=0
fi
;;
esac

View file

@ -64,7 +64,7 @@ _mysql_databases () {
)
shift _mysql_databases
compadd "$expl[@]" - $_mysql_databases
compadd "$expl[@]" -a _mysql_databases
}
_mysql_tables () {
@ -79,7 +79,7 @@ _mysql_tables () {
# remove header
shift _mysql_tables
compadd "$expl[@]" - $_mysql_tables
compadd "$expl[@]" -a _mysql_tables
}
_mysql_variables () {
@ -205,7 +205,7 @@ _mysqladmin_commands () {
)
if (( CURRENT == 1 )); then
_wanted commands expl command compadd "$@" - $cmds
_wanted commands expl command compadd "$@" -a cmds
else
local curcontext="$curcontext"

View file

@ -62,8 +62,8 @@ if [[ "$state" = "remote" ]]; then
*)
compset -S '(|\\)\(*' || suf="${${QIPREFIX:+(}:-\(}"
_wanted commands expl 'remote commands' \
compadd -qS "$suf" -M 'm:{a-zA-Z}={A-Za-z}' - \
$remote_commands && ret=0
compadd -qS "$suf" -M 'm:{a-zA-Z}={A-Za-z}' -a \
remote_commands && ret=0
;;
esac
fi

View file

@ -59,7 +59,7 @@ _perl_config_vars () {
(( compstate[quoting] )) && delimiter=' '
compset -P '* ' && compset -q
compadd "$expl[@]" $add_colon -S$delimiter -q - $_perl_config_vars
compadd "$expl[@]" $add_colon -S$delimiter -q -a _perl_config_vars
}
_perl "$@"

View file

@ -29,4 +29,4 @@ fi
local expl
_wanted pods expl 'Perl base pods' compadd - $_perl_basepods
_wanted pods expl 'Perl base pods' compadd -a _perl_basepods

View file

@ -12,13 +12,13 @@ if [[ ${+_perl_builtin_funcs} -eq 0 ]]; then
typeset -agU _perl_builtin_funcs
local perlfunc
if perlfunc=`man -w perlfunc 2>&1`; then
if [[ -n "${perlfunc:=$(man -w perlfunc 2>/dev/null; print -l ${^manpath}/man1/perlfunc.1(N) {/usr/man,/usr/local/man}/man1/perlfunc.1(N))}" ]]; then
_perl_builtin_funcs=( `perl -lne '
$in_funcs++, next if /Alphabetical/; \
next unless $in_funcs; \
if (/^\.Ip "(\w+)/) { \
print $1 unless $func{$1}; $func{$1}++ \
}' $perlfunc`
}' $=perlfunc`
)
else
echo "Couldn't find perlfunc man page; giving up."
@ -26,4 +26,6 @@ if [[ ${+_perl_builtin_funcs} -eq 0 ]]; then
fi
fi
compadd - $_perl_builtin_funcs
local expl
_wanted functions expl 'Perl built-in functions' compadd -a _perl_builtin_funcs

View file

@ -62,4 +62,4 @@ fi
local expl
_wanted modules expl 'Perl modules' compadd "$opts[@]" - $_perl_modules
_wanted modules expl 'Perl modules' compadd "$opts[@]" -a _perl_modules

View file

@ -1,8 +1,12 @@
#autoload
local expl
local expl ports
: ${(A)ports:=${${(M)${${(f)"$(</etc/services)"}:#\#*}#*/tcp}%%[ ]*}}
if ! zstyle -a ":completion:${curcontext}:" ports ports; then
(( $+_cache_ports )) ||
: ${(A)_cache_ports:=${${(M)${${(f)"$(</etc/services)"}:#\#*}#*/tcp}%%[ ]*}}
_description expl port
compadd "$@" "$expl[@]" - "$ports[@]"
ports=( "$_cache_ports[@]" )
fi
_wanted ports expl port compadd "$@" -a ports

View file

@ -8,5 +8,5 @@ if [[ $compstate[nmatches] -eq nm && -d RCS && $cmd != ci ]]; then
local rep expl
rep=(RCS/$PREFIX*$SUFFIX,v(:t:s/\,v//))
(( $#rep )) && _wanted files expl 'RCS file' compadd - $rep
(( $#rep )) && _wanted files expl 'RCS file' compadd -a rep
fi

View file

@ -124,7 +124,7 @@ if ! compset -P '(#b)([^/]#)/'; then
compset -S '/*' || suf="/"
(( $#uhosts )) || _hosts -S "$suf" "$expl[@]" && ret=0
[[ "$scheme" = http ]] && uhosts=($uhosts $localhttp_servername)
compadd -S "$suf" "$expl[@]" - $uhosts && ret=0
compadd -S "$suf" "$expl[@]" -a uhosts && ret=0
done
(( ret )) || return 0
done

View file

@ -3,6 +3,6 @@
local expl users
zstyle -a ":completion:${curcontext}:" users users &&
_wanted users expl user compadd "$@" - "$users[@]" && return 0
_wanted users expl user compadd "$@" -a users && return 0
_wanted users expl user compadd "$@" - "${(@k)userdirs}"
_wanted users expl user compadd "$@" -k userdirs

View file

@ -96,10 +96,10 @@ if [[ "$state" = map* ]]; then
while _tags; do
# The `-M ...' allows `pa.n<TAB>' to complete to `passwd.byname'.
_requested maps expl 'map name' \
compadd -M 'l:.|by=by l:.|=by r:|.=* r:|=*' - \
"$_yp_cache_maps[@]" && ret=0
compadd -M 'l:.|by=by l:.|=by r:|.=* r:|=*' -a \
_yp_cache_maps && ret=0
_requested nicknames expl nicknames \
compadd - "$_yp_cache_nicks[@]" && ret=0
compadd -a _yp_cache_nicks && ret=0
(( ret )) || return 0
done
elif [[ "$state" = servers ]]; then

View file

@ -31,5 +31,5 @@ if (( ! $+_color_cache )); then
fi
_wanted colors expl 'color specification' \
compadd "$@" -M 'm:{a-z}={A-Z} m:-=\ r:[^ A-Z0-9]||[ A-Z0-9]=* r:|=*' - \
"$_color_cache[@]"
compadd "$@" -M 'm:{a-z}={A-Z} m:-=\ r:[^ A-Z0-9]||[ A-Z0-9]=* r:|=*' -a \
_color_cache

View file

@ -14,5 +14,5 @@ if (( ! $+_cursor_cache )); then
fi
fi
_description expl 'cursor name'
compadd "$@" "$expl[@]" -M 'm:-=_ r:|_=*' - "$_cursor_cache[@]"
_wanted cursors expl 'cursor name' \
compadd "$@" -M 'm:-=_ r:|_=*' -a _cursor_cache

View file

@ -15,5 +15,5 @@ else
[[ "$1" = - ]] && shift
_wanted extensions expl 'X extensions' \
compadd "$@" -M 'm:{a-z}={A-Z} r:|-=* r:|=*' - "$_xe_cache[@]"
compadd "$@" -M 'm:{a-z}={A-Z} r:|-=* r:|=*' - _xe_cache
fi

View file

@ -13,4 +13,4 @@ if (( ! $+_font_cache )); then
fi
_wanted fonts expl font \
compadd -M 'r:|-=* r:|=*' "$@" -S '' - "$_font_cache[@]"
compadd -M 'r:|-=* r:|=*' "$@" -S '' -a _font_cache

View file

@ -19,4 +19,4 @@ if (( ! $+_keysym_cache )); then
fi
_wanted keysyms expl 'key symbol' \
compadd "$@" -M 'm:{a-z}={A-Z} r:|-=* r:|=*' - $_keysym_cache
compadd "$@" -M 'm:{a-z}={A-Z} r:|-=* r:|=*' -a _keysym_cache

View file

@ -73,7 +73,7 @@ xhost)
_tags displays
while _tags; do
while _next_label displays expl 'disallow access'; do
{ compadd "$expl[@]" -M 'm:{a-z}={A-Z} r:|[:.]=* r:|=*' - $tmp ||
{ compadd "$expl[@]" -M 'm:{a-z}={A-Z} r:|[:.]=* r:|=*' -a tmp ||
_hosts "$expl[@]" } && ret=0
done
(( ret )) || return 0