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

Re: command completion taking ages



I wrote:

> Oliver Kiddle wrote:
> 
> > If I press tab in a position where all commands are completed, I get a
> > very long delay. This is quite annoying even though I can interrupt it
> > with Ctrl-C. Is there a way using the zstyle, tags and _wanted stuff
> > that I could indicate with zstyle that I don't want to complete commands
> > if $#PREFIX = 0. I couldn't see any styles which are passed through eval
> > in any of _requested, _wanted, _tags etc but other than using the
> > high-level stuff for tag ordering, I don't fully understand the tag
> > selection stuff so I may well have missed something.
> 
> No, we don't have something like that. I don't remember exactly when
> it was, but I have been thinking about something like that too...
> 
> ...
> 
> Back to your question: currently you can only 1) use tag-order to make 
> it generate as few matches as possible, or 2) (probably better) copy
> and modify _command_names to test [[ -z $PREFIX] (or (( $#PREFIX )) if 
> you prefer).

Ahem, I'm thinking too much about styles already. Of course there is a 
way:

  zstyle ':completion:*:*:-command-:*' tag-order 'maybe()' -

  maybe() { [[ -n $PREFIX ]] && comptry "$@" }

or somthing like this:

  maybe() {
    if [[ -n "$PREFIX$SUFFIX" || $1 = messages ]]; then
      comptry "$@"
    else
      _message 'not with an empty word...'
    fi
  }

Good enough?

Bye
 Sven


--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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