1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-09-21 11:00:08 +00:00

add powerlevel9k_refresh_prompt_inplace that users can from zle widgets to refresh prompt inplace

This commit is contained in:
romkatv 2019-05-27 19:52:57 +02:00
parent a405d8af70
commit e8f2c1aa6f

View file

@ -2196,25 +2196,31 @@ function _p9k_update_prompt() {
typeset -gi _P9K_REGION_ACTIVE
set_default POWERLEVEL9K_PROMPT_ADD_NEWLINE false
powerlevel9k_prepare_prompts() {
# Do not move these lines down, otherwise the last command is not what you expected it to be.
_P9K_EXIT_CODE=$?
_P9K_PIPE_EXIT_CODES=( "$pipestatus[@]" )
_P9K_COMMAND_DURATION=$((EPOCHREALTIME - _P9K_TIMER_START))
unsetopt local_options
prompt_opts=(cr percent sp subst)
setopt nopromptbang prompt{cr,percent,sp,subst}
powerlevel9k_refresh_prompt_inplace() {
emulate -L zsh
_p9k_init
_P9K_TIMER_START=1e10
_P9K_REGION_ACTIVE=0
_P9K_REFRESH_REASON=precmd
_p9k_set_prompt
_P9K_REFRESH_REASON=''
}
powerlevel9k_prepare_prompts() {
_P9K_EXIT_CODE=$?
_P9K_PIPE_EXIT_CODES=( "$pipestatus[@]" )
_P9K_COMMAND_DURATION=$((EPOCHREALTIME - _P9K_TIMER_START))
_P9K_TIMER_START=1e10
_P9K_REGION_ACTIVE=0
unsetopt localoptions
prompt_opts=(cr percent sp subst)
setopt nopromptbang prompt{cr,percent,sp,subst}
powerlevel9k_refresh_prompt_inplace
}
function _p9k_zle_keymap_select() {
zle && zle .reset-prompt && zle -R
}