zgen
zgen copied to clipboard
Why is $fpath extended after sourcing plugins?
Hello,
I saw one zgen-generated init.zsh
and it contained fpath+=( ...
code after the series of sources of plugins. I think this is problematic because plugins cannot use autoload
functionality to use external-file functions. This is a very important feature of Zsh and plugins do use it, at least mine. Could fpath+=( ...
be moved above sources of plugins? It would then be conforming to Oh-My-Zsh
. It also extends fpath
before sourcing plugins, and also runs compinit
in that place, allowing plugins to use compdef
call.
I'm also running into this problem. I'm using zgen load scmbreeze/scm_breeze
to load the scm_breeze plugin but it tries to call compdef
and errors:
/Users/tekumara/.scm_breeze/lib/git/aliases.sh:192: command not found: compdef
This is happening because the plugin is sourced before compinit
is run.
For now, I am working around this by running compinit
before zgen. Zgen detects this and doesn't run compinit
itself.
autoload -Uz compinit && \
compinit -C
# load zgen
source "${HOME}/.zgen/zgen.zsh"