mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-11-19 21:44:11 +01:00
moved from Completion/Base/_in_vared
This commit is contained in:
parent
1bb11adee9
commit
a0ad55d34f
35
Completion/Zsh/Context/_in_vared
Normal file
35
Completion/Zsh/Context/_in_vared
Normal file
@ -0,0 +1,35 @@
|
||||
#compdef -vared-
|
||||
|
||||
local also
|
||||
|
||||
# Completion inside vared.
|
||||
|
||||
if [[ $compstate[vared] = *\[* ]]; then
|
||||
if [[ $compstate[vared] = *\]* ]]; then
|
||||
# vared on an array-element
|
||||
compstate[parameter]=${${compstate[vared]%%\]*}//\[/-}
|
||||
compstate[context]=value
|
||||
also=-value-
|
||||
else
|
||||
# vared on an array-value
|
||||
compstate[parameter]=${compstate[vared]%%\[*}
|
||||
compstate[context]=value
|
||||
also=-value-
|
||||
fi
|
||||
else
|
||||
# vared on a parameter, let's see if it is an array
|
||||
compstate[parameter]=$compstate[vared]
|
||||
if [[ ${(tP)compstate[vared]} = *(array|assoc)* ]]; then
|
||||
compstate[context]=array_value
|
||||
also=-array-value-
|
||||
else
|
||||
compstate[context]=value
|
||||
also=-value-
|
||||
fi
|
||||
fi
|
||||
|
||||
# Don't insert TAB in first column. Never.
|
||||
|
||||
compstate[insert]="${compstate[insert]//tab /}"
|
||||
|
||||
_contexts "$also"
|
Loading…
Reference in New Issue
Block a user