Closed wookayin closed 9 months ago
~A side note: Hmm, actually if that's the case antidote-plugins
will take more precedence than "local" site-functions (e.g., $HOME/.local/share/zsh/site-functions
).~ NVM, this is due to incorrect order of $fpath
due to the use of /.zshenv
.
Also many plugins are loaded in the order they were specified, e.g.
foo/A kind:fpath
foo/B kind:fpath
foo/C kind:fpath
then the resulting fpath should be in the same order..
Feel like it's tricky to have a correct $fpath order.
Since antidote is based on antibody, the correct default behavior is compatibility with antibody's handling of fpath order. However, I am willing to entertain a discussion about how adding an alternative option would work.
See related issue: https://github.com/getantibody/antibody/issues/291
I ran into this. On the mac at least there is a default completion installed into /usr/share/zsh/5.9/functions/_gradle
. When I try to install the gradle plugin from oh-my-zsh the completion does not work as this is coming later in the fpath
. Not sure how to get around this currently.
A workaround I took for my dotfiles is here,
fpath_user=(${(@)fpath:#/(opt|usr)/*zsh*}) # remove all /opt, /usr path
fpath_system=(${(@)fpath:|fpath_user}) # $fpath \setminus $fpath_user
fpath=($fpath_user $fpath_system)
But we can generalize this idea as follows:
$fpath
before sourcing the antidote cache file, say into $fpath_backup
$fpath
being modified$fpath
by antidote, say $fpath_antidote
fpath = ($fpath_antidote $fpath_backup)
(i.e. $fpath
s added by antidote should precede all other system fpath
s)fpath_system=($fpath)
source $ANTIDOTE_BUNDLE
fpath_user=(${(@)fpath:|fpath_system}) # $fpath \setminus $fpath_system
fpath=($fpath_user $fpath_system)
With the upcoming release 1.9.4, you can add an fpath-rule
annotation like so:
ohmyzsh/ohmyzsh path:plugins/gradle fpath-rule:prepend
When
kind:fpath
is used, the bundle would currently be appended to the$fpath
, but I think we should prepend to$fpath
like$PATH
is treated (by default). Or at least there should be some configuration option.Why? For example,
results in
$fpath
being something likewhich is after the zsh builtin fpath. This make
_completion
scripts shipped with the plugin shadowed and not loadable.The main purpose of adding a plugin as
kind:fpath
is to use their shell functions and completion that would override the built-ins, so I think the "prepend" behavior would make more sense than the "append" behavior.