My ~/.zshrc file was a jumble of aliases and functions until my trusty Lenovo unexpectedly died after 9 years of use. And then my ~/.zshrc was a blank slate on my new laptop.

I recently discovered we can load these zsh functions from another directory.

To autoload functions into your ~/.zshrc file, just add the following:

fpath=( $ZFUNC_PATH "${fpath[@]}" )
autoload -U ${fpath[1]}/*(:t);

where $ZFUNC_PATH is an alias to the directory of your functions.

source: zsh guide (at the bottom of “3.3.1: Loading functions”)

So I don’t lose my functions when this laptop dies and to better track what I’m changing over time - I decided to add them to source control:

What’s zsh?

That sounds like a dedicated post - but if you’re curious ohmyzsh is likely the best place to start.