autoload
Mark functions for lazy loading in Zsh. tldr-pages
On several platforms
Several platforms
Mark functions for lazy loading in Zsh. Functions are not loaded into memory until first called, improving shell startup time.
Autoload a function by name
autoload function_nameIdentifyAutoload a function and immediately resolve its definition
autoload +X function_nameIdentifyAutoload a function using Zsh-style autoloading (recommended)
autoload -Uz function_nameIdentifyMake functions from a directory available by adding it to fpath
fpath=(path/to/functions_dir $fpath) && autoload -Uz function_nameIdentifyAutoload the Zsh completion system
autoload -Uz compinit && compinitIdentifyAutoload and use the add-zsh-hook utility
autoload -Uz add-zsh-hookIdentify