Don't use unicode when it isn't availible

This commit is contained in:
Adam Goldsmith 2016-07-19 04:14:41 +00:00
parent 4042b68e9b
commit 28e8bcc626
1 changed files with 15 additions and 10 deletions

View File

@ -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]? '
}