From 28e8bcc626a99273fd5020f9b8d69c83b630faea Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Tue, 19 Jul 2016 04:14:41 +0000 Subject: [PATCH] Don't use unicode when it isn't availible --- prompt_fred_setup | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/prompt_fred_setup b/prompt_fred_setup index 94df4de..24a718a 100644 --- a/prompt_fred_setup +++ b/prompt_fred_setup @@ -1,5 +1,18 @@ # My mess of various themes +if [[ $(locale charmap) != UTF-8 || "$TERM" == linux ]] +then + ERROR_CHAR='' + GIT_DIRTY_CHAR='+-' + PREFIX='$' + LCOLOR="" +else + ERROR_CHAR='⏎' + GIT_DIRTY_CHAR="±" + PREFIX="❱" # U+2771 + LCOLOR="$fg_bold[black]" +fi + prompt_context() { if [ -n "$SSH_CLIENT" ] then @@ -14,7 +27,7 @@ rprompt_git() { ref=${vcs_info_msg_0_} if [[ -n ${ref} ]]; then if test -n "$(git status --porcelain --ignore-submodules)"; then - print '%F{yellow}\u00b1%f' + print '%F{yellow}'$GIT_DIRTY_CHAR'%f' fi fi } @@ -37,14 +50,6 @@ prompt_git() { } prompt_prefix() { - if [[ $(locale charmap) != UTF-8 || "$TERM" == linux ]] - then - PREFIX='$' - LCOLOR="" - else - PREFIX="❱" # U+2771 - LCOLOR="$fg_bold[black]" - fi print "%(!. %B%F{red}#%f%b.)%B%F{cyan}${PREFIX}%f%b " } @@ -84,7 +89,7 @@ function prompt_fred_setup { # Define prompts. PROMPT='$(prompt_context)%F{cyan} %${PWDWIDTH}<..<%~%f$(prompt_git)$(prompt_prefix)' - RPROMPT='${editor_info[overwrite]}%(?:: %F{red}%?⏎%f) $(rprompt_git)' + RPROMPT='${editor_info[overwrite]}%(?:: %F{red}%?'$ERROR_CHAR'%f) $(rprompt_git)' SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? ' }