mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-11-20 05:53:52 +01:00
56 lines
1.2 KiB
Plaintext
56 lines
1.2 KiB
Plaintext
#compdef -value- -array-value-
|
|
|
|
_value () {
|
|
# You can customize completion for different parameters by writing a
|
|
# function `_value:<name>'.
|
|
|
|
if (( $+functions[_value:$compstate[parameter]] )); then
|
|
"_value:$compstate[parameter]" "$@"
|
|
elif [[ "$compstate[parameter]" != *-* &&
|
|
"${(Pt)${compstate[parameter]}}" = assoc* ]]; then
|
|
if (( CURRENT & 1 )); then
|
|
_wanted association-keys expl 'association key' \
|
|
compadd - "${(@kP)${compstate[parameter]}}"
|
|
else
|
|
compstate[parameter]="${compstate[parameter]}-${words[CURRENT-1]}"
|
|
_value "$@"
|
|
fi
|
|
else
|
|
local pats
|
|
|
|
if { zstyle -a ":completion:${curcontext}:" assign-list pats &&
|
|
[[ "$compstate[parameter]" = (${(j:|:)~pats}) ]] } ||
|
|
[[ "$PREFIX$SUFFIX" = *:* ]]; then
|
|
compset -P '*:'
|
|
compset -S ':*'
|
|
_default -r '\-\n\t /:' "$@"
|
|
else
|
|
_default "$@"
|
|
fi
|
|
fi
|
|
}
|
|
|
|
_value:CPPFLAGS () {
|
|
compset -q
|
|
if compset -P '-I'; then
|
|
_files -/ "$@"
|
|
else
|
|
_default "$@"
|
|
fi
|
|
}
|
|
|
|
_value:LDFLAGS () {
|
|
compset -q
|
|
if compset -P '-L'; then
|
|
_files -/ "$@"
|
|
elif compset -P '-R'; then
|
|
compset -P '*:'
|
|
compset -S ':*'
|
|
_files -/ -S/ -r '\n\t\- /:' "$@"
|
|
else
|
|
_default "$@"
|
|
fi
|
|
}
|
|
|
|
_value "$@"
|