From 6306de05bb926e2fb5e528c22b0b9e095700ba07 Mon Sep 17 00:00:00 2001 From: Michael Cornell Date: Thu, 24 Sep 2015 11:43:29 -0400 Subject: [PATCH] line sep responds to changes after source --- bullet-train.zsh-theme | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/bullet-train.zsh-theme b/bullet-train.zsh-theme index 9bebc20..9b0c6dc 100644 --- a/bullet-train.zsh-theme +++ b/bullet-train.zsh-theme @@ -436,6 +436,13 @@ prompt_char() { echo -n $bt_prompt_char } +# Prompt Line Separator +prompt_line_sep() { + if [[ $BULLETTRAIN_PROMPT_SEP_LINE == true ]]; then + # newline wont print without a non newline character, so add a zero-width space + echo -e '\n\u200B' + fi +} # ------------------------------------------------------------------------------ # MAIN # Entry point @@ -455,10 +462,4 @@ build_prompt() { prompt_end } -if [[ $BULLETTRAIN_PROMPT_SEPARATE_LINE == true ]] then - PROMPT=' -%{%f%b%k%}$(build_prompt) -%{${fg_bold[default]}%}$(prompt_char) %{$reset_color%}' -else - PROMPT='%{%f%b%k%}$(build_prompt)%{${fg_bold[default]}%} $(prompt_char) %{$reset_color%}' -fi +PROMPT='$(prompt_line_sep)%{%f%b%k%}$(build_prompt)$(prompt_line_sep)%{${fg_bold[default]}%}$(prompt_char) %{$reset_color%}'