Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Zsh completion configuration LISTMAX



Bart wrote:
> If you actually want to eliminate some of the possible matches so that
> the list itself is shorter, you either need to reduce the number of
> words passed to compadd [difficult in general but possibly doable in
> a custom function like the _history_or_autocd example] or play with the
> tag-order / group-order styles to limit the sets of matches displayed.
> 
> Others may have additional suggestions ...

There is also the hidden style which prevents certain matches from
appearing in the list. So for example, you might do the following to not
list usernames after ssh (but still complete them).
  zstyle ':completion:*:ssh:*:users' hidden true

The style corresponds to compadd's -n option.

The nearest I can quickly get to limiting matches would be something
like:
  zstyle -e ':completion:*' hidden '(( compstate[nmatches] > 10 )) && reply=( true )'
That will not result in a maximum of 10 matches being listed, however
because the style is checked for groups of matches not individual ones.
It also doesn't discern between matches by their length.

It's probably better to combine the hidden style with tag-order and
ignored-patterns.

Oliver



Messages sorted by: Reverse Date, Date, Thread, Author