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

View File

@ -1,5 +1,18 @@
# My mess of various themes # 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() { prompt_context() {
if [ -n "$SSH_CLIENT" ] if [ -n "$SSH_CLIENT" ]
then then
@ -14,7 +27,7 @@ rprompt_git() {
ref=${vcs_info_msg_0_} ref=${vcs_info_msg_0_}
if [[ -n ${ref} ]]; then if [[ -n ${ref} ]]; then
if test -n "$(git status --porcelain --ignore-submodules)"; then if test -n "$(git status --porcelain --ignore-submodules)"; then
print '%F{yellow}\u00b1%f' print '%F{yellow}'$GIT_DIRTY_CHAR'%f'
fi fi
fi fi
} }
@ -37,14 +50,6 @@ prompt_git() {
} }
prompt_prefix() { 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 " print "%(!. %B%F{red}#%f%b.)%B%F{cyan}${PREFIX}%f%b "
} }
@ -84,7 +89,7 @@ function prompt_fred_setup {
# Define prompts. # Define prompts.
PROMPT='$(prompt_context)%F{cyan} %${PWDWIDTH}<..<%~%f$(prompt_git)$(prompt_prefix)' 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]? ' SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? '
} }