trigger-load
Summary
Section titled “Summary”trigger-load'' creates one or more stub functions that, when called, load the
associated plugin or snippet on demand and optionally forward the call to the real
command.
Syntax / Usage
Section titled “Syntax / Usage”# Create a stub function; prepend ! to forward the call after loadingzi ice trigger-load"!funcname"zi ice trigger-load"!func1;func2" # multiple stubs, separated by ;Details
Section titled “Details”Each name in the semicolon-separated list becomes a shell function. When that function
is first called, Zinit loads the plugin/snippet. If the name is prefixed with !, the
original call is forwarded to a command of the same name after the plugin loads,
enabling transparent lazy loading.
Without !, the stub just triggers loading and the original invocation is not
re-dispatched.
Multiple stubs can be defined in one ice by separating them with ;.
Examples
Section titled “Examples”# Lazy-load nvm: first call to `nvm` triggers the load and runs the real nvmzi ice trigger-load"!nvm"zi light lukechilds/zsh-nvm
# Create a trigger that loads a helper plugin silentlyzi ice trigger-load"my-helper-fn" lucidzi light user/helper-pluginSee Also
Section titled “See Also”- wait
- load