From 9867c4091e71e6ed69889a9bfaee07275d2fa04e Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Thu, 19 Aug 1999 11:18:05 +0000 Subject: manual/7448 --- Completion/Base/_subscript | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'Completion/Base/_subscript') diff --git a/Completion/Base/_subscript b/Completion/Base/_subscript index be5f08f62..090a5f07a 100644 --- a/Completion/Base/_subscript +++ b/Completion/Base/_subscript @@ -1,17 +1,22 @@ #compdef -subscript- +local expl + if [[ "$PREFIX" = :* ]]; then + _description expl 'character class' compadd -p: -S ':]' alnum alpha blank cntrl digit graph lower print punct \ space upper xdigit elif [[ ${(Pt)${compstate[parameter]}} = assoc* ]]; then + _description expl 'association key' if [[ "$RBUFFER" = \]* ]]; then - compadd -S '' - "${(@kP)${compstate[parameter]}}" + compadd "$expl[@]" -S '' - "${(@kP)${compstate[parameter]}}" else - compadd -S ']' - "${(@kP)${compstate[parameter]}}" + compadd "$expl[@]" -S ']' - "${(@kP)${compstate[parameter]}}" fi elif [[ ${(Pt)${compstate[parameter]}} = array* ]]; then local list i j + _description expl 'array index' ind=( {1..${#${(P)${compstate[parameter]}}}} ) list=() for i in "$ind[@]"; do @@ -21,9 +26,9 @@ elif [[ ${(Pt)${compstate[parameter]}} = array* ]]; then done if [[ "$RBUFFER" = \]* ]]; then - compadd -S '' -V default -y list - "$ind[@]" + compadd "$expl[@]" -S '' -V default -y list - "$ind[@]" else - compadd -S ']' -V default -y list - "$ind[@]" + compadd "$expl[@]" -S ']' -V default -y list - "$ind[@]" fi else _compalso -math- -- cgit 1.4.1