diff --git a/.config/zsh/autoload/clang-format b/.config/zsh/autoload/wrapper/clang-format similarity index 100% rename from .config/zsh/autoload/clang-format rename to .config/zsh/autoload/wrapper/clang-format diff --git a/.config/zsh/zshrc.d/00-autoload.zsh b/.config/zsh/zshrc.d/00-autoload.zsh index f7bf0c0..bb32561 100644 --- a/.config/zsh/zshrc.d/00-autoload.zsh +++ b/.config/zsh/zshrc.d/00-autoload.zsh @@ -9,8 +9,21 @@ autoload -Uz run-help run-help-git zmv # Load autoloadable functions if [[ -d "$ZDOTDIR/autoload" ]]; then - # Include all subdirectories + # Include all wrapper scripts if their wrapped command exists + d="$ZDOTDIR/autoload/wrapper" + if [[ -d "$d" ]]; then + fpath=("$d" $fpath) + for f in "$d"/[^_.]*(.xN:t); do + (( $+commands[$f] )) || continue + autoload -Uz -- "$f" + done + fi + + # Include all other subdirectories for d in "$ZDOTDIR/autoload/"*(/N); do + # EXTENDED_GLOB is not yet set, so we have to exclude manually + [[ ${d:t} != wrapper ]] || continue + fpath=("$d" $fpath) autoload -Uz -- "" "$d"/[^_.]*(.xN:t) done