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!" ? -- Manfred
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
On 5/2/22 15:07, Daniel Shahaf wrote: > 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. > Thanks for your reply. I personally prefer to have a single file for each completion. I don't want to fill the .zshrc with different completions where each completion could have 40-70 lines or so. > 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. > From your reply I take that there is no recommendation from zsh perspective. -- Manfred
On 02/05/2022 12:31, Manfred Lotz wrote:
> 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 have the following but I must have copied this from someone
# add custom completion scripts
fpath=(~/.zsh/completion $fpath)
zzapper