parsed.org
Autoloading and Reloading Functions by cygnus on Jan 19, 2005 04:09 PM

To have zsh autoload functions, you can place them in a directory and have zsh search the path when the functions are called. For example, consider a function foo defined in ~/functions/foo. In your ~/.zshrc add:

FPATH=~/functions:$FPATH
autoload foo

Then, whenever you call foo, zsh will attempt to read ~/functions/foo for the function definition. To reload a function after you have changed its source file, run:

unfunction foo
autoload foo

The next invocation of the function will cause a reload of ~/functions/foo.

autoloadfunctionspathreloadzsh
RSS