From 2363545489a42bc4f14661394d2d1548622e23ec Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Tue, 25 Mar 2025 11:03:16 +0100 Subject: [PATCH] zsh:autoload: Allow nested directories As well as wrapper in subdirectories. --- .config/zsh/zshrc.d/00-autoload.zsh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.config/zsh/zshrc.d/00-autoload.zsh b/.config/zsh/zshrc.d/00-autoload.zsh index bb32561..e33e6b8 100644 --- a/.config/zsh/zshrc.d/00-autoload.zsh +++ b/.config/zsh/zshrc.d/00-autoload.zsh @@ -10,17 +10,16 @@ autoload -Uz run-help run-help-git zmv # Load autoloadable functions if [[ -d "$ZDOTDIR/autoload" ]]; then # Include all wrapper scripts if their wrapped command exists - d="$ZDOTDIR/autoload/wrapper" - if [[ -d "$d" ]]; then + for d in "$ZDOTDIR/autoload/"**/wrapper(/N); do fpath=("$d" $fpath) for f in "$d"/[^_.]*(.xN:t); do (( $+commands[$f] )) || continue autoload -Uz -- "$f" done - fi + done # Include all other subdirectories - for d in "$ZDOTDIR/autoload/"*(/N); do + for d in "$ZDOTDIR/autoload/"**(/N); do # EXTENDED_GLOB is not yet set, so we have to exclude manually [[ ${d:t} != wrapper ]] || continue