Cleaned up whitespaces: Now the whitespaces are controlled by the functions that draw the segments (except vcs). This makes it more flexible, and you don't get unwanted whitespaces, when flipping segments from one side to another.

pull/22/head
Dominik Ritter 10 years ago
parent d65aea3a64
commit 86db273188

@ -263,12 +263,14 @@ left_prompt_segment() {
[[ -n $2 ]] && bg="%K{$2}" || bg="%k" [[ -n $2 ]] && bg="%K{$2}" || bg="%k"
[[ -n $3 ]] && fg="%F{$3}" || fg="%f" [[ -n $3 ]] && fg="%F{$3}" || fg="%f"
if [[ $CURRENT_BG != 'NONE' && $2 != $CURRENT_BG ]]; then if [[ $CURRENT_BG != 'NONE' && $2 != $CURRENT_BG ]]; then
# Middle segment
echo -n "%{$bg%F{$CURRENT_BG}%}$LEFT_SEGMENT_SEPARATOR%{$fg%} " echo -n "%{$bg%F{$CURRENT_BG}%}$LEFT_SEGMENT_SEPARATOR%{$fg%} "
else else
# First segment
echo -n "%{$bg%}%{$fg%} " echo -n "%{$bg%}%{$fg%} "
fi fi
CURRENT_BG=$2 CURRENT_BG=$2
[[ -n $4 ]] && echo -n $4 [[ -n $4 ]] && echo -n "$4 "
} }
# End the left prompt, closing any open segments # End the left prompt, closing any open segments
@ -301,7 +303,7 @@ right_prompt_segment() {
[[ -n $2 ]] && bg="%K{$2}" || bg="%k" [[ -n $2 ]] && bg="%K{$2}" || bg="%k"
[[ -n $3 ]] && fg="%F{$3}" || fg="%f" [[ -n $3 ]] && fg="%F{$3}" || fg="%f"
echo -n "%f%F{$2}$RIGHT_SEGMENT_SEPARATOR%f%{$bg%}%{$fg%} " echo -n "%f%F{$2}$RIGHT_SEGMENT_SEPARATOR%f%{$bg%}%{$fg%} "
[[ -n $4 ]] && echo -n $4 [[ -n $4 ]] && echo -n "$4 "
} }
################################################################ ################################################################
@ -523,7 +525,7 @@ prompt_time() {
time_format=$POWERLEVEL9K_TIME_FORMAT time_format=$POWERLEVEL9K_TIME_FORMAT
fi fi
$1_prompt_segment $0 $DEFAULT_COLOR_INVERTED $DEFAULT_COLOR "$time_format " $1_prompt_segment $0 $DEFAULT_COLOR_INVERTED $DEFAULT_COLOR $time_format
} }
# Virtualenv: current working virtualenv # Virtualenv: current working virtualenv

Loading…
Cancel
Save