diff options
author | romkatv <roman.perepelitsa@gmail.com> | 2020-01-27 11:33:01 +0300 |
---|---|---|
committer | romkatv <roman.perepelitsa@gmail.com> | 2020-01-27 11:33:01 +0300 |
commit | 3bca7e845f6e85b7fad20e0356ca3ec14b187dd1 (patch) | |
tree | 66e0c7ac51647e663f735957cc823bea15fafdca /internal/p10k.zsh | |
parent | b7777bb86e0b5358f9d6d0bc81bc829f5b55eaba (diff) |
detect source code corruption done by antigen and suggest resetting cache
Diffstat (limited to 'internal/p10k.zsh')
-rw-r--r-- | internal/p10k.zsh | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 062adf74..b3a725e7 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -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 () { >&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; } -prompt_powerlevel9k_setup() { +_p9k_setup() { (( __p9k_enabled )) && return prompt_opts=(percent subst) @@ -7155,6 +7177,8 @@ prompt_powerlevel9k_setup() { typeset -ga precmd_functions=(_p9k_do_nothing $precmd_functions _p9k_precmd) } +prompt_powerlevel9k_setup() { _p9k_setup } + prompt_powerlevel9k_teardown() { eval $__p9k_intro add-zsh-hook -D precmd '(_p9k_|powerlevel9k_)*' |