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

Re: Autocomplet with compdef _precommand



On Aug 30,  7:35am, Michel wrote:
}
} How can I use a autocomplet like _precommand but without the autocd
} behaviour?

Unfortunately this is a little tricky.

The easiest thing might be this:

    _start () {
	setopt localoptions noautocd
	_precommand "$@"
    }
    compdef _start start

More generically, the only zstyle that modifies autocd behavior is for
the "-command-" special context, so you have to use "zstyle -e" with
an evaluated test that determines whether "start" was the precommand
word AND whether the tags are being looked up for "cd":

    zstyle -e :completion::complete:-command-:: tag-order \
      '(( $precommands[(I)start] && $funcstack[(I)_cd] )) && reply=(-)'

Question for zsh-workers:  Is it worth adding a style to _precommand
to selectively turn off autocd?  If so, what should it be called?



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