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,13 +22,16 @@ CURRENT_BG='NONE'
PRIMARY_FG=black
# Characters
SEGMENT_SEPARATOR="\ue0b0"
PLUSMINUS="\u00b1"
BRANCH="\ue0a0"
DETACHED="\u27a6"
CROSS="\u2718"
LIGHTNING="\u26a1"
GEAR="\u2699"
function {
local LC_ALL="" LC_CTYPE="en_US.UTF-8"
SEGMENT_SEPARATOR="\ue0b0"
PLUSMINUS="\u00b1"
BRANCH="\ue0a0"
DETACHED="\u27a6"
CROSS="\u2718"
LIGHTNING="\u26a1"
GEAR="\u2699"
}
# Begin a segment
# 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)
prompt_context() {
if [[ ${USERNAME} != ${DEFAULT_USER} || -n ${SSH_CONNECTION} ]]; then
prompt_segment ${PRIMARY_FG} default " %(!.%{%F{yellow}%}.)${USERNAME}@%m "
if [[ ${USER} != ${DEFAULT_USER} || -n ${SSH_CONNECTION} ]]; then
prompt_segment ${PRIMARY_FG} default " %(!.%{%F{yellow}%}.)${USER}@%m "
fi
}