mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-25 21:40:08 +00:00
Only check for a user defined variable if we really have an visual
identifier.
This commit is contained in:
parent
409303f45d
commit
056d4ff29a
1 changed files with 16 additions and 12 deletions
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue