add locale safety and user check

This commit is contained in:
Matt Hamilton 2015-12-18 10:11:49 -05:00
parent 3e6785c993
commit a08039ca4a

View File

@ -22,6 +22,8 @@ CURRENT_BG='NONE'
PRIMARY_FG=black PRIMARY_FG=black
# Characters # Characters
function {
local LC_ALL="" LC_CTYPE="en_US.UTF-8"
SEGMENT_SEPARATOR="\ue0b0" SEGMENT_SEPARATOR="\ue0b0"
PLUSMINUS="\u00b1" PLUSMINUS="\u00b1"
BRANCH="\ue0a0" BRANCH="\ue0a0"
@ -29,6 +31,7 @@ DETACHED="\u27a6"
CROSS="\u2718" CROSS="\u2718"
LIGHTNING="\u26a1" LIGHTNING="\u26a1"
GEAR="\u2699" GEAR="\u2699"
}
# Begin a segment # Begin a segment
# Takes two arguments, background and foreground. Both can be omitted, # Takes two arguments, background and foreground. Both can be omitted,
@ -62,8 +65,8 @@ prompt_end() {
# Context: user@hostname (who am I and where am I) # Context: user@hostname (who am I and where am I)
prompt_context() { prompt_context() {
if [[ ${USERNAME} != ${DEFAULT_USER} || -n ${SSH_CONNECTION} ]]; then if [[ ${USER} != ${DEFAULT_USER} || -n ${SSH_CONNECTION} ]]; then
prompt_segment ${PRIMARY_FG} default " %(!.%{%F{yellow}%}.)${USERNAME}@%m " prompt_segment ${PRIMARY_FG} default " %(!.%{%F{yellow}%}.)${USER}@%m "
fi fi
} }