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

Re: Question to maintainers of third-party packages that install zsh completions



Hi,

Daniel Shahaf wrote:
> Where would you expect the answer to "How does one install third-party
> zsh completions in such a way that zsh will pick them up automatically?"
> to be found?  I'd like to make sure the documentation has this
> information where people who look for it will find it.

Tough question to answer in full generality.  Depends on the kind of in-
stallation you're interested in, too. Debian's vendor package, for exam-
ple, has the following convention¹:

[..snip..]
Load-path for functions from other packages
-------------------------------------------

In respsonse to #620452, the  zsh-binary from Debian's zsh package star-
ted to provide two entries to $fpath (the search path for loadable func-
tions) for other packages to drop function files into:

  - /usr/share/zsh/vendor-completions for functions  that add functiona-
    lity to zsh's function based completion system (compsys)

  - /usr/share/zsh/vendor-functions for all other functions

If you  maintain another Debian package  that wants to add  functions to
zsh's function load-path, please use  the those conventions when instal-
ling function files.
[..snap..]

This  was done  to keep  ‘/usr/local/share/zsh/site-functions’ available
for purely  local additions to  the load-path.  Debian does not  put the
‘site-functions’ directory  into ‘/usr’ (sans /local),  because the non-
local part of ‘/usr’ is meant to be managed by Debian's package system.

Not all vendors do this, of course. But it neatly keeps package and site
local installation separate.


Still, however, the ‘site-functions’ directory is always the first entry
in the load-path list, based on all compile-time options. So, for purely
local function installation, this may be good enough:

  zsh -f -c 'print ${fpath[1]}'

Vendors may have additional requirements  when it comes to their package
system.


Regards, Frank

¹ https://salsa.debian.org/debian/zsh/-/blob/debian/debian/README.Debian




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