From 2bac4dd8c44fb88a709b8c862bcb7fb19d96f592 Mon Sep 17 00:00:00 2001 From: Daniel Bauer Date: Sat, 22 Aug 2026 11:57:01 +0200 Subject: [PATCH] feat: build completions only once a day; improve startup time --- dot_zshrc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/dot_zshrc b/dot_zshrc index 864a48c..8bc3300 100644 --- a/dot_zshrc +++ b/dot_zshrc @@ -12,7 +12,18 @@ if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]] source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" fi -autoload -U +X compinit && compinit # fix compdef not found +# Load compdef immediately (needed before antidote loads plugins that call +# it), but only do the expensive security audit + dump rebuild once a day; +# otherwise just source the existing dump (-C). +autoload -U +X compinit +() { + setopt local_options extended_glob + if [[ -n ${HOME}/.zcompdump(#qN.mh+24) ]]; then + compinit + else + compinit -C 2>/dev/null || compinit + fi +} if [ -f $HOME/.zshrc_local ]; then source $HOME/.zshrc_local