Reputation: 1980
I have written a script for internal use in my job (it's not of much use to anyone outside of my work). I've got a decent zsh
completion script for it now which works great. I'd like to add an --install-zsh-completions
flag to my script, which sets up completions automatically.
I see that there are a variety of different ways that zsh
can be set up, depending on whether you use oh-my-zsh, prezto or your own configuration. (For example, in oh-my-zsh
, you can put completion scripts in ~/.oh-my-zsh/completions
and they are loaded.)
Is there a standard place or way in zsh
to install custom completion functions, so that they work for all users, regardless of their zsh
config? (For example, should I just modify the .zshrc
file and add to the fpath
? )
Upvotes: 4
Views: 3732
Reputation: 7020
Is there a standard place or way in zsh to install zsh custom completion scripts?
Yes, there is: Create a symlink in /usr/local/share/zsh/site-functions
that points to your completion function. That's all there is to it.
This dir is by default in every user's $fpath
. So, when they (or whatever framework they're using) calls compinit
, it will be picked up automatically.
Upvotes: 7