1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-16 09:50:06 +00:00

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.

This commit is contained in:
Dominik Ritter 2015-06-06 18:18:35 +02:00
parent d65aea3a64
commit 86db273188

View file

@ -263,12 +263,14 @@ left_prompt_segment() {
[[ -n $2 ]] && bg="%K{$2}" || bg="%k"
[[ -n $3 ]] && fg="%F{$3}" || fg="%f"
if [[ $CURRENT_BG != 'NONE' && $2 != $CURRENT_BG ]]; then
# Middle segment
echo -n "%{$bg%F{$CURRENT_BG}%}$LEFT_SEGMENT_SEPARATOR%{$fg%} "
else
# First segment
echo -n "%{$bg%}%{$fg%} "
fi
CURRENT_BG=$2
[[ -n $4 ]] && echo -n $4
[[ -n $4 ]] && echo -n "$4 "
}
# End the left prompt, closing any open segments
@ -301,7 +303,7 @@ right_prompt_segment() {
[[ -n $2 ]] && bg="%K{$2}" || bg="%k"
[[ -n $3 ]] && fg="%F{$3}" || fg="%f"
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
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