zsh-users
 help / color / Atom feed
* menu completion
@ 2020-04-05 12:00 Pier Paolo Grassi
  2020-04-05 16:48 ` Dave Woodfall
  2020-04-05 19:29 ` Mikael Magnusson
  0 siblings, 2 replies; 14+ messages in thread
From: Pier Paolo Grassi @ 2020-04-05 12:00 UTC (permalink / raw)
  To: Zsh-Users List


[-- Attachment #1: Type: text/plain, Size: 268 bytes --]

Hello, when trying to complete with interactive menu completion some
command with many options, eg grep, I get a message like
zsh: do you wish to see all 156 possibilities (41 lines)?
is it possibile to disable it and just see the interactive menu?

Pier Paolo Grassi

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

* Re: menu completion
  2020-04-05 12:00 menu completion Pier Paolo Grassi
@ 2020-04-05 16:48 ` Dave Woodfall
  2020-04-05 19:29 ` Mikael Magnusson
  1 sibling, 0 replies; 14+ messages in thread
From: Dave Woodfall @ 2020-04-05 16:48 UTC (permalink / raw)
  To: zsh-users

On 2020-04-05 14:00,
Pier Paolo Grassi <pierpaolog@gmail.com> put forth the proposition:
> Hello, when trying to complete with interactive menu completion some
> command with many options, eg grep, I get a message like
> zsh: do you wish to see all 156 possibilities (41 lines)?
> is it possibile to disable it and just see the interactive menu?
>
> Pier Paolo Grassi

If you use the zstyle `menu' set to `select' it should do this:

zstyle ':completion:*' menu select

There are more settings listed in man zshcompsys:

man zshcompsys | less -p "^       menu"

--
Dave

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

* Re: menu completion
  2020-04-05 12:00 menu completion Pier Paolo Grassi
  2020-04-05 16:48 ` Dave Woodfall
@ 2020-04-05 19:29 ` Mikael Magnusson
  2020-04-06  2:18   ` Pier Paolo Grassi
  1 sibling, 1 reply; 14+ messages in thread
From: Mikael Magnusson @ 2020-04-05 19:29 UTC (permalink / raw)
  To: Pier Paolo Grassi; +Cc: Zsh-Users List

On 4/5/20, Pier Paolo Grassi <pierpaolog@gmail.com> wrote:
> Hello, when trying to complete with interactive menu completion some
> command with many options, eg grep, I get a message like
> zsh: do you wish to see all 156 possibilities (41 lines)?
> is it possibile to disable it and just see the interactive menu?

You can set LISTMAX=100000 or so to increase the default limit (which
is 100, I think). There is some other way to disable it too, because I
don't get the prompt and haven't set LISTMAX, but I'm not sure how I
did it :).

-- 
Mikael Magnusson

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

* Re: menu completion
  2020-04-05 19:29 ` Mikael Magnusson
@ 2020-04-06  2:18   ` Pier Paolo Grassi
  2020-05-07 18:55     ` Jun. T
  0 siblings, 1 reply; 14+ messages in thread
From: Pier Paolo Grassi @ 2020-04-06  2:18 UTC (permalink / raw)
  To: Mikael Magnusson; +Cc: Zsh-Users List


[-- Attachment #1: Type: text/plain, Size: 1470 bytes --]

thanks for the advices
I found that setting LISTMAX=100000 doesn't get me the interactive menu
completion, just the (normal?) menu completion without the "do you wish to
see" question
what I mean is (sorry if I am not using the correct terminology)
grep -<tab>
shows a list of options, but does not allow me to move through the options
with the arrows
if I do

compdef _gnu_generic grep

grep -<tab> gives me a menu like I want

in my .zshrc I have

zstyle ':completion:*' menu select=2

and nothing more specific to disable it just for grep
if I don't redefine the completer with compdef the default completer for
grep is _grep
so, is it possibile that the issue is that _grep doesn't do interactive
menu completion? is this something demanded to the completer to decide?

Pier Paolo Grassi



Il giorno dom 5 apr 2020 alle ore 21:29 Mikael Magnusson <mikachu@gmail.com>
ha scritto:

> On 4/5/20, Pier Paolo Grassi <pierpaolog@gmail.com> wrote:
> > Hello, when trying to complete with interactive menu completion some
> > command with many options, eg grep, I get a message like
> > zsh: do you wish to see all 156 possibilities (41 lines)?
> > is it possibile to disable it and just see the interactive menu?
>
> You can set LISTMAX=100000 or so to increase the default limit (which
> is 100, I think). There is some other way to disable it too, because I
> don't get the prompt and haven't set LISTMAX, but I'm not sure how I
> did it :).
>
> --
> Mikael Magnusson
>

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

* Re: menu completion
  2020-04-06  2:18   ` Pier Paolo Grassi
@ 2020-05-07 18:55     ` Jun. T
  2020-05-09 18:23       ` Pier Paolo Grassi
  0 siblings, 1 reply; 14+ messages in thread
From: Jun. T @ 2020-05-07 18:55 UTC (permalink / raw)
  To: zsh-users; +Cc: Pier Paolo Grassi

Sorry for a slow reply:

> 2020/04/06 11:18, Pier Paolo Grassi <pierpaolog@gmail.com> wrote:

> in my .zshrc I have
> 
> zstyle ':completion:*' menu select=2

Try the following instead:

zstyle ':completion:*' menu on select=2


Description of the 'menu' style in zshcompsys(1) may suggest that
only select=2 is sufficient, but it seems 'on' is also required.

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

* Re: menu completion
  2020-05-07 18:55     ` Jun. T
@ 2020-05-09 18:23       ` Pier Paolo Grassi
  2020-05-12  0:39         ` Jun T
  0 siblings, 1 reply; 14+ messages in thread
From: Pier Paolo Grassi @ 2020-05-09 18:23 UTC (permalink / raw)
  To: Jun. T; +Cc: Zsh-Users List


[-- Attachment #1: Type: text/plain, Size: 675 bytes --]

thanks, but it didn't make any difference
best regards

Pier Paolo Grassi
linkedin: https://www.linkedin.com/in/pier-paolo-grassi-19300217
founder: https://www.meetup.com/it-IT/Machine-Learning-TO


Il giorno gio 7 mag 2020 alle ore 20:55 Jun. T <takimoto-j@kba.biglobe.ne.jp>
ha scritto:

> Sorry for a slow reply:
>
> > 2020/04/06 11:18, Pier Paolo Grassi <pierpaolog@gmail.com> wrote:
>
> > in my .zshrc I have
> >
> > zstyle ':completion:*' menu select=2
>
> Try the following instead:
>
> zstyle ':completion:*' menu on select=2
>
>
> Description of the 'menu' style in zshcompsys(1) may suggest that
> only select=2 is sufficient, but it seems 'on' is also required.
>

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

* Re: menu completion
  2020-05-09 18:23       ` Pier Paolo Grassi
@ 2020-05-12  0:39         ` Jun T
  2020-05-20 18:16           ` Pier Paolo Grassi
  0 siblings, 1 reply; 14+ messages in thread
From: Jun T @ 2020-05-12  0:39 UTC (permalink / raw)
  To: zsh-users; +Cc: Pier Paolo Grassi


> 2020/05/10 3:23, Pier Paolo Grassi <pierpaolog@gmail.com> wrote:
> 
> thanks, but it didn't make any difference

Please try:

zsh -f
zmodload zsh/complist
autoload -Uz compinit
compinit
zstyle ':completion:*' menu on select=2
grep -<TAB>




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

* Re: menu completion
  2020-05-12  0:39         ` Jun T
@ 2020-05-20 18:16           ` Pier Paolo Grassi
  2020-05-22 15:34             ` Jun. T
  0 siblings, 1 reply; 14+ messages in thread
From: Pier Paolo Grassi @ 2020-05-20 18:16 UTC (permalink / raw)
  To: Jun T; +Cc: Zsh-Users List


[-- Attachment #1: Type: text/plain, Size: 738 bytes --]

sorry for the delay.
that didn't change anything, no interactive menu completion is offered,
just the prompt:
zsh: do you wish to see all 164 possibilities (41 lines)?

and then tabbing again the list of possible options is printed

Pier Paolo Grassi
linkedin: https://www.linkedin.com/in/pier-paolo-grassi-19300217
founder: https://www.meetup.com/it-IT/Machine-Learning-TO


Il giorno mar 12 mag 2020 alle ore 02:39 Jun T <takimoto-j@kba.biglobe.ne.jp>
ha scritto:

>
> > 2020/05/10 3:23, Pier Paolo Grassi <pierpaolog@gmail.com> wrote:
> >
> > thanks, but it didn't make any difference
>
> Please try:
>
> zsh -f
> zmodload zsh/complist
> autoload -Uz compinit
> compinit
> zstyle ':completion:*' menu on select=2
> grep -<TAB>
>
>
>
>

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

* Re: menu completion
  2020-05-20 18:16           ` Pier Paolo Grassi
@ 2020-05-22 15:34             ` Jun. T
  2020-05-22 16:12               ` Pier Paolo Grassi
  0 siblings, 1 reply; 14+ messages in thread
From: Jun. T @ 2020-05-22 15:34 UTC (permalink / raw)
  To: zsh-users; +Cc: Pier Paolo Grassi


> 2020/05/21 3:16, Pier Paolo Grassi <pierpaolog@gmail.com> wrote:
> 
> that didn't change anything, no interactive menu completion is offered,
> just the prompt:
> zsh: do you wish to see all 164 possibilities (41 lines)?

I can't reproduce your problem.
Which version of zsh and operating system are you using?


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

* Re: menu completion
  2020-05-22 15:34             ` Jun. T
@ 2020-05-22 16:12               ` Pier Paolo Grassi
  2020-05-22 18:36                 ` Jun. T
  0 siblings, 1 reply; 14+ messages in thread
From: Pier Paolo Grassi @ 2020-05-22 16:12 UTC (permalink / raw)
  To: Jun. T; +Cc: Zsh-Users List


[-- Attachment #1: Type: text/plain, Size: 721 bytes --]

cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.6 LTS"

echo $ZSH_VERSION
5.1.1

Pier Paolo Grassi
linkedin: https://www.linkedin.com/in/pier-paolo-grassi-19300217
founder: https://www.meetup.com/it-IT/Machine-Learning-TO


Il giorno ven 22 mag 2020 alle ore 17:34 Jun. T <
takimoto-j@kba.biglobe.ne.jp> ha scritto:

>
> > 2020/05/21 3:16, Pier Paolo Grassi <pierpaolog@gmail.com> wrote:
> >
> > that didn't change anything, no interactive menu completion is offered,
> > just the prompt:
> > zsh: do you wish to see all 164 possibilities (41 lines)?
>
> I can't reproduce your problem.
> Which version of zsh and operating system are you using?
>
>

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

* Re: menu completion
  2020-05-22 16:12               ` Pier Paolo Grassi
@ 2020-05-22 18:36                 ` Jun. T
  2020-05-23 10:51                   ` Pier Paolo Grassi
  0 siblings, 1 reply; 14+ messages in thread
From: Jun. T @ 2020-05-22 18:36 UTC (permalink / raw)
  To: zsh-users; +Cc: Pier Paolo Grassi


> 2020/05/23 1:12, Pier Paolo Grassi <pierpaolog@gmail.com> wrote:
> 
> echo $ZSH_VERSION
> 5.1.1

I think the problem is in _grep in that old version of zsh.

You can either
(1) upgrade zsh (probably zsh-5.4 or later works), or

(2) download the latest zsh tarball, extract Completion/Unix/Command/_grep
and use it, or

(3) copy /usr/share/zsh/5.1.1/functions/_grep and modify the following line
(around line 13)
    '(-e --regexp -f --file)1: :_guard "^--*" pattern'
to
    '(-e --regexp -f --file)1: :_guard "^-*" pattern'
and use it.

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

* Re: menu completion
  2020-05-22 18:36                 ` Jun. T
@ 2020-05-23 10:51                   ` Pier Paolo Grassi
  2020-05-23 19:21                     ` Bart Schaefer
  0 siblings, 1 reply; 14+ messages in thread
From: Pier Paolo Grassi @ 2020-05-23 10:51 UTC (permalink / raw)
  To: Jun. T; +Cc: Zsh-Users List


[-- Attachment #1: Type: text/plain, Size: 1100 bytes --]

Hello, thanks for your message. Since I am happy with the solution of
using _gnu_generic for grep completion my interest is mostly for the
mechanics of the problem.
Basically I wonder if it is up to the completer to choose whether to do
interactive menu completion, any thoughts on this?

Pier Paolo Grassi
linkedin: https://www.linkedin.com/in/pier-paolo-grassi-19300217
founder: https://www.meetup.com/it-IT/Machine-Learning-TO


Il giorno ven 22 mag 2020 alle ore 20:36 Jun. T <
takimoto-j@kba.biglobe.ne.jp> ha scritto:

>
> > 2020/05/23 1:12, Pier Paolo Grassi <pierpaolog@gmail.com> wrote:
> >
> > echo $ZSH_VERSION
> > 5.1.1
>
> I think the problem is in _grep in that old version of zsh.
>
> You can either
> (1) upgrade zsh (probably zsh-5.4 or later works), or
>
> (2) download the latest zsh tarball, extract Completion/Unix/Command/_grep
> and use it, or
>
> (3) copy /usr/share/zsh/5.1.1/functions/_grep and modify the following line
> (around line 13)
>     '(-e --regexp -f --file)1: :_guard "^--*" pattern'
> to
>     '(-e --regexp -f --file)1: :_guard "^-*" pattern'
> and use it.
>

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

* Re: menu completion
  2020-05-23 10:51                   ` Pier Paolo Grassi
@ 2020-05-23 19:21                     ` Bart Schaefer
  2020-05-23 19:40                       ` Bart Schaefer
  0 siblings, 1 reply; 14+ messages in thread
From: Bart Schaefer @ 2020-05-23 19:21 UTC (permalink / raw)
  To: Pier Paolo Grassi; +Cc: Jun. T, Zsh-Users List

On Sat, May 23, 2020 at 3:53 AM Pier Paolo Grassi <pierpaolog@gmail.com> wrote:
>
> Basically I wonder if it is up to the completer to choose whether to do
> interactive menu completion, any thoughts on this?

That's not precisely what's happening.

The completer is deciding that you should see the message "pattern"
because the guard says there are no valid options beginning with a
single hyphen.  (Literally it means anything not beginning with two
hypens must be a pattern, and it doesn't know how to complete
patterns, but the effect is the same.)  It's the setup to display that
message that turns off the menu, because you can't both have a menu
and see the message.

But the guard is wrong -- there actually ARE some options
(non-patterns) that begin with a single hyphen.  So the completer
proceeds to add all the possible matching options, and when control
returns to the top level (_main_complete), it sees the set of
completions is not empty and therefore offers those instead of the
message.

It's possible this should be considered a problem with _message --
that is, that once _message has been called, completion should STOP
and force the message to be seen, instead of continuing to try other
possible variations.  Then instead of

zsh: do you wish to see all 156 possibilities (41 lines)?

you would see (assuming you defined the "format" zstyle) e.g.

completing pattern

(and perhaps get a beep) which is actually what was intended by the guard.

However, I suspect stopping after every _message might break other
valid use cases.

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

* Re: menu completion
  2020-05-23 19:21                     ` Bart Schaefer
@ 2020-05-23 19:40                       ` Bart Schaefer
  0 siblings, 0 replies; 14+ messages in thread
From: Bart Schaefer @ 2020-05-23 19:40 UTC (permalink / raw)
  To: Zsh-Users List

On Sat, May 23, 2020 at 12:21 PM Bart Schaefer
<schaefer@brasslantern.com> wrote:
>
> However, I suspect stopping after every _message might break other
> valid use cases.

In fact it would actually break the manual page example for _guard.

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

end of thread, back to index

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-05 12:00 menu completion Pier Paolo Grassi
2020-04-05 16:48 ` Dave Woodfall
2020-04-05 19:29 ` Mikael Magnusson
2020-04-06  2:18   ` Pier Paolo Grassi
2020-05-07 18:55     ` Jun. T
2020-05-09 18:23       ` Pier Paolo Grassi
2020-05-12  0:39         ` Jun T
2020-05-20 18:16           ` Pier Paolo Grassi
2020-05-22 15:34             ` Jun. T
2020-05-22 16:12               ` Pier Paolo Grassi
2020-05-22 18:36                 ` Jun. T
2020-05-23 10:51                   ` Pier Paolo Grassi
2020-05-23 19:21                     ` Bart Schaefer
2020-05-23 19:40                       ` Bart Schaefer

zsh-users

Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-users

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.users


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git