don't compile sources if zsh is < 5.1

This commit is contained in:
romkatv 2020-04-05 06:54:20 +02:00
parent c71606cd83
commit b2667b8270
2 changed files with 16 additions and 14 deletions

View File

@ -1,4 +1,4 @@
if [[ $__p9k_sourced != 7 ]]; then
if [[ $__p9k_sourced != 8 ]]; then
>&2 print -P ""
>&2 print -P "[%F{1}ERROR%f]: Corrupted powerlevel10k installation."
>&2 print -P ""

View File

@ -54,19 +54,21 @@ function _p9k_init_locale() {
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
fi
typeset -gr __p9k_sourced=7
if [[ -w $__p9k_root_dir && -w $__p9k_root_dir/internal && -w $__p9k_root_dir/gitstatus ]]; then
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,internal/parser.zsh,gitstatus/gitstatus.plugin.zsh}; do
[[ $f.zwc -nt $f ]] && continue
zmodload -F zsh/files b:zf_mv b:zf_rm
local tmp=$f.tmp.$$.zwc
{
zcompile -R -- $tmp $f && zf_mv -f -- $tmp $f.zwc
} always {
(( $? )) && zf_rm -f -- $tmp
}
done
typeset -gr __p9k_sourced=8
if [[ $ZSH_VERSION == (5.<1->*|<6->.*) ]]; then
if [[ -w $__p9k_root_dir && -w $__p9k_root_dir/internal && -w $__p9k_root_dir/gitstatus ]]; then
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,internal/parser.zsh,gitstatus/gitstatus.plugin.zsh}; do
[[ $f.zwc -nt $f ]] && continue
zmodload -F zsh/files b:zf_mv b:zf_rm
local tmp=$f.tmp.$$.zwc
{
zcompile -R -- $tmp $f && zf_mv -f -- $tmp $f.zwc
} always {
(( $? )) && zf_rm -f -- $tmp
}
done
fi
fi
source $__p9k_root_dir/internal/p10k.zsh || true
}