Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Include XDG_DATA_DIRS/share/zsh/site-functions in FPATH by default?
- X-seq: zsh-users 30285
- From: Jade Lovelace <jadel@xxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Include XDG_DATA_DIRS/share/zsh/site-functions in FPATH by default?
- Date: Thu, 26 Jun 2025 15:23:29 -0700
- Archived-at: <https://zsh.org/users/30285>
- List-id: <zsh-users.zsh.org>
It's conventional in some distro packaging such as on NixOS to put the
completions in a directory in $XDG_DATA_DIRS/share/zsh/site-functions.
Currently NixOS injects a zshenv which contains:
if [[ -z "${__ETC_ZSHENV_SOURCED:-}" ]]; then
# Tell zsh how to find installed completions.
for p in ''${(z)NIX_PROFILES}; do
fpath=($p/share/zsh/site-functions
$p/share/zsh/$ZSH_VERSION/functions $p/share/zsh/vendor-completions
$fpath)
done
fi
Nix will put each package's share directory in XDG_DATA_DIRS when
creating ephemeral shell environments as well.
This is superfluous in bash which uses XDG_DATA_DIRS by default:
https://github.com/scop/bash-completion/blob/51b009f6a653c66454816e9bc869c40f61329764/README.md?plain=1#L362-L372
and https://github.com/scop/bash-completion/blob/51b009f6a653c66454816e9bc869c40f61329764/bash_completion#L3306-L3309.
I am wondering if zsh has considered doing this by default as well, as
it makes zsh integrate cleanly with other tooling that uses
XDG_DATA_DIRS without specially needing to consider adding zsh
specific code to handle FPATH.
Regards,
Jade
Messages sorted by:
Reverse Date,
Date,
Thread,
Author