From 65af13659b1093f02c6d0781fd637a152df22226 Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Sun, 2 Aug 2015 02:52:35 +0200 Subject: [PATCH] 05_fpath: Search for additional "function paths" The priority is: User-local paths > plugin paths > system-wide paths > default paths --- core/05_fpath/05_fpath.zshrc | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/core/05_fpath/05_fpath.zshrc b/core/05_fpath/05_fpath.zshrc index 7ba822f..f39645a 100644 --- a/core/05_fpath/05_fpath.zshrc +++ b/core/05_fpath/05_fpath.zshrc @@ -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) -- 2.39.2