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

Re: Where to put my own completions?



Manfred Lotz wrote on Mon, 02 May 2022 11:31 +00:00:
> I have some completions outsided of packages. Once I decided to put those
> completions into ~/.zfunc directory and define things like follows
>
> fpath+=~/.zfunc
> autoload -Uz compinit
> zstyle ':completion:*' menu select
> compinit
>
>
> Question: Is there a recommended directory where to put completions into, or is
> it just like "Do what you want!" ?

I tend to put them in my zshrc alongside the function definitions:

f() { echo $1 $2 }
_f() { _arguments "1:foo" "2:bar" }
compdef _f f

It's convenient since they tend to change in lockstep.

Or one could use the XDG envvars / default paths:
https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

And for system-wise completions there's the site-functions dir, part of the default $fpath.

Cheers,

Daniel




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