mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-12-12 19:18:28 +02:00
add POWERLEVEL9K_TRANSIENT_PROMPT
This commit is contained in:
parent
4b34a6ed51
commit
00c69d6bda
@ -409,7 +409,7 @@ _p9k_translate_color() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# _p9k_param prompt_foo_BAR BACKGROUND red
|
# _p9k_color prompt_foo_BAR BACKGROUND red
|
||||||
_p9k_color() {
|
_p9k_color() {
|
||||||
local key="_p9k_color ${(pj:\0:)*}"
|
local key="_p9k_color ${(pj:\0:)*}"
|
||||||
_p9k_ret=$_p9k_cache[$key]
|
_p9k_ret=$_p9k_cache[$key]
|
||||||
@ -4079,20 +4079,28 @@ function _p9k_on_expand() {
|
|||||||
__p9k_reset_state=1
|
__p9k_reset_state=1
|
||||||
|
|
||||||
if (( _POWERLEVEL9K_PROMPT_ADD_NEWLINE )); then
|
if (( _POWERLEVEL9K_PROMPT_ADD_NEWLINE )); then
|
||||||
_p9k__empty_line_i=3
|
|
||||||
if [[ $P9K_TTY == new ]]; then
|
if [[ $P9K_TTY == new ]]; then
|
||||||
|
_p9k__empty_line_i=3
|
||||||
_p9k__display_v[2]=hide
|
_p9k__display_v[2]=hide
|
||||||
else
|
elif [[ -z $_p9k_transient_prompt ]]; then
|
||||||
|
_p9k__empty_line_i=3
|
||||||
_p9k__display_v[2]=print
|
_p9k__display_v[2]=print
|
||||||
|
else
|
||||||
|
unset _p9k__empty_line_i
|
||||||
|
_p9k__display_v[2]=show
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (( _POWERLEVEL9K_SHOW_RULER )); then
|
if (( _POWERLEVEL9K_SHOW_RULER )); then
|
||||||
_p9k__ruler_i=3
|
|
||||||
if [[ $P9K_TTY == new ]]; then
|
if [[ $P9K_TTY == new ]]; then
|
||||||
|
_p9k__ruler_i=3
|
||||||
_p9k__display_v[4]=hide
|
_p9k__display_v[4]=hide
|
||||||
else
|
elif [[ -z $_p9k_transient_prompt ]]; then
|
||||||
|
_p9k__ruler_i=3
|
||||||
_p9k__display_v[4]=print
|
_p9k__display_v[4]=print
|
||||||
|
else
|
||||||
|
unset _p9k__ruler_i
|
||||||
|
_p9k__display_v[4]=show
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -4534,6 +4542,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 -g _p9k_transient_prompt
|
||||||
|
typeset -g _p9k_last_prompt_pwd
|
||||||
typeset -gA _p9k__display_k
|
typeset -gA _p9k__display_k
|
||||||
typeset -ga _p9k__display_v
|
typeset -ga _p9k__display_v
|
||||||
|
|
||||||
@ -4561,6 +4571,9 @@ _p9k_init_params() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
_p9k_declare -s POWERLEVEL9K_TRANSIENT_PROMPT off
|
||||||
|
[[ $_POWERLEVEL9K_TRANSIENT_PROMPT == (off|always|same-dir) ]] || _POWERLEVEL9K_TRANSIENT_PROMPT=off
|
||||||
|
|
||||||
_p9k_declare -F POWERLEVEL9K_NEW_TTY_MAX_AGE_SECONDS 5
|
_p9k_declare -F POWERLEVEL9K_NEW_TTY_MAX_AGE_SECONDS 5
|
||||||
_p9k_declare -i POWERLEVEL9K_INSTANT_PROMPT_COMMAND_LINES 1
|
_p9k_declare -i POWERLEVEL9K_INSTANT_PROMPT_COMMAND_LINES 1
|
||||||
_p9k_declare -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS -- context dir vcs
|
_p9k_declare -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS -- context dir vcs
|
||||||
@ -4870,6 +4883,16 @@ function _p9k_zle_line_finish() {
|
|||||||
__p9k_reset_state=0
|
__p9k_reset_state=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -n $_p9k_transient_prompt ]]; then
|
||||||
|
if [[ $_POWERLEVEL9K_TRANSIENT_PROMPT == always || $_p9k_pwd == $_p9k_last_prompt_pwd ]]; then
|
||||||
|
RPROMPT=
|
||||||
|
PROMPT=$_p9k_transient_prompt
|
||||||
|
reset=1
|
||||||
|
else
|
||||||
|
_p9k_last_prompt_pwd=$_p9k_pwd
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if (( reset )); then
|
if (( reset )); then
|
||||||
_p9k_reset_prompt
|
_p9k_reset_prompt
|
||||||
fi
|
fi
|
||||||
@ -5244,6 +5267,16 @@ function _p9k_init_cacheable() {
|
|||||||
_p9k_init_params
|
_p9k_init_params
|
||||||
_p9k_init_prompt
|
_p9k_init_prompt
|
||||||
|
|
||||||
|
if [[ $_POWERLEVEL9K_TRANSIENT_PROMPT != off ]]; then
|
||||||
|
_p9k_transient_prompt='%b%k%s%u%F{%(?.'
|
||||||
|
_p9k_color prompt_prompt_char_OK_VIINS FOREGROUND 76
|
||||||
|
_p9k_transient_prompt+=$_p9k_ret'.'
|
||||||
|
_p9k_color prompt_prompt_char_ERROR_VIINS FOREGROUND 196
|
||||||
|
_p9k_transient_prompt+=$_p9k_ret')}${${P9K_CONTENT::="❯"}+}'
|
||||||
|
_p9k_param prompt_prompt_char_OK_VIINS CONTENT_EXPANSION '${P9K_CONTENT}'
|
||||||
|
_p9k_transient_prompt+='${:-"'$_p9k_ret'"}%b%k%f%s%u '
|
||||||
|
fi
|
||||||
|
|
||||||
_p9k_uname="$(uname)"
|
_p9k_uname="$(uname)"
|
||||||
[[ $_p9k_uname == Linux ]] && _p9k_uname_o="$(uname -o 2>/dev/null)"
|
[[ $_p9k_uname == Linux ]] && _p9k_uname_o="$(uname -o 2>/dev/null)"
|
||||||
_p9k_uname_m="$(uname -m)"
|
_p9k_uname_m="$(uname -m)"
|
||||||
|
Loading…
Reference in New Issue
Block a user