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

Re: what zshcompsys-syntax is equals compctl -C -f ?



Eike Kroemer <kroemer@xxxxxxxx> wrote:
> I used "compctl -C -f" to avoid path-lookup in completion.
> For example assume my $PWD has a subdirectory "bin/" and I want to call
> "Script" located in this dir.

So you want local directories (not using CDPATH), and any executable
files in them, right?

Try adding:

  _local_exes() {
    _files -g "*(*)"
  }
  compdef _local_exes -command-

after the point where "compinit" runs.  This makes command context
(which means basically what you think) run your function instead of the
default.  The function uses a glob qualifier to match all executable files.
The _files function automatically lets you search for the file in subdirectories
(in fact, I've discovered I'm a bit vague on how to stop it doing that,
but luckily you don't need to).

All sorts of variations are possible.  You should be able to get away with
putting a suitable function in your $fpath, but I couldn't get that to work
(it get being overridden however I organised my fpath and deleted the
dumped configuration), so just stick with the lines above or similar.

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


This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com



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