mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-12-12 19:18:28 +02:00
wip: some more churn on dynamic stuff
This commit is contained in:
parent
d9c587a8d7
commit
0e95c532ea
14
dynamic.txt
14
dynamic.txt
@ -70,6 +70,20 @@ function p10k-on-pre-prompt() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
${_p9k__'$_p9k_line_index'r-'$right'}
|
||||||
|
|
||||||
function p10k-on-post-prompt() {
|
function p10k-on-post-prompt() {
|
||||||
p10k display line1=hide right=hide segment:time=show
|
p10k display line1=hide right=hide segment:time=show
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TODO: support -1/left
|
||||||
|
TODO: hiding gap kills right prompt; this is bad; implement it like ruler, with 3 values in _p9k_t?
|
||||||
|
TODO: add 1/right/frame
|
||||||
|
|
||||||
|
empty_line
|
||||||
|
ruler
|
||||||
|
1
|
||||||
|
1/gap
|
||||||
|
1/left
|
||||||
|
1/right
|
||||||
|
1/right/time
|
||||||
|
@ -616,7 +616,7 @@ _p9k_left_prompt_segment() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
p+="\${_p9k_c::=$content_exp_}"
|
p+="\${_p9k_c::=$content_exp_}"
|
||||||
p+='${_p9k_e::=${${${__p9k_display[s/'${${1#prompt_}%%[A-Z_]#}']:#show}:+00}:-'
|
p+='${_p9k_e::=${${_p9k__'${_p9k_line_index}l${${1#prompt_}%%[A-Z_]#}'+00}:-'
|
||||||
if (( has_icon == -1 )); then
|
if (( has_icon == -1 )); then
|
||||||
p+='${${(%):-$_p9k_c%1(l.1.0)}[-1]}${${(%):-$_p9k_v%1(l.1.0)}[-1]}}'
|
p+='${${(%):-$_p9k_c%1(l.1.0)}[-1]}${${(%):-$_p9k_v%1(l.1.0)}[-1]}}'
|
||||||
else
|
else
|
||||||
@ -837,7 +837,7 @@ _p9k_right_prompt_segment() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
p+="\${_p9k_c::=$content_exp_}"
|
p+="\${_p9k_c::=$content_exp_}"
|
||||||
p+='${_p9k_e::=${${${__p9k_display[s/'${${1#prompt_}%%[A-Z_]#}']:#show}:+00}:-'
|
p+='${_p9k_e::=${${_p9k__'${_p9k_line_index}r${${1#prompt_}%%[A-Z_]#}'+00}:-'
|
||||||
if (( has_icon == -1 )); then
|
if (( has_icon == -1 )); then
|
||||||
p+='${${(%):-$_p9k_c%1(l.1.0)}[-1]}${${(%):-$_p9k_v%1(l.1.0)}[-1]}}'
|
p+='${${(%):-$_p9k_c%1(l.1.0)}[-1]}${${(%):-$_p9k_v%1(l.1.0)}[-1]}}'
|
||||||
else
|
else
|
||||||
@ -3465,38 +3465,38 @@ function _p9k_set_prompt() {
|
|||||||
|
|
||||||
(( _p9k_fetch_iface )) && _p9k_set_iface
|
(( _p9k_fetch_iface )) && _p9k_set_iface
|
||||||
|
|
||||||
local -i left_idx=1 right_idx=1 num_lines=$#_p9k_line_segments_left i
|
local -i left_idx=1 right_idx=1 num_lines=$#_p9k_line_segments_left
|
||||||
for i in {1..$num_lines}; do
|
for _p9k_line_index in {1..$num_lines}; do
|
||||||
local right=
|
local right=
|
||||||
if (( !_POWERLEVEL9K_DISABLE_RPROMPT )); then
|
if (( !_POWERLEVEL9K_DISABLE_RPROMPT )); then
|
||||||
_p9k_dir=
|
_p9k_dir=
|
||||||
_p9k__prompt=
|
_p9k__prompt=
|
||||||
_p9k_segment_index=right_idx
|
_p9k_segment_index=right_idx
|
||||||
_p9k_prompt_side=right
|
_p9k_prompt_side=right
|
||||||
for _p9k_segment_name in ${(@0)_p9k_line_segments_right[i]}; do
|
for _p9k_segment_name in ${(@0)_p9k_line_segments_right[_p9k_line_index]}; do
|
||||||
_p9k_build_${1}segment
|
_p9k_build_${1}segment
|
||||||
done
|
done
|
||||||
_p9k__prompt=${${_p9k__prompt//$' %{\b'/'%{%G'}//$' \b'}
|
_p9k__prompt=${${_p9k__prompt//$' %{\b'/'%{%G'}//$' \b'}
|
||||||
right_idx=_p9k_segment_index
|
right_idx=_p9k_segment_index
|
||||||
if [[ -n $_p9k__prompt || $_p9k_line_never_empty_right[i] == 1 ]]; then
|
if [[ -n $_p9k__prompt || $_p9k_line_never_empty_right[_p9k_line_index] == 1 ]]; then
|
||||||
right=$_p9k_line_prefix_right[i]$_p9k__prompt$_p9k_line_suffix_right[i]
|
right=$_p9k_line_prefix_right[_p9k_line_index]$_p9k__prompt$_p9k_line_suffix_right[_p9k_line_index]
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
unset _p9k_dir
|
unset _p9k_dir
|
||||||
_p9k__prompt=$_p9k_line_prefix_left[i]
|
_p9k__prompt=$_p9k_line_prefix_left[_p9k_line_index]
|
||||||
_p9k_segment_index=left_idx
|
_p9k_segment_index=left_idx
|
||||||
_p9k_prompt_side=left
|
_p9k_prompt_side=left
|
||||||
for _p9k_segment_name in ${(@0)_p9k_line_segments_left[i]}; do
|
for _p9k_segment_name in ${(@0)_p9k_line_segments_left[_p9k_line_index]}; do
|
||||||
_p9k_build_${1}segment
|
_p9k_build_${1}segment
|
||||||
done
|
done
|
||||||
_p9k__prompt=${${_p9k__prompt//$' %{\b'/'%{%G'}//$' \b'}
|
_p9k__prompt=${${_p9k__prompt//$' %{\b'/'%{%G'}//$' \b'}
|
||||||
left_idx=_p9k_segment_index
|
left_idx=_p9k_segment_index
|
||||||
_p9k__prompt+=$_p9k_line_suffix_left[i]
|
_p9k__prompt+=$_p9k_line_suffix_left[_p9k_line_index]
|
||||||
if (( $+_p9k_dir || (i != num_lines && $#right) )); then
|
if (( $+_p9k_dir || (_p9k_line_index != num_lines && $#right) )); then
|
||||||
_p9k__prompt='${${:-${_p9k_d::=0}${_p9k_rprompt::=${__p9k_x_right-'$right'}}${_p9k_lprompt::='$_p9k__prompt'}}+}'
|
_p9k__prompt='${${:-${_p9k_d::=0}${_p9k_rprompt::='$right'}${_p9k_lprompt::='$_p9k__prompt'}}+}'
|
||||||
_p9k__prompt+=$_p9k_gap_pre
|
_p9k__prompt+=$_p9k_gap_pre
|
||||||
if (( $+_p9k_dir )); then
|
if (( $+_p9k_dir )); then
|
||||||
if (( i == num_lines && (_POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS > 0 || _POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT > 0) )); then
|
if (( _p9k_line_index == num_lines && (_POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS > 0 || _POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT > 0) )); then
|
||||||
local a=$_POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS
|
local a=$_POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS
|
||||||
local f=$((0.01*_POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT))'*_p9k_clm'
|
local f=$((0.01*_POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT))'*_p9k_clm'
|
||||||
_p9k__prompt+="\${\${_p9k_g::=$((($a<$f)*$f+($a>=$f)*$a))}+}"
|
_p9k__prompt+="\${\${_p9k_g::=$((($a<$f)*$f+($a>=$f)*$a))}+}"
|
||||||
@ -3521,15 +3521,15 @@ function _p9k_set_prompt() {
|
|||||||
else
|
else
|
||||||
_p9k__prompt+='${_p9k_lprompt}'
|
_p9k__prompt+='${_p9k_lprompt}'
|
||||||
fi
|
fi
|
||||||
((i != num_lines && $#right)) && _p9k__prompt+=$_p9k_line_gap_post[i]
|
((_p9k_line_index != num_lines && $#right)) && _p9k__prompt+=$_p9k_line_gap_post[_p9k_line_index]
|
||||||
fi
|
fi
|
||||||
if (( i == num_lines )); then
|
if (( _p9k_line_index == num_lines )); then
|
||||||
[[ -n $right ]] && RPROMPT='${__p9k_x_right-'$_p9k_prompt_prefix_right$right$_p9k_prompt_suffix_right'}'
|
[[ -n $right ]] && RPROMPT=$_p9k_prompt_prefix_right$right$_p9k_prompt_suffix_right
|
||||||
_p9k__prompt+=$_p9k_prompt_suffix_left
|
_p9k__prompt='${_p9k__'$_p9k_line_index'-'$_p9k__prompt'}'$_p9k_prompt_suffix_left
|
||||||
[[ $1 == instant_ ]] || PROMPT+=$_p9k__prompt
|
[[ $1 == instant_ ]] || PROMPT+=$_p9k__prompt
|
||||||
else
|
else
|
||||||
PROMPT+=$_p9k__prompt
|
[[ -n $right ]] || _p9k__prompt+=$'\n'
|
||||||
[[ -n $right ]] || PROMPT+=$'\n'
|
PROMPT+='${_p9k__'$_p9k_line_index'-'$_p9k__prompt'}'
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -3579,6 +3579,7 @@ _p9k_dump_instant_prompt() {
|
|||||||
local cr=\$'\r' lf=\$'\n' esc=\$'\e[' rs=$'\x1e' us=$'\x1f'
|
local cr=\$'\r' lf=\$'\n' esc=\$'\e[' rs=$'\x1e' us=$'\x1f'
|
||||||
local -i height=$_POWERLEVEL9K_INSTANT_PROMPT_COMMAND_LINES
|
local -i height=$_POWERLEVEL9K_INSTANT_PROMPT_COMMAND_LINES
|
||||||
local prompt_dir=${(q)prompt_dir}
|
local prompt_dir=${(q)prompt_dir}
|
||||||
|
local -i _p9k__empty_line_i=3 _p9k__ruler_i=3
|
||||||
zmodload zsh/langinfo
|
zmodload zsh/langinfo
|
||||||
if [[ \${langinfo[CODESET]:-} != (utf|UTF)(-|)8 ]]; then
|
if [[ \${langinfo[CODESET]:-} != (utf|UTF)(-|)8 ]]; then
|
||||||
local lc=${(q)${${${_p9k_locale:-${(M)LC_CTYPE:#*.(utf|UTF)(-|)8}}:-${(M)LC_ALL:#*.(utf|UTF)(-|)8}}}:-${(M)LANG:#*.(utf|UTF)(-|)8}}
|
local lc=${(q)${${${_p9k_locale:-${(M)LC_CTYPE:#*.(utf|UTF)(-|)8}}:-${(M)LC_ALL:#*.(utf|UTF)(-|)8}}}:-${(M)LANG:#*.(utf|UTF)(-|)8}}
|
||||||
@ -3587,7 +3588,10 @@ _p9k_dump_instant_prompt() {
|
|||||||
>&$fd print -r -- '
|
>&$fd print -r -- '
|
||||||
zmodload zsh/terminfo
|
zmodload zsh/terminfo
|
||||||
(( $+terminfo[cuu] && $+terminfo[cuf] && $+terminfo[ed] && $+terminfo[sc] && $+terminfo[rc] )) || return
|
(( $+terminfo[cuu] && $+terminfo[cuf] && $+terminfo[ed] && $+terminfo[sc] && $+terminfo[rc] )) || return
|
||||||
local -A __p9k_display
|
function p10k() {
|
||||||
|
emulate -L zsh
|
||||||
|
# TODO
|
||||||
|
}
|
||||||
local pwd=${(%):-%/}
|
local pwd=${(%):-%/}
|
||||||
local prompt_file=$prompt_dir/prompt-${#pwd}
|
local prompt_file=$prompt_dir/prompt-${#pwd}
|
||||||
local key=$pwd:$ssh:${(%):-%#}
|
local key=$pwd:$ssh:${(%):-%#}
|
||||||
@ -3596,8 +3600,6 @@ _p9k_dump_instant_prompt() {
|
|||||||
local tail=${content##*$rs$key$us}
|
local tail=${content##*$rs$key$us}
|
||||||
[[ ${#tail} != ${#content} ]] || return
|
[[ ${#tail} != ${#content} ]] || return
|
||||||
local -a _p9k_t=("${(@ps:$us:)${tail%%$rs*}}")'
|
local -a _p9k_t=("${(@ps:$us:)${tail%%$rs*}}")'
|
||||||
(( __p9k_ksh_arrays )) && >&$fd print -r -- ' setopt ksh_arrays'
|
|
||||||
(( __p9k_sh_glob )) && >&$fd print -r -- ' setopt sh_glob'
|
|
||||||
if [[ $+VTE_VERSION == 1 || $TERM_PROGRAM == Hyper ]]; then
|
if [[ $+VTE_VERSION == 1 || $TERM_PROGRAM == Hyper ]]; then
|
||||||
if [[ $TERM_PROGRAM == Hyper ]]; then
|
if [[ $TERM_PROGRAM == Hyper ]]; then
|
||||||
local bad_lines=40 bad_columns=100
|
local bad_lines=40 bad_columns=100
|
||||||
@ -3605,6 +3607,7 @@ _p9k_dump_instant_prompt() {
|
|||||||
local bad_lines=24 bad_columns=80
|
local bad_lines=24 bad_columns=80
|
||||||
fi
|
fi
|
||||||
>&$fd print -r -- '
|
>&$fd print -r -- '
|
||||||
|
local -i tty_size_known=1
|
||||||
if (( LINES == '$bad_lines' && COLUMNS == '$bad_columns' )); then
|
if (( LINES == '$bad_lines' && COLUMNS == '$bad_columns' )); then
|
||||||
zmodload -F zsh/stat b:zstat
|
zmodload -F zsh/stat b:zstat
|
||||||
zmodload zsh/datetime
|
zmodload zsh/datetime
|
||||||
@ -3615,9 +3618,8 @@ _p9k_dump_instant_prompt() {
|
|||||||
local tty_size
|
local tty_size
|
||||||
while true; do
|
while true; do
|
||||||
if (( EPOCHREALTIME > deadline )) || ! tty_size="$(/bin/stty size 2>/dev/null)" || [[ $tty_size != <->" "<-> ]]; then
|
if (( EPOCHREALTIME > deadline )) || ! tty_size="$(/bin/stty size 2>/dev/null)" || [[ $tty_size != <->" "<-> ]]; then
|
||||||
local __p9k_x_ruler=
|
p10k display ruler=hide "*/gap"=hide "*/right"=hide
|
||||||
local __p9k_x_gap=
|
tty_size_known=0
|
||||||
local __p9k_x_right=
|
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
if [[ $tty_size != "'$bad_lines' '$bad_columns'" ]]; then
|
if [[ $tty_size != "'$bad_lines' '$bad_columns'" ]]; then
|
||||||
@ -3630,6 +3632,8 @@ _p9k_dump_instant_prompt() {
|
|||||||
fi
|
fi
|
||||||
fi'
|
fi'
|
||||||
fi
|
fi
|
||||||
|
(( __p9k_ksh_arrays )) && >&$fd print -r -- ' setopt ksh_arrays'
|
||||||
|
(( __p9k_sh_glob )) && >&$fd print -r -- ' setopt sh_glob'
|
||||||
>&$fd print -r -- ' typeset -ga __p9k_used_instant_prompt=("${(@e)_p9k_t[-3,-1]}")'
|
>&$fd print -r -- ' typeset -ga __p9k_used_instant_prompt=("${(@e)_p9k_t[-3,-1]}")'
|
||||||
(( __p9k_ksh_arrays )) && >&$fd print -r -- ' unsetopt ksh_arrays'
|
(( __p9k_ksh_arrays )) && >&$fd print -r -- ' unsetopt ksh_arrays'
|
||||||
(( __p9k_sh_glob )) && >&$fd print -r -- ' unsetopt sh_glob'
|
(( __p9k_sh_glob )) && >&$fd print -r -- ' unsetopt sh_glob'
|
||||||
@ -3653,7 +3657,7 @@ _p9k_dump_instant_prompt() {
|
|||||||
_p9k_ret=$x
|
_p9k_ret=$x
|
||||||
}
|
}
|
||||||
local out'
|
local out'
|
||||||
[[ $+VTE_VERSION == 1 || $TERM_PROGRAM == Hyper ]] && >&$fd print -r -- ' if (( ! $+__p9k_x_gap )); then'
|
[[ $+VTE_VERSION == 1 || $TERM_PROGRAM == Hyper ]] && >&$fd print -r -- ' if (( tty_size_known )); then'
|
||||||
>&$fd print -r -- '
|
>&$fd print -r -- '
|
||||||
[[ $PROMPT_EOL_MARK == "%B%S%#%s%b" ]] && _p9k_ret=1 || _p9k_prompt_length $PROMPT_EOL_MARK
|
[[ $PROMPT_EOL_MARK == "%B%S%#%s%b" ]] && _p9k_ret=1 || _p9k_prompt_length $PROMPT_EOL_MARK
|
||||||
local -i fill=$((COLUMNS > _p9k_ret ? COLUMNS - _p9k_ret : 0))
|
local -i fill=$((COLUMNS > _p9k_ret ? COLUMNS - _p9k_ret : 0))
|
||||||
@ -3980,8 +3984,6 @@ function _p9k_maybe_dump() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
typeset -gA __p9k_display
|
|
||||||
|
|
||||||
function _p9k_on_expand() {
|
function _p9k_on_expand() {
|
||||||
(( _p9k__expanded && ! $+__p9k_instant_prompt_active )) && return
|
(( _p9k__expanded && ! $+__p9k_instant_prompt_active )) && return
|
||||||
|
|
||||||
@ -3995,8 +3997,8 @@ function _p9k_on_expand() {
|
|||||||
(( _p9k__expanded )) && return
|
(( _p9k__expanded )) && return
|
||||||
_p9k__expanded=1
|
_p9k__expanded=1
|
||||||
|
|
||||||
[[ $__p9k_display[empty_line] == print ]] && print -rn -- $_p9k_t[_p9k_empty_line_idx]
|
[[ $_p9k__display[empty_line] == print ]] && print -rn -- $_p9k_t[_p9k_empty_line_idx]
|
||||||
if [[ $__p9k_display[ruler] == print ]]; then
|
if [[ $_p9k__display[ruler] == print ]]; then
|
||||||
local ruler=$_p9k_t[_p9k_ruler_idx]
|
local ruler=$_p9k_t[_p9k_ruler_idx]
|
||||||
() {
|
() {
|
||||||
(( __p9k_ksh_arrays )) && setopt ksh_arrays
|
(( __p9k_ksh_arrays )) && setopt ksh_arrays
|
||||||
@ -4029,11 +4031,6 @@ _p9k_precmd_impl() {
|
|||||||
_p9k__expanded=0
|
_p9k__expanded=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (( _p9k__transient_rprompt_active )); then
|
|
||||||
_p9k__transient_rprompt_active=0
|
|
||||||
unset __p9k_x_right __p9k_x_gap
|
|
||||||
fi
|
|
||||||
|
|
||||||
if (( $+_p9k_real_zle_rprompt_indent )); then
|
if (( $+_p9k_real_zle_rprompt_indent )); then
|
||||||
if [[ -n $_p9k_real_zle_rprompt_indent ]]; then
|
if [[ -n $_p9k_real_zle_rprompt_indent ]]; then
|
||||||
ZLE_RPROMPT_INDENT=$_p9k_real_zle_rprompt_indent
|
ZLE_RPROMPT_INDENT=$_p9k_real_zle_rprompt_indent
|
||||||
@ -4353,6 +4350,7 @@ _p9k_init_vars() {
|
|||||||
typeset -g _p9k_prompt_side
|
typeset -g _p9k_prompt_side
|
||||||
typeset -g _p9k_segment_name
|
typeset -g _p9k_segment_name
|
||||||
typeset -gi _p9k_segment_index
|
typeset -gi _p9k_segment_index
|
||||||
|
typeset -gi _p9k_line_index
|
||||||
typeset -g _p9k_refresh_reason
|
typeset -g _p9k_refresh_reason
|
||||||
typeset -gi _p9k__region_active
|
typeset -gi _p9k__region_active
|
||||||
typeset -g _p9k__async_pump_line
|
typeset -g _p9k__async_pump_line
|
||||||
@ -4381,9 +4379,9 @@ _p9k_init_vars() {
|
|||||||
typeset -gi _p9k_g
|
typeset -gi _p9k_g
|
||||||
typeset -gi _p9k_ind
|
typeset -gi _p9k_ind
|
||||||
typeset -g _p9k_gap_pre
|
typeset -g _p9k_gap_pre
|
||||||
typeset -gi _p9k_ruler_i
|
typeset -gi _p9k__ruler_i=3
|
||||||
typeset -gi _p9k_ruler_idx
|
typeset -gi _p9k_ruler_idx
|
||||||
typeset -gi _p9k_empty_line_i
|
typeset -gi _p9k__empty_line_i=3
|
||||||
typeset -gi _p9k_empty_line_idx
|
typeset -gi _p9k_empty_line_idx
|
||||||
typeset -g _p9k_prompt_prefix_left
|
typeset -g _p9k_prompt_prefix_left
|
||||||
typeset -g _p9k_prompt_prefix_right
|
typeset -g _p9k_prompt_prefix_right
|
||||||
@ -4413,8 +4411,8 @@ _p9k_init_vars() {
|
|||||||
typeset -g _p9k_uname
|
typeset -g _p9k_uname
|
||||||
typeset -g _p9k_uname_o
|
typeset -g _p9k_uname_o
|
||||||
typeset -g _p9k_uname_m
|
typeset -g _p9k_uname_m
|
||||||
|
typeset -gA _p9k__display
|
||||||
|
|
||||||
typeset -gi _p9k__transient_rprompt_active
|
|
||||||
typeset -gA _p9k__dotnet_stat_cache
|
typeset -gA _p9k__dotnet_stat_cache
|
||||||
typeset -gA _p9k__dir_stat_cache
|
typeset -gA _p9k__dir_stat_cache
|
||||||
typeset -gi _p9k__expanded
|
typeset -gi _p9k__expanded
|
||||||
@ -4737,12 +4735,7 @@ _p9k_wrap_zle_widget() {
|
|||||||
|
|
||||||
function _p9k_zle_line_finish() {
|
function _p9k_zle_line_finish() {
|
||||||
_p9k__line_finished=
|
_p9k__line_finished=
|
||||||
if [[ -o transient_rprompt ]]; then
|
if (( _p9k_reset_on_line_finish )); then
|
||||||
__p9k_x_right=
|
|
||||||
__p9k_x_gap=
|
|
||||||
_p9k__transient_rprompt_active=1
|
|
||||||
_p9k_reset_prompt
|
|
||||||
elif (( _p9k_reset_on_line_finish )); then
|
|
||||||
_p9k_reset_prompt
|
_p9k_reset_prompt
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -4758,29 +4751,30 @@ function _p9k_zle_line_pre_redraw() {
|
|||||||
prompt__p9k_internal_nothing() { _p9k__prompt+='${_p9k_sss::=}'; }
|
prompt__p9k_internal_nothing() { _p9k__prompt+='${_p9k_sss::=}'; }
|
||||||
instant_prompt__p9k_internal_nothing() { prompt__p9k_internal_nothing; }
|
instant_prompt__p9k_internal_nothing() { prompt__p9k_internal_nothing; }
|
||||||
|
|
||||||
# _p9k_build_gap_post <first|newline>
|
# _p9k_build_gap_post line_number
|
||||||
_p9k_build_gap_post() {
|
_p9k_build_gap_post() {
|
||||||
_p9k_get_icon '' MULTILINE_${(U)1}_PROMPT_GAP_CHAR
|
[[ $1 == 1 ]] && local kind=first || local kind=newline
|
||||||
|
_p9k_get_icon '' MULTILINE_${(U)kind}_PROMPT_GAP_CHAR
|
||||||
local char=${_p9k_ret:- }
|
local char=${_p9k_ret:- }
|
||||||
_p9k_prompt_length $char
|
_p9k_prompt_length $char
|
||||||
if (( _p9k_ret != 1 || $#char != 1 )); then
|
if (( _p9k_ret != 1 || $#char != 1 )); then
|
||||||
print -rP -- "%F{red}WARNING!%f %BMULTILINE_${(U)1}_PROMPT_GAP_CHAR%b is not one character long. Will use ' '."
|
print -rP -- "%F{red}WARNING!%f %BMULTILINE_${(U)kind}_PROMPT_GAP_CHAR%b is not one character long. Will use ' '."
|
||||||
print -rP -- "Either change the value of %BPOWERLEVEL9K_MULTILINE_${(U)1}_PROMPT_GAP_CHAR%b or remove it."
|
print -rP -- "Either change the value of %BPOWERLEVEL9K_MULTILINE_${(U)kind}_PROMPT_GAP_CHAR%b or remove it."
|
||||||
char=' '
|
char=' '
|
||||||
fi
|
fi
|
||||||
local style
|
local style
|
||||||
_p9k_color prompt_multiline_$1_prompt_gap BACKGROUND ""
|
_p9k_color prompt_multiline_${kind}_prompt_gap BACKGROUND ""
|
||||||
[[ -n $_p9k_ret ]] && _p9k_background $_p9k_ret
|
[[ -n $_p9k_ret ]] && _p9k_background $_p9k_ret
|
||||||
style+=$_p9k_ret
|
style+=$_p9k_ret
|
||||||
_p9k_color prompt_multiline_$1_prompt_gap FOREGROUND ""
|
_p9k_color prompt_multiline_${kind}_prompt_gap FOREGROUND ""
|
||||||
[[ -n $_p9k_ret ]] && _p9k_foreground $_p9k_ret
|
[[ -n $_p9k_ret ]] && _p9k_foreground $_p9k_ret
|
||||||
style+=$_p9k_ret
|
style+=$_p9k_ret
|
||||||
_p9k_escape_style $style
|
_p9k_escape_style $style
|
||||||
style=$_p9k_ret
|
style=$_p9k_ret
|
||||||
local exp=POWERLEVEL9K_MULTILINE_${(U)1}_PROMPT_GAP_EXPANSION
|
local exp=POWERLEVEL9K_MULTILINE_${(U)kind}_PROMPT_GAP_EXPANSION
|
||||||
(( $+parameters[$exp] )) && exp=${(P)exp} || exp='${P9K_GAP}'
|
(( $+parameters[$exp] )) && exp=${(P)exp} || exp='${P9K_GAP}'
|
||||||
[[ $char == '.' ]] && local s=',' || local s='.'
|
[[ $char == '.' ]] && local s=',' || local s='.'
|
||||||
_p9k_ret=$'${${__p9k_x_gap+\n}:-'$style'${${${_p9k_m:#-*}:+'
|
_p9k_ret='${${_p9k__'$1$'g+\n}:-'$style'${${${_p9k_m:#-*}:+'
|
||||||
if [[ $exp == '${P9K_GAP}' ]]; then
|
if [[ $exp == '${P9K_GAP}' ]]; then
|
||||||
_p9k_ret+='${(pl'$s'$((_p9k_m+1))'$s$s$char$s$')}'
|
_p9k_ret+='${(pl'$s'$((_p9k_m+1))'$s$s$char$s$')}'
|
||||||
else
|
else
|
||||||
@ -4820,7 +4814,8 @@ _p9k_init_lines() {
|
|||||||
local -i num_lines=num_left_lines
|
local -i num_lines=num_left_lines
|
||||||
fi
|
fi
|
||||||
|
|
||||||
repeat $num_lines; do
|
local -i i
|
||||||
|
for i in {1..$num_lines}; do
|
||||||
local -i left_end=${left_segments[(i)newline]}
|
local -i left_end=${left_segments[(i)newline]}
|
||||||
local -i right_end=${right_segments[(i)newline]}
|
local -i right_end=${right_segments[(i)newline]}
|
||||||
_p9k_line_segments_left+="${(pj:\0:)left_segments[1,left_end-1]}"
|
_p9k_line_segments_left+="${(pj:\0:)left_segments[1,left_end-1]}"
|
||||||
@ -4831,13 +4826,13 @@ _p9k_init_lines() {
|
|||||||
_p9k_get_icon '' LEFT_SEGMENT_SEPARATOR
|
_p9k_get_icon '' LEFT_SEGMENT_SEPARATOR
|
||||||
_p9k_get_icon 'prompt_empty_line' LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL $_p9k_ret
|
_p9k_get_icon 'prompt_empty_line' LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL $_p9k_ret
|
||||||
_p9k_escape $_p9k_ret
|
_p9k_escape $_p9k_ret
|
||||||
_p9k_line_prefix_left+='${${:-${_p9k_bg::=NONE}${_p9k_i::=0}${_p9k_sss::=%f'$_p9k_ret'}}+}'
|
_p9k_line_prefix_left+='${_p9k__'$i'l-${${:-${_p9k_bg::=NONE}${_p9k_i::=0}${_p9k_sss::=%f'$_p9k_ret'}}+}'
|
||||||
_p9k_line_suffix_left+='%b%k$_p9k_sss%b%k%f'
|
_p9k_line_suffix_left+='%b%k$_p9k_sss%b%k%f}'
|
||||||
|
|
||||||
_p9k_escape ${(g::)POWERLEVEL9K_EMPTY_LINE_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL}
|
_p9k_escape ${(g::)POWERLEVEL9K_EMPTY_LINE_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL}
|
||||||
[[ -n $_p9k_ret ]] && _p9k_line_never_empty_right+=1 || _p9k_line_never_empty_right+=0
|
[[ -n $_p9k_ret ]] && _p9k_line_never_empty_right+=1 || _p9k_line_never_empty_right+=0
|
||||||
_p9k_line_prefix_right+='${${:-${_p9k_bg::=NONE}${_p9k_i::=0}${_p9k_sss::='$_p9k_ret'}}+}'
|
_p9k_line_prefix_right+='${_p9k__'$i'r-${${:-${_p9k_bg::=NONE}${_p9k_i::=0}${_p9k_sss::='$_p9k_ret'}}+}'
|
||||||
_p9k_line_suffix_right+='$_p9k_sss%b%k%f' # gets overridden for _p9k_emulate_zero_rprompt_indent
|
_p9k_line_suffix_right+='$_p9k_sss%b%k%f}' # gets overridden for _p9k_emulate_zero_rprompt_indent
|
||||||
done
|
done
|
||||||
|
|
||||||
_p9k_get_icon '' LEFT_SEGMENT_END_SEPARATOR
|
_p9k_get_icon '' LEFT_SEGMENT_END_SEPARATOR
|
||||||
@ -4853,8 +4848,10 @@ _p9k_init_lines() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if (( num_lines > 1 )); then
|
if (( num_lines > 1 )); then
|
||||||
_p9k_build_gap_post first
|
for i in {1..$((num_lines-1))}; do
|
||||||
_p9k_line_gap_post[1]=$_p9k_ret
|
_p9k_build_gap_post $i
|
||||||
|
_p9k_line_gap_post+=$_p9k_ret
|
||||||
|
done
|
||||||
|
|
||||||
if [[ $+POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX == 1 || $_POWERLEVEL9K_PROMPT_ON_NEWLINE == 1 ]]; then
|
if [[ $+POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX == 1 || $_POWERLEVEL9K_PROMPT_ON_NEWLINE == 1 ]]; then
|
||||||
_p9k_get_icon '' MULTILINE_FIRST_PROMPT_PREFIX
|
_p9k_get_icon '' MULTILINE_FIRST_PROMPT_PREFIX
|
||||||
@ -4889,9 +4886,6 @@ _p9k_init_lines() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if (( num_lines > 2 )); then
|
if (( num_lines > 2 )); then
|
||||||
_p9k_build_gap_post newline
|
|
||||||
_p9k_line_gap_post[2,-2]=(${${:-{3..num_lines}}:/*/$_p9k_ret})
|
|
||||||
|
|
||||||
if [[ $+POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_PREFIX == 1 || $_POWERLEVEL9K_PROMPT_ON_NEWLINE == 1 ]]; then
|
if [[ $+POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_PREFIX == 1 || $_POWERLEVEL9K_PROMPT_ON_NEWLINE == 1 ]]; then
|
||||||
_p9k_get_icon '' MULTILINE_NEWLINE_PROMPT_PREFIX
|
_p9k_get_icon '' MULTILINE_NEWLINE_PROMPT_PREFIX
|
||||||
[[ _p9k_ret == *%* ]] && _p9k_ret+=%b%k%f
|
[[ _p9k_ret == *%* ]] && _p9k_ret+=%b%k%f
|
||||||
@ -4918,6 +4912,25 @@ _p9k_all_params_eq() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_p9k_init_display() {
|
||||||
|
local name
|
||||||
|
local -i i
|
||||||
|
_p9k__display[empty_line]=hide
|
||||||
|
_p9k__display[ruler]=hide
|
||||||
|
for i in {1..$#_p9k_line_segments_left}; do
|
||||||
|
_p9k__display[$i]=show
|
||||||
|
_p9k__display[$i/left]=show
|
||||||
|
_p9k__display[$i/right]=show
|
||||||
|
_p9k__display[$i/gap]=show
|
||||||
|
for name in ${(@0)_p9k_line_segments_left[i]}; do
|
||||||
|
_p9k__display[$i/left/$name]=show
|
||||||
|
done
|
||||||
|
for name in ${(@0)_p9k_line_segments_right[i]}; do
|
||||||
|
_p9k__display[$i/right/$name]=show
|
||||||
|
done
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
_p9k_init_prompt() {
|
_p9k_init_prompt() {
|
||||||
_p9k_t=($'\n' '' '')
|
_p9k_t=($'\n' '' '')
|
||||||
_p9k_prompt_overflow_bug && _p9k_t[2]='%{%G%}'
|
_p9k_prompt_overflow_bug && _p9k_t[2]='%{%G%}'
|
||||||
@ -4935,9 +4948,9 @@ _p9k_init_prompt() {
|
|||||||
_p9k_gap_pre+='}+}'
|
_p9k_gap_pre+='}+}'
|
||||||
|
|
||||||
_p9k_prompt_prefix_left='${${_p9k_clm::=$COLUMNS}+}${${COLUMNS::=1024}+}'
|
_p9k_prompt_prefix_left='${${_p9k_clm::=$COLUMNS}+}${${COLUMNS::=1024}+}'
|
||||||
_p9k_prompt_prefix_right='${${_p9k_clm::=$COLUMNS}+}${${COLUMNS::=1024}+}'
|
_p9k_prompt_prefix_right='${_p9k__'$#_p9k_line_segments_left'-${${_p9k_clm::=$COLUMNS}+}${${COLUMNS::=1024}+}'
|
||||||
_p9k_prompt_suffix_left='${${COLUMNS::=$_p9k_clm}+}'
|
_p9k_prompt_suffix_left='${${COLUMNS::=$_p9k_clm}+}'
|
||||||
_p9k_prompt_suffix_right='${${COLUMNS::=$_p9k_clm}+}'
|
_p9k_prompt_suffix_right='${${COLUMNS::=$_p9k_clm}+}}'
|
||||||
|
|
||||||
if _p9k_segment_in_use vi_mode || _p9k_segment_in_use prompt_char; then
|
if _p9k_segment_in_use vi_mode || _p9k_segment_in_use prompt_char; then
|
||||||
_p9k_prompt_prefix_left+='${${_p9k__keymap::=${KEYMAP:-$_p9k__keymap}}+}'
|
_p9k_prompt_prefix_left+='${${_p9k__keymap::=${KEYMAP:-$_p9k__keymap}}+}'
|
||||||
@ -4959,7 +4972,7 @@ _p9k_init_prompt() {
|
|||||||
! is-at-least 5.7.2; then
|
! is-at-least 5.7.2; then
|
||||||
_p9k_emulate_zero_rprompt_indent=1
|
_p9k_emulate_zero_rprompt_indent=1
|
||||||
_p9k_prompt_prefix_left+='${${:-${_p9k_real_zle_rprompt_indent:=$ZLE_RPROMPT_INDENT}${ZLE_RPROMPT_INDENT::=1}${_p9k_ind::=0}}+}'
|
_p9k_prompt_prefix_left+='${${:-${_p9k_real_zle_rprompt_indent:=$ZLE_RPROMPT_INDENT}${ZLE_RPROMPT_INDENT::=1}${_p9k_ind::=0}}+}'
|
||||||
_p9k_line_suffix_right[-1]='${_p9k_sss:+${_p9k_sss% }%E}'
|
_p9k_line_suffix_right[-1]='${_p9k_sss:+${_p9k_sss% }%E}}'
|
||||||
else
|
else
|
||||||
_p9k_emulate_zero_rprompt_indent=0
|
_p9k_emulate_zero_rprompt_indent=0
|
||||||
_p9k_prompt_prefix_left+='${${_p9k_ind::=${${ZLE_RPROMPT_INDENT:-1}/#-*/0}}+}'
|
_p9k_prompt_prefix_left+='${${_p9k_ind::=${${ZLE_RPROMPT_INDENT:-1}/#-*/0}}+}'
|
||||||
@ -4971,8 +4984,11 @@ _p9k_init_prompt() {
|
|||||||
_p9k_t+=''
|
_p9k_t+=''
|
||||||
fi
|
fi
|
||||||
_p9k_empty_line_idx=$#_p9k_t
|
_p9k_empty_line_idx=$#_p9k_t
|
||||||
_p9k_empty_line_i=3
|
if (( __p9k_ksh_arrays )); then
|
||||||
_p9k_prompt_prefix_left+='${_p9k_t[_p9k_empty_line_i-__p9k_ksh_arrays]}'
|
_p9k_prompt_prefix_left+='${_p9k_t[_p9k__empty_line_i-1]}'
|
||||||
|
else
|
||||||
|
_p9k_prompt_prefix_left+='${_p9k_t[_p9k__empty_line_i]}'
|
||||||
|
fi
|
||||||
|
|
||||||
_p9k_get_icon '' RULER_CHAR
|
_p9k_get_icon '' RULER_CHAR
|
||||||
local ruler_char=$_p9k_ret
|
local ruler_char=$_p9k_ret
|
||||||
@ -4997,8 +5013,11 @@ _p9k_init_prompt() {
|
|||||||
fi
|
fi
|
||||||
_p9k_t+=$ruler
|
_p9k_t+=$ruler
|
||||||
_p9k_ruler_idx=$#_p9k_t
|
_p9k_ruler_idx=$#_p9k_t
|
||||||
_p9k_ruler_i=3
|
if (( __p9k_ksh_arrays )); then
|
||||||
_p9k_prompt_prefix_left+='${(e)_p9k_t[_p9k_ruler_i-__p9k_ksh_arrays]}'
|
_p9k_prompt_prefix_left+='${(e)_p9k_t[_p9k__ruler_i-1]}'
|
||||||
|
else
|
||||||
|
_p9k_prompt_prefix_left+='${(e)_p9k_t[_p9k__ruler_i]}'
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $ITERM_SHELL_INTEGRATION_INSTALLED == Yes ]]; then
|
if [[ $ITERM_SHELL_INTEGRATION_INSTALLED == Yes ]]; then
|
||||||
_p9k_prompt_prefix_left+=$'%{\e]133;A\a%}'
|
_p9k_prompt_prefix_left+=$'%{\e]133;A\a%}'
|
||||||
@ -5053,7 +5072,7 @@ _p9k_must_init() {
|
|||||||
_p9k__param_pat+=$'${#parameters[(I)POWERLEVEL9K_*]}\1${(%):-%n%#}\1$GITSTATUS_LOG_LEVEL\1'
|
_p9k__param_pat+=$'${#parameters[(I)POWERLEVEL9K_*]}\1${(%):-%n%#}\1$GITSTATUS_LOG_LEVEL\1'
|
||||||
_p9k__param_pat+=$'$GITSTATUS_ENABLE_LOGGING\1$GITSTATUS_DAEMON\1$GITSTATUS_NUM_THREADS\1'
|
_p9k__param_pat+=$'$GITSTATUS_ENABLE_LOGGING\1$GITSTATUS_DAEMON\1$GITSTATUS_NUM_THREADS\1'
|
||||||
_p9k__param_pat+=$'$DEFAULT_USER\1${ZLE_RPROMPT_INDENT:-1}\1$P9K_SSH\1$__p9k_ksh_arrays'
|
_p9k__param_pat+=$'$DEFAULT_USER\1${ZLE_RPROMPT_INDENT:-1}\1$P9K_SSH\1$__p9k_ksh_arrays'
|
||||||
_p9k__param_pat+=$'$__p9k_sh_glob\1${options[transient_rprompt]}\1$ITERM_SHELL_INTEGRATION_INSTALLED\1'
|
_p9k__param_pat+=$'$__p9k_sh_glob\1$ITERM_SHELL_INTEGRATION_INSTALLED\1'
|
||||||
_p9k__param_pat+=$'${PROMPT_EOL_MARK-%B%S%#%s%b}\1$LANG\1$LC_ALL\1$LC_CTYPE\1'
|
_p9k__param_pat+=$'${PROMPT_EOL_MARK-%B%S%#%s%b}\1$LANG\1$LC_ALL\1$LC_CTYPE\1'
|
||||||
local MATCH
|
local MATCH
|
||||||
IFS=$'\1' _p9k__param_pat+="${(@)${(@o)parameters[(I)POWERLEVEL9K_*]}:/(#m)*/\${${(q)MATCH}-$IFS\}}"
|
IFS=$'\1' _p9k__param_pat+="${(@)${(@o)parameters[(I)POWERLEVEL9K_*]}:/(#m)*/\${${(q)MATCH}-$IFS\}}"
|
||||||
@ -5298,6 +5317,8 @@ _p9k_init() {
|
|||||||
_p9k_init_vars
|
_p9k_init_vars
|
||||||
_p9k_restore_state || _p9k_init_cacheable
|
_p9k_restore_state || _p9k_init_cacheable
|
||||||
|
|
||||||
|
_p9k_init_display
|
||||||
|
|
||||||
if _p9k_segment_in_use todo; then
|
if _p9k_segment_in_use todo; then
|
||||||
local todo=$commands[todo.sh]
|
local todo=$commands[todo.sh]
|
||||||
if [[ -n $todo ]]; then
|
if [[ -n $todo ]]; then
|
||||||
@ -5315,7 +5336,7 @@ _p9k_init() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (( _p9k_reset_on_line_finish )) || _p9k_segment_in_use status || [[ -o transient_rprompt ]]; then
|
if (( _p9k_reset_on_line_finish )) || _p9k_segment_in_use status ; then
|
||||||
_p9k_wrap_zle_widget zle-line-finish _p9k_zle_line_finish
|
_p9k_wrap_zle_widget zle-line-finish _p9k_zle_line_finish
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -5604,24 +5625,28 @@ function p10k() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
shift
|
shift
|
||||||
local opt
|
local opt match name
|
||||||
for opt; do
|
for opt; do
|
||||||
local pair=(${(s:=:)opt})
|
local pair=(${(s:=:)opt})
|
||||||
local name=${pair[1]/#segment/s}
|
local list=(${(s:,:)${pair[2]}})
|
||||||
local prev=$__p9k_display[$name]
|
for name in ${_p9k__display[(I)$pair[1]]}; do
|
||||||
if [[ $pair[2] == *,* ]]; then # branch purely for optimization
|
local prev=$_p9k__display[$name]
|
||||||
local list=(${(s:,:)${pair[2]}})
|
|
||||||
local new=${list[list[(I)cur]+1]:-$list[1]}
|
local new=${list[list[(I)cur]+1]:-$list[1]}
|
||||||
else
|
[[ $prev == $new ]] && continue
|
||||||
local new=$pair[2]
|
_p9k__display[$name]=$new
|
||||||
fi
|
if [[ $name == (empty_line|ruler) ]]; then
|
||||||
[[ $prev == $new ]] && continue
|
[[ $new == show ]] && local v=v2=_p9k_${name}_idx || local v=3
|
||||||
__p9k_display[$name]=$new
|
typeset -gi _p9k__${name}_i=$v
|
||||||
if (( __p9k_reset_state > 0 )); then
|
elif [[ $name == (#b)(<->)([[:IDENT:]/]#) ]]; then
|
||||||
__p9k_reset_state=2
|
local var=_p9k__${match[1]}${${${${match[2]//\/}/#left/l}/#right/r}/#gap/g}
|
||||||
else
|
[[ $new == hide ]] && typeset -g $var= || unset $var
|
||||||
__p9k_reset_state=-1
|
fi
|
||||||
fi
|
if (( __p9k_reset_state > 0 )); then
|
||||||
|
__p9k_reset_state=2
|
||||||
|
else
|
||||||
|
__p9k_reset_state=-1
|
||||||
|
fi
|
||||||
|
done
|
||||||
done
|
done
|
||||||
if (( __p9k_reset_state == -1 )); then
|
if (( __p9k_reset_state == -1 )); then
|
||||||
_p9k_reset_prompt
|
_p9k_reset_prompt
|
||||||
|
Loading…
Reference in New Issue
Block a user