aboutsummaryrefslogtreecommitdiff
path: root/powerlevel9k.zsh-theme
diff options
context:
space:
mode:
authorBen Hilburn <bhilburn@gmail.com>2016-05-27 18:55:04 +0300
committerBen Hilburn <bhilburn@gmail.com>2016-05-27 18:55:04 +0300
commitcef8c65586c92a6c696b497c0d4ddd6610db203e (patch)
tree0752f704fc26c0712e0623fd6e984aa548b9e014 /powerlevel9k.zsh-theme
parent0b57ee3669dd2d6d536ecff116345a929f6b068c (diff)
parent89fdfa0148fe1c3360a9e2d09fe0f7a5e9b0ceec (diff)
Merge pull request #268 from mateusmedeiros/hide-custom-segment-when-empty
Make prompt_custom not print the segment if empty
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-xpowerlevel9k.zsh-theme5
1 files changed, 4 insertions, 1 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index bf313b85..d5c2c8bb 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -444,8 +444,11 @@ prompt_context() {
# the output in a segment.
prompt_custom() {
local command=POWERLEVEL9K_CUSTOM_$3:u
+ local segment_content="$(eval ${(P)command})"
- "$1_prompt_segment" "${0}_${3:u}" "$2" $DEFAULT_COLOR_INVERTED $DEFAULT_COLOR "$(eval ${(P)command})"
+ if [[ -n $segment_content ]]; then
+ "$1_prompt_segment" "${0}_${3:u}" "$2" $DEFAULT_COLOR_INVERTED $DEFAULT_COLOR "$segment_content"
+ fi
}
# Dir: current working directory