if [ -d "$HOME/.zfunc" ]; then
    fpath=($HOME/.zfunc $fpath)
fi

if [ -d "$HOME/.zsh/completions" ]; then
    fpath=($HOME/.zsh/completions $fpath)
fi

# Cache compinit: only regenerate dump once daily
autoload -Uz compinit
if [[ -n ${ZDOTDIR:-$HOME}/.zcompdump(#qN.mh+24) ]]; then
    compinit
else
    compinit -C
fi

zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
zstyle ':completion:*' menu select
zstyle ':completion:*' squeeze-slashes true
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
zstyle ':completion:*:descriptions' format '%F{cyan}-- %d --%f'
zstyle ':completion:*:warnings' format '%F{red}-- no matches --%f'

# Jujutsu

if (( $+commands[jj] )); then
    source <(jj util completion zsh)
fi
