Open mattmc3 opened 2 years ago
Hook/callback function support would be really useful for deferred plugins setup, for example, configuring specific options which are only available after the deferred plugin is sourced.
Just to clarify where we're at with this feature.
pre:before_func
and post:after_func
annotations exist, and should be sufficient for 90% of what someone would need a hook for. As an example, if you bundle with the pre/post annotations, functions you define get called:
$ antidote bundle zsh-users/zsh-autosuggestions pre:do_before_autosuggest post:do_after_autosuggest
do_before_autosuggest
fpath+=( $ANTIDOTE_HOME/zsh-users/zsh-autosuggestions )
source $ANTIDOTE_HOME/zsh-users/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh
do_after_autosuggest
What remains of this feature is determining if there's any value in any of the other potential hooks:
It would help to have a user with a specific use-case where these are strictly necessary. Since antibody didn't implement anything like this, understanding a use-case from antigen/zinit might be helpful, as well as pointing to a specific plugin that requires this additional feature.
See also: https://github.com/mattmc3/antidote/discussions/67
Currently, we support a handful of annotations for common usages. However, we could allow users to add 'hooks' or custom annotations for custom Zsh output. Something like
custom:myfunc
so that a user could definemyfunc
to emit whatever custom Zsh init code they want. That would let you get fancy with plugin management without adding bloat for every annotation scenario to antidote.