zshrc: Make /etc/zsh/functions.d recursive
authorFrank Terbeck <ft@bewatermyfriend.org>
Tue, 17 Feb 2009 11:51:05 +0000 (12:51 +0100)
committerFrank Terbeck <ft@bewatermyfriend.org>
Tue, 17 Feb 2009 11:51:05 +0000 (12:51 +0100)
That way, we can drop whole subsystems into there, if we want to, like:

    /etc/zsh/functions.d/VCS_Info/...

This change also makes the code more backwards compatible.
zrcautoload does not need the -U switch. It does that automatically
depending on which zsh version is running.

etc/zsh/zshrc

index 9f3d87a..51141a1 100644 (file)
@@ -526,10 +526,12 @@ if [[ -n "$BROKEN_COMPLETION_DIR" ]] ; then
 else
     [[ -d /etc/zsh/completion.d ]] && fpath=( $fpath /etc/zsh/completion.d )
     if [[ -d /etc/zsh/functions.d ]] ; then
-        fpath+=( /etc/zsh/functions.d )
-        for func in /etc/zsh/functions.d/[^_]*[^~](N.) ; do
-            zrcautoload -U ${func:t}
+        fdir='/etc/zsh/functions.d'
+        fpath=( ${fdir} ${fdir}/**/*(/N) ${fpath} )
+        for func in ${fdir}/**/[^_]*[^~](N.) ; do
+            zrcautoload ${func:t}
         done
+        unset fdir
     fi
 fi