Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -585,16 +585,23 @@ fi

# Completion dirs must be on fpath before compinit so they're picked up by the
# single cached compinit below (installer blocks at the bottom only set fpath).
_compinit_rebuild=false
[ -d ~/.grok/completions/zsh ] && fpath=(~/.grok/completions/zsh $fpath)
[ -d ~/.docker/completions ] && fpath=(~/.docker/completions $fpath)
if [ -d ~/.docker/completions ]; then
fpath=(~/.docker/completions $fpath)
if [[ -r ~/.zcompdump ]] && ! command grep -q "'docker' '_docker'" ~/.zcompdump; then
_compinit_rebuild=true
fi
fi

# Cached compinit - only regenerate once per day
autoload -Uz compinit
if [[ -n ~/.zcompdump(#qN.mh+24) ]]; then
if [[ "$_compinit_rebuild" == true || -n ~/.zcompdump(#qN.mh+24) ]]; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Force the dump refresh when Docker is absent

When _compinit_rebuild is true, this still invokes plain compinit, which can source the existing ~/.zcompdump whenever the dump header's completion-file count and ZSH_VERSION match the current fpath. In the stale-cache case where Docker was added but the total count stayed the same, the grep check remains true yet compinit reloads the stale dump, so _docker remains unavailable and each new shell keeps doing the slower uncached check; remove/rename the dump or otherwise force regeneration before initializing.

Useful? React with 👍 / 👎.

compinit
else
compinit -C
fi
unset _compinit_rebuild


# Lazy-load pyenv (saves ~100ms on shell startup)
Expand Down
Loading