zsh:autoload: Include all subdirs in autoload/

Make it possible to organize autoloadable functions.
This commit is contained in:
2022-01-27 14:43:57 +01:00
parent 8526727cc5
commit fb92842d0a

View File

@@ -7,6 +7,12 @@ autoload -Uz run-help run-help-git zmv
# Load autoloadable functions
if [[ -d "$ZDOTDIR/autoload" ]]; then
# Include all subdirectories
for d in "$ZDOTDIR/autoload/"*(/N); do
fpath=("$d" $fpath)
autoload -Uz -- "" "$d"/[^_.]*(.xN:t)
done
fpath=("$ZDOTDIR/autoload" $fpath)
autoload -Uz -- "" "${fpath[1]}"/[^_.]*(.xN:t)
fi