]> arthur.barton.de Git - ax-zsh.git/blobdiff - ax.zsh
iterm2: Don't setup command aliases, we always update the search path
[ax-zsh.git] / ax.zsh
diff --git a/ax.zsh b/ax.zsh
index c61fa2e89dbe10ed10ff3d5188e81954f4dd569e..a0fb5d8b66e664e372a081ccfd2289df4d77cf6e 100644 (file)
--- a/ax.zsh
+++ b/ax.zsh
@@ -1,5 +1,5 @@
 # AX-ZSH: Alex' Modular ZSH Configuration
-# Copyright (c) 2015-2022 Alexander Barton <alex@barton.de>
+# Copyright (c) 2015-2024 Alexander Barton <alex@barton.de>
 
 script_name="${${(%):-%N}:t}"
 script_type="$script_name[2,-1]"
@@ -24,10 +24,19 @@ function axzsh_handle_stage {
        # [y/n] confirmations, etc.) must be executed before this, so all ax-zsh
        # plugins should do output in their "ax-io" stage only!
        # Read the initialization script in the "zprofile" stage for login
-       # shells, and in the "zshrc" stage for non-login shells.
-       if [[ ( -o login && "$type" == "zprofile" ) || ( ! -o login && "$type" == "zshrc" ) ]]; then
+       # shells, and in the "zshrc" stage for non-login sub-shells (which have
+       # the profile already read in and therefore will skip the "ax-io" and
+       # "zprofile" stages and not catch up).
+       if [[ \
+               ( "$type" == "zprofile" ) || \
+               ( ! -o login && "$type" == "zshrc" && -n "$AXZSH_ZPROFILE_READ" ) \
+       ]]; then
                p10k_instant_prompt="${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
-               [[ -r "$p10k_instant_prompt" ]] && source "$p10k_instant_prompt"
+               if [[ -r "$p10k_instant_prompt" ]]; then
+                       [[ -n "$AXZSH_DEBUG" ]] && echo "  Reading \"$p10k_instant_prompt\" ..."
+                       source "$p10k_instant_prompt"
+               fi
+               unset p10k_instant_prompt
        fi
 
        # Initialize cache
@@ -48,7 +57,7 @@ function axzsh_handle_stage {
                [[ -n "$AXZSH_DEBUG" ]] \
                        && echo "   - Reading cache file \"$cache_file\" ..."
                source "$cache_file"
-               unfunction axzsh_plugin_init
+               (( $+functions[axzsh_plugin_init] )) && unfunction axzsh_plugin_init
        else
                # No cache file available.
                local new_cache_file="$cache_file.NEW"