summaryrefslogtreecommitdiff
path: root/powerlevel9k.zsh-theme
diff options
context:
space:
mode:
authorDominik Ritter <dritter03@googlemail.com>2015-06-06 19:18:35 +0300
committerDominik Ritter <dritter03@googlemail.com>2015-06-06 19:18:35 +0300
commit86db2731886c6c8882cb6b3f1fd9c5bf94d94632 (patch)
tree5d35dd4a3b5040815ba65d8f2fd17194e90dbc94 /powerlevel9k.zsh-theme
parentd65aea3a64f125b9f9768218a9165b591d49e46c (diff)
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.
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rw-r--r--powerlevel9k.zsh-theme20
1 files changed, 11 insertions, 9 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index a02e9d4b..800faec9 100644
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -263,22 +263,24 @@ 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
left_prompt_end() {
if [[ -n $CURRENT_BG ]]; then
- echo -n " %{%k%F{$CURRENT_BG}%}$LEFT_SEGMENT_SEPARATOR"
+ echo -n "%{%k%F{$CURRENT_BG}%}$LEFT_SEGMENT_SEPARATOR"
else
- echo -n " %{%k%}"
+ echo -n "%{%k%}"
fi
- echo -n "%{%f%}"
+ echo -n "%{%f%} "
CURRENT_BG=''
}
@@ -300,8 +302,8 @@ right_prompt_segment() {
local bg fg
[[ -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
+ echo -n "%f%F{$2}$RIGHT_SEGMENT_SEPARATOR%f%{$bg%}%{$fg%} "
+ [[ -n $4 ]] && echo -n "$4 "
}
################################################################
@@ -317,7 +319,7 @@ prompt_vcs() {
$1_prompt_segment $0 green $DEFAULT_COLOR
fi
- echo -n "%F{$VCS_FOREGROUND_COLOR}%f$vcs_prompt"
+ echo -n "%F{$VCS_FOREGROUND_COLOR}%f$vcs_prompt "
fi
}
@@ -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
@@ -583,7 +585,7 @@ if [[ "$POWERLEVEL9K_PROMPT_ON_NEWLINE" == true ]]; then
RPROMPT_PREFIX='%{'$'\e[1A''%}' # one line up
RPROMPT_SUFFIX='%{'$'\e[1B''%}' # one line down
else
- PROMPT='%{%f%b%k%}$(build_left_prompt) '
+ PROMPT='%{%f%b%k%}$(build_left_prompt)'
RPROMPT_PREFIX=''
RPROMPT_SUFFIX=''
fi