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

zstyle question: enter menu selection on lots of ambiguity



So even after all Sven's hard work, I'm still not satisfied with the way
the menu style and long-list work together.

What I want is:

- automenu (first tab lists, second tab menu completes), except
- when the list won't fit on the screen, the first tab should
  enter menu selection immediately, but
- simply asking for a listing with C-d should never do menu-selection,
  no matter how long the list is

If I use 'select=long-list' I get menu-selection on the second tab.

If I use 'yes=long-list' I get menu completion started when I type C-d
(and some other pretty odd behavior besides, I might add).

If I use both, I get menu-selection on the second tab and on C-d, and
sometimes more of the strange behavior (the same match inserted on the
line multiple times and stuff like that -- I think it happens if you hit
C-d repeatedly after completion or selection has started when the match
on the line (highlighted, in selection) is NOT a directory).

So I hit upon this scheme:

zstyle -e ':completion:*' menu \
  '[[ $compstate[list] == ambiguous ]] && \
     compstate[list]="$compstate[list] list" reply=(select=long-list)'

This *almost* works -- if the list doesn't fill the screen, then I get a
list on the first tab and menu completion on the second, and if the list
does fill the screen then I get menu-selection on the first tab.  Yay!
BUT:  As soon as menu selection has started once this way, it starts for
ALL menu completions -- on the second tab for short lists, on the first
tab for long ones.  I don't want it to start on the second tab for short
lists.  (Actually, I want it to start on the second tab for lists longer
than 12 items, but I thought I'd work on that separately.)

I also worry about appending "list" to the value of compstate[list]; it
produces values like "ambiguous list" which doesn't *appear* to break any
other code, but ...

So what's the right way to accomplish all of this?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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