# AX-ZSH: Alex' Modular ZSH Configuration
# Copyright (c) 2015 Alexander Barton <alex@barton.de>
-script_name="$(basename -- "${(%):-%N}")"
+script_name="${${(%):-%N}:t}"
script_type="$script_name[2,-1]"
[[ -f "$HOME/.axzsh.debug" ]] && echo "ยป $script_name:"
# - $1: plugin name
# - $2: plugin type (optional; defaults to "zshrc")
function axzsh_load_plugin {
- dname="$(readlink "$1")" || dname="$1"
- plugin="$(basename "$dname")"
+ dname="$1:A"
+ plugin="$dname:t"
[[ -z "$2" ]] && type="zshrc" || type="$2"
fname="$dname/$plugin.$type"
fi
fi
+ if [[ "$type" == "zprofile" && -d "$dname/functions" ]]; then
+ # Add plugin function path when folder exists
+ axzsh_fpath+=("$dname/functions")
+ fi
+
if [[ -r "$fname" ]]; then
[[ -f "$HOME/.axzsh.debug" ]] \
&& echo " - $plugin ($type) ..."
typeset -U plugin_list
plugin_list=(
"$AXZSH/core/"[0-5]*
- "$AXZSH/active_plugins/"*
+ "$AXZSH/active_plugins/"*(N)
"$AXZSH/core/"[6-9]*
)
for plugin ($plugin_list); do
axzsh_load_plugin "$plugin" "$script_type"
done
+unfunction axzsh_load_plugin
unset script_name script_type plugin
unset plugin_list