diff options
| author | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2000-07-26 08:16:39 +0000 |
|---|---|---|
| committer | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2000-07-26 08:16:39 +0000 |
| commit | f90992ec3170a70a65d11ed9fd2aa4c6baaec3eb (patch) | |
| tree | fab9f0f2f2b607e90c35bcf3f294f5bfd7f8448b /Completion/Base | |
| parent | use mhpath and mhparams commands instead of guessing directories (12356) (diff) | |
| download | zsh-f90992ec3170a70a65d11ed9fd2aa4c6baaec3eb.tar zsh-f90992ec3170a70a65d11ed9fd2aa4c6baaec3eb.tar.gz zsh-f90992ec3170a70a65d11ed9fd2aa4c6baaec3eb.tar.bz2 zsh-f90992ec3170a70a65d11ed9fd2aa4c6baaec3eb.tar.lz zsh-f90992ec3170a70a65d11ed9fd2aa4c6baaec3eb.tar.xz zsh-f90992ec3170a70a65d11ed9fd2aa4c6baaec3eb.tar.zst zsh-f90992ec3170a70a65d11ed9fd2aa4c6baaec3eb.zip | |
allow _value:<assoc> functions to override completion for all keys of an assoc (3337)
Diffstat (limited to 'Completion/Base')
| -rw-r--r-- | Completion/Base/_value | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Completion/Base/_value b/Completion/Base/_value index 402bab236..15218eb60 100644 --- a/Completion/Base/_value +++ b/Completion/Base/_value @@ -2,10 +2,16 @@ _value () { # You can customize completion for different parameters by writing a - # function `_value:<name>'. + # function `_value:<name>', where <name> is the name of the parameter. + # When completing values of elements of associative arrays, we first + # search for a function `_value:<assoc>-<key>' and then for + # `_value:<assoc>', so it's simple to define different functions + # for different keys or one function for a whole association. if (( $+functions[_value:$compstate[parameter]] )); then "_value:$compstate[parameter]" "$@" + elif (( $+functions[_value:${compstate[parameter]%%-*}] )); then + "_value:${compstate[parameter]%%-*}" "$@" elif [[ "$compstate[parameter]" != *-* && "${(Pt)${compstate[parameter]}}" = assoc* ]]; then if (( CURRENT & 1 )); then |
