# vim: fileencoding=utf-8 ft=zsh noet sw=4 ts=4 sts=4
setopt PROMPT_SUBST
# vi mode indicaton
typeset -g -A psvmodetext
if [[ ${LC_ALL:-${LC_MESSAGES:-$LANG}} == *.UTF-8 ]]; then
if (($UID)); then
PROMPT_CHAR='▷'
else
PROMPT_CHAR='▶'
fi
else
if (($UID)); then
PROMPT_CHAR='%%'
else
PROMPT_CHAR='#'
fi
fi
prompt_base='${prompt_color_user}%n${prompt_color_host}@%m%k ${prompt_color_dir}${psvar[1]}%1~'
PS1="%(?..\${prompt_color_errno}<%?>)%(1j.\${prompt_color_jobs}{%j}.)$prompt_base \${PROMPT_CHAR}%b%f%k "
PS2="$prompt_base %_> %b%f%k"
PS3="$prompt_base ?# %b%f%k"
RPROMPT='${vcs_info_msg_0_}${vcs_info_msg_home}'
prompt_color_host="%b%F{green}"
prompt_color_jobs="%b%F{cyan}"
prompt_color_errno="%B%F{yellow}"
prompt_color_dir="%B%F{yellow}"
if [[ $terminfo[colors] == 256 ]]; then
autoload string_hash_color
prompt_color_host="%b%F{$(string_hash_color $HOST)}"
prompt_color_errno="%b%F{214}"
prompt_color_dir="%b%F{214}"
fi
prompt_color_user=$prompt_color_host
if [[ $UID -eq 0 ]]; then
prompt_color_dir="%B%F{red}"
fi
# colorful vi mode indication, powerline-style
if [[ $terminfo[colors] -ge 8 ]]; then
psvmodetext[i]=''
psvmodetext[c]='%K{green}%F{black}'
psvmodetext[r]='%K{red}%F{black}'
psvmodetext[im]="${psvmodetext[i]}[m] "
psvmodetext[cm]="${psvmodetext[c]}[m] "
fi
autoload -Uz ft_vi_promptinit
ft_vi_promptinit