detect source code corruption done by antigen and suggest resetting cache

pull/445/head
romkatv 5 years ago
parent b7777bb86e
commit 3bca7e845f

@ -1,3 +1,25 @@
if [[ $__p9k_sourced != 2 ]]; then
>&2 print -P ""
>&2 print -P "[%F{1}ERROR%f]: Corrupted powerlevel10k installation."
>&2 print -P ""
if (( ${+functions[antigen]} )); then
>&2 print -P "If using %Bantigen%b, run the folowing command to fix:"
>&2 print -P ""
>&2 print -P " %F{2}antigen%f reset"
if [[ -d ~/.antigen ]]; then
>&2 print -P ""
>&2 print -P "If it doesn't help, try this:"
>&2 print -P ""
>&2 print -P " %F{2}rm%f -rf %U~/.antigen%u"
fi
else
>&2 print -P "Try resetting cache in your plugin manager or"
>&2 print -P "reinstalling powerlevel10k from scratch."
fi
>&2 print -P ""
return 1
fi
if ! autoload -Uz is-at-least || ! is-at-least 5.1; then if ! autoload -Uz is-at-least || ! is-at-least 5.1; then
() { () {
>&2 echo -E "You are using ZSH version $ZSH_VERSION. The minimum required version for Powerlevel10k is 5.1." >&2 echo -E "You are using ZSH version $ZSH_VERSION. The minimum required version for Powerlevel10k is 5.1."
@ -7139,7 +7161,7 @@ fi
_p9k_do_nothing() { true; } _p9k_do_nothing() { true; }
prompt_powerlevel9k_setup() { _p9k_setup() {
(( __p9k_enabled )) && return (( __p9k_enabled )) && return
prompt_opts=(percent subst) prompt_opts=(percent subst)
@ -7155,6 +7177,8 @@ prompt_powerlevel9k_setup() {
typeset -ga precmd_functions=(_p9k_do_nothing $precmd_functions _p9k_precmd) typeset -ga precmd_functions=(_p9k_do_nothing $precmd_functions _p9k_precmd)
} }
prompt_powerlevel9k_setup() { _p9k_setup }
prompt_powerlevel9k_teardown() { prompt_powerlevel9k_teardown() {
eval $__p9k_intro eval $__p9k_intro
add-zsh-hook -D precmd '(_p9k_|powerlevel9k_)*' add-zsh-hook -D precmd '(_p9k_|powerlevel9k_)*'

@ -28,14 +28,14 @@
() { () {
eval $__p9k_intro eval $__p9k_intro
if (( $+__p9k_sourced )); then if (( $+__p9k_sourced )); then
prompt_powerlevel9k_setup (( $+functions[_p9k_setup] )) && _p9k_setup
return 0 return 0
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 ]] && (( ! $+functions[_p9k_preinit] )) && 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=2
if [[ -w $__p9k_root_dir && -w $__p9k_root_dir/internal && -w $__p9k_root_dir/gitstatus && ${(%):-%#} == % ]]; then if [[ -w $__p9k_root_dir && -w $__p9k_root_dir/internal && -w $__p9k_root_dir/gitstatus && ${(%):-%#} == % ]]; then
local f local f
for f in $__p9k_root_dir/{powerlevel9k.zsh-theme,powerlevel10k.zsh-theme,internal/p10k.zsh,internal/icons.zsh,internal/configure.zsh,internal/worker.zsh,gitstatus/gitstatus.plugin.zsh}; do for f in $__p9k_root_dir/{powerlevel9k.zsh-theme,powerlevel10k.zsh-theme,internal/p10k.zsh,internal/icons.zsh,internal/configure.zsh,internal/worker.zsh,gitstatus/gitstatus.plugin.zsh}; do

Loading…
Cancel
Save