This commit is contained in:
2026-03-03 16:30:58 +01:00
parent 5f34d32807
commit 6a49646d5e
34 changed files with 1229 additions and 1044 deletions

View File

@@ -7,7 +7,7 @@
# Delete zcompdump on config switch, so that we regenerate completions
home.activation = {
clearZshCompDump = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
rm -f '${config.programs.zsh.dotDir}/.zcompdump*'
rm -f "${config.programs.zsh.dotDir}"/.zcompdump*
'';
};
@@ -17,20 +17,16 @@
enableCompletion = true;
completionInit = ''
setopt EXTENDED_GLOB
autoload -U compinit
local dump_path="${config.programs.zsh.dotDir}/.zcompdump"
local cache_check=( $dump_path(#qN.mh-24) )
compinit -C
if (( $#cache_check )); then
# Array has items: File exists and is new
compinit -C
else
# Array is empty: File is older than 24 hours OR doesn't exist
compinit
zcompile "$dump_path" &
fi
ZCOMPDUMP="${config.programs.zsh.dotDir}/.zcompdump"
# Compile it in the background
{
if [[ -s "$ZCOMPDUMP" && (! -s "''${ZCOMPDUMP}.zwc" || "$ZCOMPDUMP" -nt "''${ZCOMPDUMP}.zwc") ]]; then
zcompile "$ZCOMPDUMP"
fi
} &!
'';
autosuggestion.enable = true;