aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Ritter <dritter03@googlemail.com>2015-12-15 04:43:42 +0300
committerDominik Ritter <dritter03@googlemail.com>2015-12-15 04:43:42 +0300
commit056d4ff29ac1dbacc6be0d3b99160a493e47ab1c (patch)
tree432d450469ab10d86f491a1fac555a2054f16787
parent409303f45db59aa31cf3df2427d2f6b43d5349e9 (diff)
Only check for a user defined variable if we really have an visual
identifier.
-rwxr-xr-xpowerlevel9k.zsh-theme28
1 files changed, 16 insertions, 12 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index b2f36df6..04e29a2d 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -159,12 +159,14 @@ left_prompt_segment() {
local visual_identifier
if [[ -n $5 ]]; then
visual_identifier="$(print_icon $5)"
- # Allow users to overwrite the color for the visual identifier only.
- local visual_identifier_color_variable=POWERLEVEL9K_${(U)1#prompt_}_VISUAL_IDENTIFIER_COLOR
- set_default $visual_identifier_color_variable $3
- visual_identifier="%F{${(P)visual_identifier_color_variable}%}$visual_identifier%f"
- # Add an whitespace if we print more than just the visual identifier
- [[ -n $4 ]] && visual_identifier="$visual_identifier "
+ if [[ -n "$visual_identifier" ]]; then
+ # Allow users to overwrite the color for the visual identifier only.
+ local visual_identifier_color_variable=POWERLEVEL9K_${(U)1#prompt_}_VISUAL_IDENTIFIER_COLOR
+ set_default $visual_identifier_color_variable $3
+ visual_identifier="%F{${(P)visual_identifier_color_variable}%}$visual_identifier%f"
+ # Add an whitespace if we print more than just the visual identifier
+ [[ -n $4 ]] && visual_identifier="$visual_identifier "
+ fi
fi
echo -n "$visual_identifier%{$fg%}$4$POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS"
@@ -224,12 +226,14 @@ right_prompt_segment() {
local visual_identifier
if [[ -n $5 ]]; then
visual_identifier="$(print_icon $5)"
- # Allow users to overwrite the color for the visual identifier only.
- local visual_identifier_color_variable=POWERLEVEL9K_${(U)1#prompt_}_VISUAL_IDENTIFIER_COLOR
- set_default $visual_identifier_color_variable $3
- visual_identifier="%F{${(P)visual_identifier_color_variable}%}$visual_identifier%f"
- # Add an whitespace if we print more than just the visual identifier
- [[ -n $4 ]] && visual_identifier=" $visual_identifier"
+ if [[ -n "$visual_identifier" ]]; then
+ # Allow users to overwrite the color for the visual identifier only.
+ local visual_identifier_color_variable=POWERLEVEL9K_${(U)1#prompt_}_VISUAL_IDENTIFIER_COLOR
+ set_default $visual_identifier_color_variable $3
+ visual_identifier="%F{${(P)visual_identifier_color_variable}%}$visual_identifier%f"
+ # Add an whitespace if we print more than just the visual identifier
+ [[ -n $4 ]] && visual_identifier=" $visual_identifier"
+ fi
fi
echo -n "$4$visual_identifier$POWERLEVEL9K_WHITESPACE_BETWEEN_RIGHT_SEGMENTS%f"