# Handle "initialization stage", load all plugins of that stage, either from an
# existing cache file or individually, optionally creating the cache.
# - $1: Script name
-# - $2: Stage name (zprofile, zshrc, zlogin, zlogout)
+# - $2: Stage name (ax-io, zprofile, zshrc, zlogin, zlogout)
function axzsh_handle_stage {
- name="$1"
- type="$2"
+ local name="$1"
+ local type="$2"
[[ -n "$AXZSH_DEBUG" ]] && echo "ยป $name ($type):"
+ # Look for some 3rd-party integrations ...
+
+ # --- Powerlevel10k ---
+ # Read in Powerlevel10k configuration file, if not already read:
+ [[ -z "$POWERLEVEL9K_CONFIG_FILE" && -r ~/.p10k.zsh ]] && source ~/.p10k.zsh
+ # Enable instant prompt. Should stay close to the top of ~/.zshrc.
+ # Initialization code that may require console input (password prompts,
+ # [y/n] confirmations, etc.) must be executed before this, so all ax-zsh
+ # plugings should do output in their "zprofile" stage!
+ if [[ "$type" == "zprofile" ]]; then
+ p10k_instant_prompt="${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
+ [[ -r "$p10k_instant_prompt" ]] && source "$p10k_instant_prompt"
+ fi
+
# Initialize cache
mkdir -p "$AXZSH/cache"
- cache_file="$AXZSH/cache/$type.cache"
+ local cache_file="$AXZSH/cache/$type.cache"
- cat_cmd=${commands[cat]:-cat}
+ local cat_cmd=${commands[cat]:-cat}
if [[ -r "$cache_file" ]]; then
# Cache file exists, use it!
else
# No cache file available.
# Setup list of plugins to load:
+ local plugin_list
typeset -U plugin_list
plugin_list=(
"$AXZSH/core/"[0-5]*
if [[ ! -r "$fname" && "$type" == "zshrc" ]]; then
zsh_themes=("$dname/"*.zsh-theme(NY1))
- if [[ -r "$dname/$plugin.zprofile" || -r "$dname/$plugin.zlogout" ]]; then
+ if [[ -r "$dname/$plugin.ax-io" || -r "$dname/$plugin.zprofile" || -r "$dname/$plugin.zlogout" ]]; then
# Native AX-ZSH plugin, but for different stage. Skip it!
:
elif [[ -r "$dname/${plugin_short}.plugin.zsh" ]]; then
[[ -n "$SHELL" ]] || export SHELL=$(command -v zsh)
# Make sure that "AXZSH" variable is set and exported
-if [[ -z "$AXZSH" ]]; then
- export AXZSH="$HOME/.axzsh"
- if [[ -f "$HOME/.axzsh.debug" ]]; then
- export AXZSH_DEBUG=1
- echo "AXZSH=$AXZSH"
- echo "AXZSH_DEBUG=$AXZSH_DEBUG"
- echo "AXZSH_PLUGIN_D=$AXZSH_PLUGIN_D"
- fi
+[[ -n "$AXZSH" ]] || export AXZSH="$HOME/.axzsh"
+
+# Check for "debug mode" ...
+if [[ -f "$AXZSH/debug" || -f "$HOME/.axzsh.debug" ]]; then
+ export AXZSH_DEBUG=1
+ echo "AXZSH=$AXZSH"
+ echo "AXZSH_DEBUG=$AXZSH_DEBUG"
+ echo "AXZSH_PLUGIN_D=$AXZSH_PLUGIN_D"
+ echo "AXZSH_ZLOGIN_READ=$AXZSH_ZLOGIN_READ"
+ echo "AXZSH_ZPROFILE_READ=$AXZSH_ZPROFILE_READ"
+fi
+
+if [[ "$script_type" = "zprofile" ]]; then
+ # Load all "output" plugins first, that is, before the "zprofile stage":
+ axzsh_handle_stage "$script_name" "ax-io"
fi
axzsh_handle_stage "$script_name" "$script_type"
# Clean up ...
unfunction axzsh_handle_stage axzsh_load_plugin
unset script_name script_type
+
+# Hints for external installers:
+# - iTerm2: DON'T install "iterm2_shell_integration"!