]> arthur.barton.de Git - ax-zsh.git/blobdiff - ax.zsh
Don't call external tools, use variable modifiers
[ax-zsh.git] / ax.zsh
diff --git a/ax.zsh b/ax.zsh
index 1648eb7b00f0d872c44bc3ec352174cbc2fb6d58..a3c66c768c1f828a572cd4994c7bfc59d3fdd837 100644 (file)
--- a/ax.zsh
+++ b/ax.zsh
@@ -1,7 +1,7 @@
 # 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:"
@@ -10,8 +10,8 @@ script_type="$script_name[2,-1]"
 # - $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"
 
@@ -39,6 +39,11 @@ function axzsh_load_plugin {
                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) ..."
@@ -63,7 +68,7 @@ fi
 typeset -U plugin_list
 plugin_list=(
        "$AXZSH/core/"[0-5]*
-       "$AXZSH/active_plugins/"*
+       "$AXZSH/active_plugins/"*(N)
        "$AXZSH/core/"[6-9]*
 )
 
@@ -71,5 +76,6 @@ plugin_list=(
 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