dots/users/price/conf/zsh/default.nix
Price Hiller 2f9e7a94f6
Some checks failed
Check Formatting of Files / Check-Formatting (push) Has been cancelled
refactor(nix): improve zsh compinit handling
2024-05-28 18:48:59 -05:00

24 lines
578 B
Nix

{ ... }:
{
programs.zsh = {
enable = true;
enableCompletion = true;
completionInit = ''
() {
autoload -U compinit
local zsh_cache="''${XDG_CACHE_HOME:-$HOME}/zsh/"
if [[ ! -d "$zsh_cache" ]]; then
mkdir -p "$zsh_cache"
fi
local _comp_files=($zsh_cache/zcompcache(Nm-20))
if (( $#_comp_files )); then
compinit -i -C -d "$zsh_cache/zcompcache"
else
compinit -i -d "$zsh_cache/zcompcache"
fi
}
'';
initExtra = builtins.readFile ./init-extra.zsh;
};
}