if
Summary
Section titled “Summary”if'' conditionally loads a plugin or snippet based on an arbitrary shell expression.
If the expression evaluates to false, loading is skipped entirely.
Syntax / Usage
Section titled “Syntax / Usage”zi ice if"<shell-expression>"zi ice if'[[ -n "$commands[otool]" ]]'zi ice if'(( $+commands[brew] ))'Details
Section titled “Details”The expression is evaluated once at load time. If it returns a non-zero exit status, the plugin or snippet is not loaded.
if'' is evaluated before any hooks run, so a failing condition prevents cloning,
sourcing, and all at* hooks.
Works with both plugins and snippets.
Examples
Section titled “Examples”# Load macOS-only plugin only on macOSzi ice if'[[ "$OSTYPE" == darwin* ]]'zi light user/macos-plugin
# Load only when otool (Xcode developer tools) is availablezi ice if'[[ -n "$commands[otool]" ]]'zi load some/pluginSee Also
Section titled “See Also”- has
- load