summaryrefslogtreecommitdiff
path: root/powerlevel9k.zsh-theme
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2019-10-03 21:14:16 +0300
committerromkatv <roman.perepelitsa@gmail.com>2019-10-03 21:14:16 +0300
commitd435235c29c0966295018fe15c64717436f909f6 (patch)
tree69c998b40dae72c089b802a607684edb627bd432 /powerlevel9k.zsh-theme
parent9d0c49dc5838c9bdcfe686a1f17536a7650d8778 (diff)
take advantage of async gitstatus start to make p10k startup faster
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-xpowerlevel9k.zsh-theme16
1 files changed, 11 insertions, 5 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index 9d2847ce..5fc89041 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -17,7 +17,8 @@
[[ ! -o 'no_brace_expand' ]] || _p9k_src_opts+=('no_brace_expand')
'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand'
-typeset -g __p9k_root_dir="${POWERLEVEL9K_INSTALLATION_DIR:-${${(%):-%x}:A:h}}"
+typeset -g __p9k_root_dir=${POWERLEVEL9K_INSTALLATION_DIR:-${${(%):-%x}:A:h}}
+typeset -g __p9k_dump_file=${XDG_CACHE_HOME:-~/.cache}/p10k-dump-${(%):-%n}.zsh
() {
emulate -L zsh
@@ -27,10 +28,15 @@ typeset -g __p9k_root_dir="${POWERLEVEL9K_INSTALLATION_DIR:-${${(%):-%x}:A:h}}"
return
fi
typeset -gr __p9k_sourced=1
- local f
- for f in $__p9k_root_dir/{powerlevel9k.zsh-theme,powerlevel10k.zsh-theme,internal/p10k.zsh,internal/icons.zsh,internal/configure.zsh,gitstatus/gitstatus.plugin.zsh}; do
- [[ $f.zwc -nt $f ]] || zcompile $f
- done
+ 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,gitstatus/gitstatus.plugin.zsh}; do
+ [[ $f.zwc -nt $f ]] || zcompile $f
+ done
+ fi
+ if [[ -z $__p9k_dump_file(.zwc|)(#qNW) ]] && source $__p9k_dump_file 2>/dev/null && (( $+functions[_p9k_preinit] )); then
+ _p9k_preinit
+ fi
source $__p9k_root_dir/internal/p10k.zsh || true
}