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

Re: java class names completion widget

Konstantin Sobolev wrote:
> It works, but how can I force it to use menu completion instead of cycling? 
> Playing with 
> zstyle ':completion:*' menu select
> gives a bit weird effect:
> (with descriptions turned on)

I was hoping you weren't going to ask that...

I think a change of tack is the easiest way.  Instead of hacking the
_expand completer, which has some odd settings, the following goes
through the normal completer; the trick with _generic is to allow us
to use a widget bound to a key but still use the normal completion
logic.  Then we simply do the expansion by hand and add the results
unconditionally, i.e. without additional matching (compadd -U).  This
may have side effects but it seems basically OK.

_expand_java_path now contains:

  local MATCH MBEGIN MEND pref suf


  local expl
  local -a exp
  if (( ${#exp} )); then
    _wanted java-files expl 'java source file (search)' \
      compadd -U -a exp
    return 1

and .zshrc now requires the following setup:

  zle -C expand-java-path complete-word _generic
  zstyle ':completion:expand-java-path:*' completer _expand_java_path
  bindkey '^xj' expand-java-path

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

To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php

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