]> arthur.barton.de Git - ax-zsh.git/blobdiff - ax.zsh
std_env: Don't set REPORTTIME in Warp terminal
[ax-zsh.git] / ax.zsh
diff --git a/ax.zsh b/ax.zsh
index c88c1920fd507fca123c0b51c1c8df54961be039..b2ee3db9856624f9e2a2c9859f31026d6db70a36 100644 (file)
--- a/ax.zsh
+++ b/ax.zsh
@@ -1,5 +1,5 @@
 # AX-ZSH: Alex' Modular ZSH Configuration
-# Copyright (c) 2015-2020 Alexander Barton <alex@barton.de>
+# Copyright (c) 2015-2022 Alexander Barton <alex@barton.de>
 
 script_name="${${(%):-%N}:t}"
 script_type="$script_name[2,-1]"
@@ -46,7 +46,7 @@ function axzsh_handle_stage {
                [[ -n "$AXZSH_DEBUG" ]] \
                        && echo "   - Reading cache file \"$cache_file\" ..."
                source "$cache_file"
-               unfunction ax_plugin_init
+               unfunction axzsh_plugin_init
        else
                # No cache file available.
                local new_cache_file="$cache_file.NEW"
@@ -55,17 +55,26 @@ function axzsh_handle_stage {
                local plugin_list
                typeset -U plugin_list
                plugin_list=(
-                       "$AXZSH/core/"[0-5]*
+                       "$AXZSH/core/"[0-4]*
                        "$AXZSH/active_plugins/"*(N)
-                       "$AXZSH/core/"[6-9]*
+                       "$AXZSH/core/"[5-9]*
                )
 
                # Create new cache file:
-               if [[ -n "$cache_file" && -w "$new_cache_file" ]]; then
-                       [[ -n "$AXZSH_DEBUG" ]] \
-                               && echo "   (Writing new cache file to \"$new_cache_file\" ...)"
-                       if ! printf "# %s\n\n" "$(LC_ALL=C date)" >"$new_cache_file"; then
-                               unset new_cache_file
+               [[ -n "$AXZSH_DEBUG" ]] \
+                       && echo "   (Writing new cache file to \"$new_cache_file\" ...)"
+               if ! printf "# %s\n\n" "$(LC_ALL=C date)" >"$new_cache_file"; then
+                       unset new_cache_file
+               else
+                       # New cache file successfully created ...
+                       if [[ "$type" = "ax-io" ]]; then
+                               # AX-IO Stage:
+                               # Write an initial PATH variable to the cache
+                               # file, which becomes overwritten by the path
+                               # plugin at the "zprofile" stage later on, but
+                               # this way "ax-io" stage plugins have a somewhat
+                               # saner PATH to begin with ...
+                               printf 'export PATH="%s"\n\n' "$PATH" >>"$new_cache_file"
                        fi
                fi
 
@@ -189,7 +198,7 @@ function axzsh_load_plugin {
 
                if [[ -n "$cache_file" ]]; then
                        # Add plugin data to cache
-                       printf "# BEGIN: %s\nax_plugin_init()\n{\n" "$fname" >>"$cache_file"
+                       printf "# BEGIN: %s\naxzsh_plugin_init()\n{\n" "$fname" >>"$cache_file"
                        case "$fname" in
                                *"/repos/"*)
                                        echo "[[ -n \"\$AXZSH_DEBUG\" ]] && echo '     - $plugin ($type): \"$fname\" ...'" >>$cache_file
@@ -199,7 +208,7 @@ function axzsh_load_plugin {
                                        echo "[[ -n \"\$AXZSH_DEBUG\" ]] && echo '     - $plugin ($type, cached) ...'" >>$cache_file
                                        "$cat_cmd" "$fname" >>"$cache_file"
                        esac
-                       printf "}\nax_plugin_init\n# END: %s\n\n" "$fname" >>"$cache_file"
+                       printf "}\naxzsh_plugin_init\n# END: %s\n\n" "$fname" >>"$cache_file"
                fi
        fi
 
@@ -219,11 +228,12 @@ fi
 [[ -n "$SHELL" ]] || export SHELL=$(command -v zsh)
 
 # Make sure that "AXZSH" variable is set and exported
-[[ -n "$AXZSH" ]] || export AXZSH="$HOME/.axzsh"
+[[ -n "$AXZSH" ]] || export AXZSH="${ZDOTDIR:-$HOME}/.axzsh"
 
 # Check for "debug mode" ...
 if [[ -f "$AXZSH/debug" || -f "$HOME/.axzsh.debug" ]]; then
        export AXZSH_DEBUG=1
+       export POWERLEVEL9K_INSTANT_PROMPT=quiet
        echo "AXZSH=$AXZSH"
        echo "AXZSH_DEBUG=$AXZSH_DEBUG"
        echo "AXZSH_PLUGIN_D=$AXZSH_PLUGIN_D"