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

better handling of XDG_CACHE_HOME changes

This commit is contained in:
romkatv 2019-10-20 10:36:41 +02:00
parent cb2473751e
commit d17f22e5b0
2 changed files with 10 additions and 5 deletions

View file

@ -3577,6 +3577,10 @@ _p9k_dump_instant_prompt() {
exec {__p9k_fd_1}>&1 {__p9k_fd_2}>&2 1>$__p9k_instant_prompt_output exec {__p9k_fd_1}>&1 {__p9k_fd_2}>&2 1>$__p9k_instant_prompt_output
exec 2>&1 exec 2>&1
typeset -gi __p9k_instant_prompt_active=1 typeset -gi __p9k_instant_prompt_active=1
typeset -g __p9k_instant_prompt_dump_file=${XDG_CACHE_HOME:-~/.cache}/p10k-dump-${(%):-%n}.zsh
if source $__p9k_instant_prompt_dump_file 2>/dev/null && (( $+functions[_p9k_preinit] )); then
_p9k_preinit
fi
function _p9k_instant_prompt_precmd_first() { function _p9k_instant_prompt_precmd_first() {
emulate -L zsh emulate -L zsh
function _p9k_instant_prompt_sched_last() { function _p9k_instant_prompt_sched_last() {
@ -3600,10 +3604,7 @@ _p9k_dump_instant_prompt() {
precmd_functions=(${(@)precmd_functions:#_p9k_instant_prompt_precmd_first}) precmd_functions=(${(@)precmd_functions:#_p9k_instant_prompt_precmd_first})
} }
precmd_functions=(_p9k_instant_prompt_precmd_first $precmd_functions) precmd_functions=(_p9k_instant_prompt_precmd_first $precmd_functions)
typeset -g __p9k_instant_prompt_dump_file=${XDG_CACHE_HOME:-~/.cache}/p10k-dump-${(%):-%n}.zsh
if source $__p9k_instant_prompt_dump_file 2>/dev/null && (( $+functions[_p9k_preinit] )); then
_p9k_preinit
fi
} && unsetopt prompt_cr prompt_sp || true' } && unsetopt prompt_cr prompt_sp || true'
} always { } always {
exec {fd}>&- exec {fd}>&-
@ -5346,5 +5347,9 @@ zmodload -F zsh/stat b:zstat
zmodload -F zsh/net/socket b:zsocket zmodload -F zsh/net/socket b:zsocket
zmodload -F zsh/files b:zf_mv b:zf_rm zmodload -F zsh/files b:zf_mv b:zf_rm
if [[ $__p9k_dump_file != $__p9k_instant_prompt_dump_file && -n $__p9k_instant_prompt_dump_file ]]; then
zf_rm -f $__p9k_instant_prompt_dump_file 2>/dev/null
fi
_p9k_init_ssh _p9k_init_ssh
prompt_powerlevel9k_setup prompt_powerlevel9k_setup

View file

@ -27,7 +27,7 @@
return return
fi fi
typeset -gr __p9k_dump_file=${XDG_CACHE_HOME:-~/.cache}/p10k-dump-${(%):-%n}.zsh typeset -gr __p9k_dump_file=${XDG_CACHE_HOME:-~/.cache}/p10k-dump-${(%):-%n}.zsh
if [[ $__p9k_dump_file != $__p9k_instant_prompt_dump_file ]] && source $__p9k_dump_file 2>/dev/null && (( $+functions[_p9k_preinit] )); then if [[ $__p9k_dump_file != $__p9k_instant_prompt_dump_file ]] && (( ! $+functions[_p9k_preinit] )) && source $__p9k_dump_file 2>/dev/null && (( $+functions[_p9k_preinit] )); then
_p9k_preinit _p9k_preinit
fi fi
typeset -gr __p9k_sourced=1 typeset -gr __p9k_sourced=1