On Wed, Sep 29, 2021 at 11:45 AM Peter Slížik <peter.slizik@gmail.com> wrote:
>
> Hello,
>
> I've added ~/.zsh/completions to fpath:
>
> fpath=(~/.zsh/autoload ~/.zsh/completions $fpath)
>
> this seemingly simple change has added 1 or 2 seconds to ZSH start time.
This usually happens when compinit is invoked before and after you
modify fpath. The biggest offender here is Ubuntu. Its global zshrc
has this awfulness:
# If you don't want compinit called here, place the line
# skip_global_compinit=1
# in your $ZDOTDIR/.zshenv
if grep -q '^ID.*=.*ubuntu' /etc/os-release && [[ -z
"$skip_global_compinit" ]]; then
autoload -U compinit
compinit
fi
The solution is to add skip_global_compinit=1 to ~/.zshenv.
Naturally, you also need to ensure that your own rc files invoke
compinit only once, after all changes to fpath.
Roman.