diff options
author | Oliver Kiddle <opk@users.sourceforge.net> | 2001-05-04 23:00:18 +0000 |
---|---|---|
committer | Oliver Kiddle <opk@users.sourceforge.net> | 2001-05-04 23:00:18 +0000 |
commit | 080155607ede1e392a8aaab446b1b345b54e492f (patch) | |
tree | aba88827ba1b8f6980dff704cc2c507d8de2ae96 /Completion/Zsh | |
parent | f8f6c27650f6469ee8b1427c733f0967b94159d9 (diff) | |
download | zsh-080155607ede1e392a8aaab446b1b345b54e492f.tar.gz zsh-080155607ede1e392a8aaab446b1b345b54e492f.tar.xz zsh-080155607ede1e392a8aaab446b1b345b54e492f.zip |
complete subscript flags (14227)
Diffstat (limited to 'Completion/Zsh')
-rw-r--r-- | Completion/Zsh/Context/_subscript | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/Completion/Zsh/Context/_subscript b/Completion/Zsh/Context/_subscript index 8e1449357..c5e80d0ea 100644 --- a/Completion/Zsh/Context/_subscript +++ b/Completion/Zsh/Context/_subscript @@ -1,6 +1,6 @@ #compdef -subscript- -local expl ind osuf=']' +local expl ind osuf=']' flags if [[ "$1" = -q ]]; then osuf='] ' @@ -8,10 +8,39 @@ if [[ "$1" = -q ]]; then shift fi +compset -P '\([^\)]##\)' # remove subscript flags + if [[ "$PREFIX" = :* ]]; then _wanted characters expl 'character class' \ compadd -p: -S ':]' alnum alpha blank cntrl digit graph \ lower print punct space upper xdigit +elif compset -P '\('; then + compset -S '\)*' + + case ${(Pt)${compstate[parameter]}} in + assoc*) flags=( + '(R k K i I)r[return first matching value]' + '(r k K i I)R[return value of first matching key]' + '(r R K i I)k[return all values with matching keys]' + '(r R k i I)K[return value of first matching key]' + '(r R k K I)i[return first matching key]' + '(r R k K i)I[return all matching keys]' + );; + (|scalar*)) flags=( + 'w[make subscripting work on words of scalar]' + 's[specify word separator]' + 'p[recognise escape sequences in subsequent s flag]' + );& + array*) flags=($flags + 'n[specify match to return]' + 'b[begin with specified element]' + '(r R k K i)I[reverse subscript giving index of last match]' + '(r k K i I)R[reverse subscripting giving last match]' + '(R k K i I)r[reverse subscripting giving first match]' + );; + esac + + _values -s '' 'subscript flags' $flags elif [[ ${(Pt)${compstate[parameter]}} = assoc* ]]; then local suf |