zsh-users
 help / color / mirror / code / Atom feed
* Where to put my own completions?
@ 2022-05-02 11:31 Manfred Lotz
  2022-05-02 13:07 ` Daniel Shahaf
  2022-05-04  9:10 ` zzapper
  0 siblings, 2 replies; 4+ messages in thread
From: Manfred Lotz @ 2022-05-02 11:31 UTC (permalink / raw)
  To: zsh-users

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Where to put my own completions?
  2022-05-02 11:31 Where to put my own completions? Manfred Lotz
@ 2022-05-02 13:07 ` Daniel Shahaf
  2022-05-02 18:06   ` Manfred Lotz
  2022-05-04  9:10 ` zzapper
  1 sibling, 1 reply; 4+ messages in thread
From: Daniel Shahaf @ 2022-05-02 13:07 UTC (permalink / raw)
  To: zsh-users

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Where to put my own completions?
  2022-05-02 13:07 ` Daniel Shahaf
@ 2022-05-02 18:06   ` Manfred Lotz
  0 siblings, 0 replies; 4+ messages in thread
From: Manfred Lotz @ 2022-05-02 18:06 UTC (permalink / raw)
  To: zsh-users



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




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Where to put my own completions?
  2022-05-02 11:31 Where to put my own completions? Manfred Lotz
  2022-05-02 13:07 ` Daniel Shahaf
@ 2022-05-04  9:10 ` zzapper
  1 sibling, 0 replies; 4+ messages in thread
From: zzapper @ 2022-05-04  9:10 UTC (permalink / raw)
  To: zsh-users


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




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-04  9:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-02 11:31 Where to put my own completions? Manfred Lotz
2022-05-02 13:07 ` Daniel Shahaf
2022-05-02 18:06   ` Manfred Lotz
2022-05-04  9:10 ` zzapper

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).