From 2ecc0b14c882cebea204fa70cafad4dd008d2199 Mon Sep 17 00:00:00 2001 From: romkatv Date: Sat, 29 Jun 2019 10:49:02 +0200 Subject: [PATCH 1/2] fix custom prompt on ZSH older than 5.2 fixes #96 --- internal/p10k.zsh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 2ea2e430..30d4feb6 100755 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -624,10 +624,9 @@ prompt_host() { # The 'custom` prompt provides a way for users to invoke commands and display # the output in a segment. prompt_custom() { - local segment_name="${3:u}" - # Get content of custom segment - local command="POWERLEVEL9K_CUSTOM_${segment_name}" - local -a cmd=("${(@Q)${(z)${(P):-POWERLEVEL9K_CUSTOM_${segment_name}}}}") + local segment_name=${3:u} + local command=POWERLEVEL9K_CUSTOM_${segment_name} + local -a cmd=("${(@Q)${(z)${(P)command}}}") whence $cmd[1] &>/dev/null || return local content=$("$cmd[@]") [[ -n $content ]] || return From 613ffec4b61fc8c97427a99bcca72808a980645e Mon Sep 17 00:00:00 2001 From: romkatv Date: Sat, 29 Jun 2019 10:58:38 +0200 Subject: [PATCH 2/2] make POWERLEVEL9K_VCS_${component}FORMAT_FOREGROUND overrides work on ZSH older than 5.2 --- internal/p10k.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 30d4feb6..fd3f3778 100755 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -1596,7 +1596,8 @@ powerlevel9k_vcs_init() { local component state for component in REMOTE_URL COMMIT BRANCH DIRTY TAG REMOTE_BRANCH STAGED UNSTAGED \ UNTRACKED OUTGOING_CHANGES INCOMING_CHANGES STASH ACTION; do - local color=${(P)${:-POWERLEVEL9K_VCS_${component}FORMAT_FOREGROUND}} + local var=POWERLEVEL9K_VCS_${component}FORMAT_FOREGROUND + local color=${(P)var} if [[ -n $color ]]; then for state in "${(@k)vcs_states}"; do local var=POWERLEVEL9K_VCS_${(U)state}_${component}FORMAT_FOREGROUND