]> arthur.barton.de Git - ax-zsh.git/blob - core/01_zprofile/01_zprofile.zshrc
Cache: Read "zprofile" in the correct context in "zshrc" stage
[ax-zsh.git] / core / 01_zprofile / 01_zprofile.zshrc
1 # AX-ZSH: Alex' Modular ZSH Configuration
2 # 01_zprofile.zshrc: Make sure zpfofile files are read
3
4 [[ -z "$AXZSH_ZPROFILE_READ" ]] || return
5
6 # No "zprofile" files have been read in already! So most probably this
7 # ZSH instance hasn't been called from an ax-zsh enabled ZSH!
8
9 # Reset some environment variables, that could contain "garbage" ...
10 unset PS1
11
12 [[ -n "$AXZSH_DEBUG" ]] && echo "» 01_zprofile.zsh:"
13
14 if [[ -r "$AXZSH/cache/zprofile.cache" ]]; then
15         # Cache file exists, use it!
16         [[ -n "$AXZSH_DEBUG" ]] \
17                 && echo "   - Reading cache file \"$AXZSH/cache/zprofile.cache\" ..."
18         source "$AXZSH/cache/zprofile.cache"
19 else
20         # No cache file, so read plugins manually. The "plugin_list" can be
21         # empty, when the "zshrc" stage has been read in using the cache file,
22         # but there is no cache file for the "zprofile" stage. In that case
23         # the "plugin_list" must be assembled right now (see "ax.zsh" file!):
24         if [[ -z "$plugin_list" ]]; then
25                 typeset -U plugin_list
26                 plugin_list=(
27                         "$AXZSH/core/"[0-5]*
28                         "$AXZSH/active_plugins/"*(N)
29                         "$AXZSH/core/"[6-9]*
30                 )
31         fi
32         for plugin ($plugin_list); do
33                 axzsh_load_plugin "$plugin" "zprofile"
34         done
35 fi
36 AXZSH_ZPROFILE_READ=2
37
38 [[ -n "$AXZSH_DEBUG" ]] && echo "» 01_zprofile.zsh (end)"