]> arthur.barton.de Git - ax-zsh.git/commitdiff
05_fpath: Search for additional "function paths"
authorAlexander Barton <alex@barton.de>
Sun, 2 Aug 2015 00:52:35 +0000 (02:52 +0200)
committerAlexander Barton <alex@barton.de>
Sun, 2 Aug 2015 00:52:35 +0000 (02:52 +0200)
The priority is:
User-local paths > plugin paths > system-wide paths > default paths

core/05_fpath/05_fpath.zshrc

index 7ba822f817db686681a0a5bdd98ea681cbe0a628..f39645a30a0955549eeade7c7b44535e40d94414 100644 (file)
@@ -3,4 +3,24 @@
 
 typeset -xTU AXZSH_FPATH axzsh_fpath 2>/dev/null
 
-[[ -n "$AXZSH_FPATH" ]] && fpath=($axzsh_fpath $fpath)
+# Search for additional ZSH function paths: lower priority than plugins
+for dir (
+       /usr/local/share/zsh/site-functions(N)
+       /usr/share/zsh/site-functions(N)
+); do
+               [[ -d "$dir" ]] && axzsh_fpath=($axzsh_fpath "$dir")
+done
+
+# Add current "fpath" to axzsh_fpath
+axzsh_fpath=($axzsh_fpath $fpath)
+
+# Search for additional ZSH function paths: higher priority than plugins
+for dir (
+       $HOME/.config/zsh/functions(N)
+       $HOME/.zsh/functions(N)
+); do
+       [[ -d "$dir" ]] && axzsh_fpath=("$dir" $axzsh_fpath)
+done
+
+# Set ZSH "fpath" from axzsh_fpath (which is exported to subshells)
+fpath=($axzsh_fpath)