From a81d28cbdc90f77c80e489c21723367dfa019fe7 Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Thu, 11 Jun 2020 14:05:21 +0200 Subject: [PATCH] Integrate support for Powerlevel10k, including "instant prompt" - , - --- ax.zsh | 14 ++++++++++++++ bin/axzshctl | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/ax.zsh b/ax.zsh index 2d7bd66..23eda01 100644 --- a/ax.zsh +++ b/ax.zsh @@ -206,6 +206,20 @@ if [[ "$script_type" = "zprofile" ]]; then axzsh_handle_stage "$script_name" "ax-io" fi +# 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 [[ "$script_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 + axzsh_handle_stage "$script_name" "$script_type" # Clean up ... diff --git a/bin/axzshctl b/bin/axzshctl index efc8a98..05062bd 100755 --- a/bin/axzshctl +++ b/bin/axzshctl @@ -220,6 +220,10 @@ function EnableDefaultPlugins { function SetTheme { local link_name="$AXZSH/active_theme" + # --- Powerlevel10k --- + # Remove "instant prompt" configuration, if any ... + rm -f "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" + if [[ "$1" = "-" ]]; then rm -f "$link_name" || return 1 ax_msg 0 "Theme settings have been reset." -- 2.39.2