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

Re: How completions work, do they require fpath?



On Jan 28,  8:39am, Sebastian Gniazdowski wrote:
}
} PS. Without compinit, compdef isn't available?

The compdef function is defined when compinit runs, yes.

The upshot is that you can either:

1. Put your function in a file whose name begins with "_", add a #compdef
   line, put the file in a directory in $fpath, and finally run "compinit"

2. Name your function file any way that you like, run compinit whenever
   it is convenient, put your file in a directory in $fpath or load it
   some other way e.g. "source", but finally add your function to the
   completion system by calling "compdef".

The intention is that #1 is simple and can be rubber-stamped for every
new completion function, but you always have #2 if #1 doesn't work for
some reason.  Either way "compinit" has to happen to set up the rest of
compsys, so there's no point in defining "compdef" independently.



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