zsh-users
 help / color / mirror / code / Atom feed
* Zsh completion configuration LISTMAX
@ 2013-02-26  8:20 joe M
  2013-02-26 17:22 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: joe M @ 2013-02-26  8:20 UTC (permalink / raw)
  To: zsh-users, zsh-workers

Hello,

I am trying to figure out how to limit the number of entries shown in
a list by the completer. I exported LISTMAX=50 and I can see it in the
shell with "echo $LISTMAX".

But, for some reason, the lists are a lot bigger than that.

Any suggestions on what else I can do?

Thanks
Joe


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Zsh completion configuration LISTMAX
  2013-02-26  8:20 Zsh completion configuration LISTMAX joe M
@ 2013-02-26 17:22 ` Bart Schaefer
  2013-02-26 18:10   ` Oliver Kiddle
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2013-02-26 17:22 UTC (permalink / raw)
  To: zsh-users

On Feb 26,  3:20am, joe M wrote:
}
} I am trying to figure out how to limit the number of entries shown in
} a list by the completer. I exported LISTMAX=50 and I can see it in the
} shell with "echo $LISTMAX".
} 
} But, for some reason, the lists are a lot bigger than that.

All that LISTMAX controls is whether zsh asks something like

zsh: do you wish to see all 2673 possibilities (1272 lines)? 

before it displays the listing.  It has nothing to do with the size of
the list once it is displayed, and if you have menu-selection enabled
(so that the list can be scrolled/navigated) then LISTMAX is ignored.

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 ...


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Zsh completion configuration LISTMAX
  2013-02-26 17:22 ` Bart Schaefer
@ 2013-02-26 18:10   ` Oliver Kiddle
  0 siblings, 0 replies; 3+ messages in thread
From: Oliver Kiddle @ 2013-02-26 18:10 UTC (permalink / raw)
  To: zsh-users; +Cc: joe M

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-02-26 18:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-26  8:20 Zsh completion configuration LISTMAX joe M
2013-02-26 17:22 ` Bart Schaefer
2013-02-26 18:10   ` Oliver Kiddle

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).