1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-26 05:50:07 +00:00

delete instant prompt cache when config changes while instant prompt is active

This commit is contained in:
romkatv 2020-05-06 12:02:15 +02:00
parent 30457e2be6
commit fc1fd9beb5

View file

@ -5988,6 +5988,12 @@ function _p9k_dump_state() {
} }
} }
function _p9k_delete_instant_prompt() {
local user=${(%):-%n}
local root_dir=${__p9k_dump_file:h}
zf_rm -f -- $root_dir/p10k-instant-prompt-$user.zsh{,.zwc} ${root_dir}/p10k-$user/prompt-*(N) 2>/dev/null
}
function _p9k_restore_state() { function _p9k_restore_state() {
{ {
[[ $__p9k_cached_param_pat == $_p9k__param_pat && $__p9k_cached_param_sig == $_p9k__param_sig ]] || return [[ $__p9k_cached_param_pat == $_p9k__param_pat && $__p9k_cached_param_sig == $_p9k__param_sig ]] || return
@ -6001,9 +6007,7 @@ function _p9k_restore_state() {
unfunction _p9k_preinit unfunction _p9k_preinit
(( $+functions[gitstatus_stop] )) && gitstatus_stop POWERLEVEL9K (( $+functions[gitstatus_stop] )) && gitstatus_stop POWERLEVEL9K
fi fi
local user=${(%):-%n} _p9k_delete_instant_prompt
local root_dir=${__p9k_dump_file:h}
zf_rm -f -- $root_dir/p10k-instant-prompt-$user.zsh{,.zwc} ${root_dir}/p10k-$user/prompt-*(N) 2>/dev/null
fi fi
} }
} }
@ -6342,7 +6346,7 @@ _p9k_precmd_impl() {
fi fi
;; ;;
2) 2)
zf_rm -f -- ${__p9k_dump_file:h}/p10k-instant-prompt-${(%):-%n}.zsh{,.zwc} 2>/dev/null _p9k_delete_instant_prompt
instant_prompt_disabled=1 instant_prompt_disabled=1
;; ;;
esac esac
@ -7972,7 +7976,7 @@ _p9k_init() {
if (( _POWERLEVEL9K_DISABLE_INSTANT_PROMPT )); then if (( _POWERLEVEL9K_DISABLE_INSTANT_PROMPT )); then
unset __p9k_instant_prompt_erased unset __p9k_instant_prompt_erased
zf_rm -f -- ${__p9k_dump_file:h}/p10k-instant-prompt-${(%):-%n}.zsh{,.zwc} 2>/dev/null _p9k_delete_instant_prompt
fi fi
if (( $+__p9k_instant_prompt_erased )); then if (( $+__p9k_instant_prompt_erased )); then
@ -8407,7 +8411,7 @@ if [[ $__p9k_dump_file != $__p9k_instant_prompt_dump_file && -n $__p9k_instant_p
fi fi
if [[ $+__p9k_instant_prompt_sourced == 1 && $__p9k_instant_prompt_sourced != $__p9k_instant_prompt_version ]]; then if [[ $+__p9k_instant_prompt_sourced == 1 && $__p9k_instant_prompt_sourced != $__p9k_instant_prompt_version ]]; then
zf_rm -f -- ${__p9k_dump_file:h}/p10k-instant-prompt-${(%):-%n}.zsh{,.zwc} 2>/dev/null _p9k_delete_instant_prompt
fi fi
_p9k_init_ssh _p9k_init_ssh