3 Zsh Autoload
zrep edited this page 2024-04-06 09:31:41 +02:00

Zsh and autoload

The main function behind zrep is Zsh's autoload feature. It searches through a variable called fpath and anything in this path can be loaded and used.

autoload loads the contents of the files, so it usually contains a function. It is the function that gets executed by Zsh when the command is used, not the file itself.

As far as I know, Zsh allows for nested functions, meaning you can have functions within functions. You can see an example in my update-dynamic-ip script.

Zsh lazy loads the files in fpath and this means that it's not in memory until you actually executes the function. This means that it won't have an effect on your shell in terms of speed or memory usage.