zsh plugin to load functions as an autoloading function.
Put zload and _zload files somewhere in your $fpath and add the following line to your .zshrc:
autoload -Uz zload
# download all files
% cd /path/to/dir
% git clone https://github.com/mollifier/zload.git
And add the following lines to your .zshrc:
fpath=(/path/to/dir/zload(N-/) $fpath)
autoload -Uz zload
If you use Antigen, add the following line to your .zshrc:
antigen bundle mollifier/zload
% zload [-a|-d] FILE...
Load FILEs as an autoloading function. zload can load autoloading function or zsh completion files as input file
When -a option is specified, from then on come to reload functions automatically. -d option stops this feature.
-a
enable auto reload-d
disable auto reload-h
display help and exit
# Load myfunc and _myfunc.
% zload myfunc _myfunc
# Now we can call myfunc even if it isn't in fpath.
% myfunc
# Load myfunc again and enable auto reload.
% zload -a myfunc
# edit myfunc
# ...
# Changes are applied immediately if auto reload is enabled.
% myfunc
# Disable auto reload.
% zload -d
# Enable auto reload.
% zload -a