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

Re: preexec function to work after `&&'



Jesper Holmberg wrote:

> I only now found the time to experiment with Eric's neat preexec function,
> and it's very nice. However, I'd like it to also work with tab completion,
> is that possible?

Not without modifying completion functions I don't think.

Completion in command context uses the -command- special context. By
default this ($_comps[-command-]) is the _autocd function. So the
easiest is perhaps to write your own wrapper function:

  _cmd_or_file() {
    _alternative \
      'files:file:_path_files -g "(#i)*.(html|jpg|jpeg|tif|tiff|png|doc|xls)"' \
      'commands:command:_autocd'
  }

Then use this new function for the -command- context:

  compdef _cmd_or_file -command-

Or you might find it easier to just get the latest 4.1 sources from CVS
and try out Peter's new suffix aliases feature.

Oliver



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