about summary refs log tree commit diff
path: root/Completion/Zsh/Context/_in_vared
blob: abd24dd95fd1ddbb8ca95aef129b652851f3d17f (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
28
29
30
31
32
33
34
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"