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

Re: menu-select doesn't work with zle -C/_describe



Julius Plenz wrote:
... abbreviated to the following effect ...
> _x() {
>     local -a x expl
>     x=(one two three four)
>     _wanted files expl 'xxx' compadd -a x
> }
> zle -C x menu-select _x
> bindkey '^Xx' x
> 
> When I press Ctrl-X x now, the menu is printed with a caption and the
> prompt is re-printed below it, but I am not able to select anything
> from the menu (no entry is highlighted).

The function is OK (the _wanted form is the preferred one) but
entering the completion system directly at menu-select is likely to do
odd things---most of the controls assume the completion system itself is
in charge of setting up menus etc.

Try using the function in the following manner (this replaces your "zle
-C" line):

zle -C x complete-word _generic
zstyle ':completion:x:*' completer _x
zstyle ':completion:x:*' menu select

Now you're entering the completion system the normal way, but with the
styles set to use menu selection.  This should work better.  Obviously,
if you use a more descriptive name, the "x"s in the style context need
to change, too.

See the description of the _generic completer in the zshcompsys manual.

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070



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