Skip to content

load

load'' provides a condition that, when true, causes a previously-unloaded plugin to reload. Paired with unload'', it enables context-sensitive plugin loading.

Terminal window
zi ice load"[[ $PWD = */github* ]]"
zi load user/github-plugin

The condition is evaluated on each prompt (via precmd hook). When it becomes true and the plugin is not currently loaded, the plugin is loaded. Once loaded, the condition becoming true again does not trigger a second load — the plugin must first be unloaded via the unload'' condition.

load'' pairs naturally with unload'' to create plugins that activate and deactivate based on the current directory or other shell state.

Does not work with snippets.

Terminal window
# Load a plugin only when inside a GitHub-related directory
zi ice load'[[ $PWD = */github* ]]' unload'[[ $PWD != */github* ]]'
zi load user/github-helpers
  • unload
  • if
  • has