Open segevfiner opened 6 years ago
Just to clarify, the suggestion is to replace:
plugins=(… zsh-completions)
source "$ZSH/oh-my-zsh.sh"
autoload -U compinit && compinit
With:
fpath+="${ZSH_CUSTOM:-"$ZSH/custom"}/plugins/zsh-completions/src"
source "$ZSH/oh-my-zsh.sh"
The above is just an optimized version of the previously suggested, which takes the ZSH_CUSTOM into account if set.
It's important to remove zsh-completions
from the OMZ plugins because otherwise fpath would be filled with the same contents twice.
The current instructions: README.md#oh-my-zsh, suggest to add zsh-completions to
plugins
and reruncompinit
.But that's sub-optimal. This will cause Zsh to rebuild the completion cache twice on each Zsh invocation: The first when you source oh-my-zsh, and the second time when you rerun
compinit
. This defeats the whole point of the completions cache, and will negatively impact the startup time of Zsh.Sadly, oh-my-zsh doesn't seem to have a way for a plugin to add more
fpath
entries, besides the root folder of the plugin, before it invokescompinit
. I think it's best to just suggest adding the zsh-completionssrc
dir tofpath
before thesource $ZSH/oh-my-zsh.sh
line, in order to avoid this issue. Something like this: