blob: 00b2b6506267d67c1dc79a8028c2ee691732dbbe (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#compdef -subscript-
if [[ ${(Pt)${compstate[parameter]}} = assoc* ]]; then
if [[ "$RBUFFER" = \]* ]]; then
compadd -S '' - "${(@kP)${compstate[parameter]}}"
else
compadd -S ']' - "${(@kP)${compstate[parameter]}}"
fi
elif [[ ${(Pt)${compstate[parameter]}} = array* ]]; then
local list i j
ind=( {1..${#${(P)${compstate[parameter]}}}} )
list=()
for i in "$ind[@]"; do
[[ "$i" = ${PREFIX}*${SUFFIX} ]] &&
list=( "$list[@]" "${(r:4:: ::):)i} ${(P)${compstate[parameter]}[$i]}
)
done
if [[ "$RBUFFER" = \]* ]]; then
compadd -S '' -y list - "$ind[@]"
else
compadd -S ']' -y list - "$ind[@]"
fi
else
_compalso -math-
fi
|