1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-12-20 06:21:58 +00:00

add POWERLEVEL9K_ICON_BEFORE_CONTENT

This commit is contained in:
romkatv 2019-07-21 19:43:14 +02:00
parent 8300a1e363
commit 66d09d6f31

View file

@ -345,12 +345,14 @@ left_prompt_segment() {
p+='}+}' p+='}+}'
p+='${${_P9K_E:#00}:+' p+='${${_P9K_E:#00}:+${${_P9K_T[$_P9K_N]/'$ss'/$_P9K_SS}/'$s'/$_P9K_S}'
_p9k_param $1 ICON_BEFORE_CONTENT ''
if [[ $_P9K_RETVAL != false ]]; then
_p9k_param $1 PREFIX '' _p9k_param $1 PREFIX ''
_P9K_RETVAL=${(g::)_P9K_RETVAL} _P9K_RETVAL=${(g::)_P9K_RETVAL}
_p9k_escape $_P9K_RETVAL _p9k_escape $_P9K_RETVAL
p+="\${\${_P9K_T[\$_P9K_N]/$ss/\$_P9K_SS}/$s/\$_P9K_S}$_P9K_RETVAL" p+=$_P9K_RETVAL
[[ $_P9K_RETVAL == *%* ]] && local -i need_style=1 || local -i need_style=0 [[ $_P9K_RETVAL == *%* ]] && local -i need_style=1 || local -i need_style=0
if (( has_icon != 0 )); then if (( has_icon != 0 )); then
@ -364,13 +366,38 @@ left_prompt_segment() {
if [[ -n $_P9K_RETVAL ]]; then if [[ -n $_P9K_RETVAL ]]; then
_p9k_escape $_P9K_RETVAL _p9k_escape $_P9K_RETVAL
[[ _P9K_RETVAL == *%* ]] && _P9K_RETVAL+=$style_ [[ _P9K_RETVAL == *%* ]] && _P9K_RETVAL+=$style_
p+="\${\${(M)_P9K_E:#11}:+$_P9K_RETVAL}" p+='${${(M)_P9K_E:#11}:+'$_P9K_RETVAL'}'
fi fi
elif (( need_style )); then elif (( need_style )); then
p+=$style_ p+=$style_
fi fi
p+="\${_P9K_C}$style_" p+='${_P9K_C}'$style_
else
_p9k_param $1 PREFIX ''
_P9K_RETVAL=${(g::)_P9K_RETVAL}
_p9k_escape $_P9K_RETVAL
p+=$_P9K_RETVAL
[[ $_P9K_RETVAL == *%* ]] && p+=$style_
p+='${_P9K_C}'$style_
if (( has_icon != 0 )); then
local -i need_style=0
_p9k_get_icon $1 LEFT_MIDDLE_WHITESPACE ' '
if [[ -n $_P9K_RETVAL ]]; then
_p9k_escape $_P9K_RETVAL
[[ $_P9K_RETVAL == *%* ]] && need_style=1
p+='${${(M)_P9K_E:#11}:+'$_P9K_RETVAL'}'
fi
_p9k_color $1 VISUAL_IDENTIFIER_COLOR $fg_color
_p9k_foreground $_P9K_RETVAL
_p9k_escape_rcurly %b$bg$_P9K_RETVAL
[[ $_P9K_RETVAL != $style_ || $need_style == 1 ]] && p+=$_P9K_RETVAL
p+='$_P9K_V'
fi
fi
_p9k_param $1 SUFFIX '' _p9k_param $1 SUFFIX ''
_P9K_RETVAL=${(g::)_P9K_RETVAL} _P9K_RETVAL=${(g::)_P9K_RETVAL}
@ -519,15 +546,17 @@ right_prompt_segment() {
p+='}+}' p+='}+}'
p+='${${_P9K_E:#00}:+' p+='${${_P9K_E:#00}:+${_P9K_T[$_P9K_N]/'$w'/$_P9K_W}'
_p9k_param $1 ICON_BEFORE_CONTENT ''
if [[ $_P9K_RETVAL != true ]]; then
_p9k_param $1 PREFIX '' _p9k_param $1 PREFIX ''
_P9K_RETVAL=${(g::)_P9K_RETVAL} _P9K_RETVAL=${(g::)_P9K_RETVAL}
_p9k_escape $_P9K_RETVAL _p9k_escape $_P9K_RETVAL
p+="\${_P9K_T[\$_P9K_N]/$w/\$_P9K_W}$_P9K_RETVAL" p+=$_P9K_RETVAL
[[ $_P9K_RETVAL == *%* ]] && p+=$style_ [[ $_P9K_RETVAL == *%* ]] && p+=$style_
p+="\${_P9K_C}$style_" p+='${_P9K_C}'$style_
if (( has_icon != 0 )); then if (( has_icon != 0 )); then
local -i need_style=0 local -i need_style=0
@ -535,7 +564,7 @@ right_prompt_segment() {
if [[ -n $_P9K_RETVAL ]]; then if [[ -n $_P9K_RETVAL ]]; then
_p9k_escape $_P9K_RETVAL _p9k_escape $_P9K_RETVAL
[[ $_P9K_RETVAL == *%* ]] && need_style=1 [[ $_P9K_RETVAL == *%* ]] && need_style=1
p+="\${\${(M)_P9K_E:#11}:+$_P9K_RETVAL}" p+='${${(M)_P9K_E:#11}:+'$_P9K_RETVAL'}'
fi fi
_p9k_color $1 VISUAL_IDENTIFIER_COLOR $fg_color _p9k_color $1 VISUAL_IDENTIFIER_COLOR $fg_color
@ -544,6 +573,32 @@ right_prompt_segment() {
[[ $_P9K_RETVAL != $style_ || $need_style == 1 ]] && p+=$_P9K_RETVAL [[ $_P9K_RETVAL != $style_ || $need_style == 1 ]] && p+=$_P9K_RETVAL
p+='$_P9K_V' p+='$_P9K_V'
fi fi
else
_p9k_param $1 PREFIX ''
_P9K_RETVAL=${(g::)_P9K_RETVAL}
_p9k_escape $_P9K_RETVAL
p+=$_P9K_RETVAL
[[ $_P9K_RETVAL == *%* ]] && local -i need_style=1 || local -i need_style=0
if (( has_icon != 0 )); then
_p9k_color $1 VISUAL_IDENTIFIER_COLOR $fg_color
_p9k_foreground $_P9K_RETVAL
_p9k_escape_rcurly %b$bg$_P9K_RETVAL
[[ $_P9K_RETVAL != $style_ || $need_style == 1 ]] && p+=$_P9K_RETVAL
p+='${_P9K_V}'
_p9k_get_icon $1 RIGHT_MIDDLE_WHITESPACE ' '
if [[ -n $_P9K_RETVAL ]]; then
_p9k_escape $_P9K_RETVAL
[[ _P9K_RETVAL == *%* ]] && _P9K_RETVAL+=$style_
p+='${${(M)_P9K_E:#11}:+'$_P9K_RETVAL'}'
fi
elif (( need_style )); then
p+=$style_
fi
p+='${_P9K_C}'$style_
fi
_p9k_param $1 SUFFIX '' _p9k_param $1 SUFFIX ''
_P9K_RETVAL=${(g::)_P9K_RETVAL} _P9K_RETVAL=${(g::)_P9K_RETVAL}