diff options
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/Zsh/compsys.yo | 29 | ||||
-rw-r--r-- | Doc/Zsh/compwid.yo | 7 |
2 files changed, 34 insertions, 2 deletions
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index 67d75bf3f..18eb388a8 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -386,6 +386,22 @@ ifnzman(noderef(The zsh/zutil Module))). When looking up styles the completion system uses full context names, including the tag. +To have more control over when certain values for styles are used one +can use the special parameters available in completion widgets (see +ifzman(see zmanref(zshcompwid))\ +ifnzman(noderef(Completion Widgets)))\ +) and the tt(-e) option to tt(zstyle) that makes the value be +evaluated when looked up. For example, to make the tt(completer) +style have a different value when completion for the tt(cvs) command, +one could use the tt(words) special array: + +example(zstyle -e ':completion:*' completer ' + if [[ $words[1] = cvs ]]; then + reply=(_complete) + else + reply=(_complete _approximate) + fi') + Styles determine such things as how the matches are generated; some of them correspond to shell options (for example, the use of menu completion), but styles provide more specific control. They can have any number of strings as @@ -1732,6 +1748,19 @@ is any, and if it is different from the word on the line. ) enditem() ) +kindex(range, completion style) +item(tt(range))( +This is used by the tt(_history) completer and the +tt(_history_complete_word) bindable command to decide which words +should be completed. It may be set to a number, var(N), to say that +only the last var(N) words from the history should be completed. The +value may also be of the form `var(max)tt(:)var(slice)'. This means +that first the last var(slice) words will be completed. If that +yields no matches, the var(slice) words before those will be tried and +so on, until either at least one match is generated or var(max) words +have been tried. The default is to complete all words from the +history at once. +) kindex(remove-all-dups, completion style) item(tt(remove-all-dups))( The tt(_history_complete_word) bindable command and the tt(_history) diff --git a/Doc/Zsh/compwid.yo b/Doc/Zsh/compwid.yo index b63889573..8c86eef3c 100644 --- a/Doc/Zsh/compwid.yo +++ b/Doc/Zsh/compwid.yo @@ -485,11 +485,14 @@ Like tt(-i), but gives an ignored suffix. ) item(tt(-a))( With this flag the var(words) are taken as names of arrays and the -possible matches are their values. +possible matches are their values. If only some elements of the +arrays are needed, the var(words) may also contain subscripts, as in +`tt(foo[2,-1])'. ) item(tt(-k))( With this flag the var(words) are taken as names of associative arrays -and the possible matches are their keys. +and the possible matches are their keys. As for tt(-a), the +var(words) may also contain subscripts, as in `tt(foo[(R)*bar*])'. ) item(tt(-d) var(array))( This adds per-match display strings. The var(array) should contain one |