| 1 | |
| 2 | |
| 3 | # |
| 4 | # startup file read in interactive login shells |
| 5 | # |
| 6 | # The following code helps us by optimizing the existing framework. |
| 7 | # This includes zcompile, zcompdump, etc. |
| 8 | # |
| 9 | |
| 10 | ( |
| 11 | # Function to determine the need of a zcompile. If the .zwc file |
| 12 | # does not exist, or the base file is newer, we need to compile. |
| 13 | # These jobs are asynchronous, and will not impact the interactive shell |
| 14 | zcompare() { |
| 15 | if [[ -s ${1} && ( ! -s ${1}.zwc || ${1} -nt ${1}.zwc) ]]; then |
| 16 | zcompile ${1} |
| 17 | fi |
| 18 | } |
| 19 | |
| 20 | zim_mods=${ZDOTDIR:-${HOME}}/.zim/modules |
| 21 | setopt EXTENDED_GLOB |
| 22 | |
| 23 | # zcompile the completion cache; siginificant speedup. |
| 24 | for file in ${ZDOTDIR:-${HOME}}/.zcomp^(*.zwc)(.); do |
| 25 | zcompare ${file} |
| 26 | done |
| 27 | |
| 28 | # zcompile .zshrc |
| 29 | zcompare ${ZDOTDIR:-${HOME}}/.zshrc |
| 30 | |
| 31 | # zcompile some light module init scripts |
| 32 | zcompare ${zim_mods}/git/init.zsh |
| 33 | zcompare ${zim_mods}/utility/init.zsh |
| 34 | zcompare ${zim_mods}/pacman/init.zsh |
| 35 | zcompare ${zim_mods}/spectrum/init.zsh |
| 36 | zcompare ${zim_mods}/completion/init.zsh |
| 37 | zcompare ${zim_mods}/fasd/init.zsh |
| 38 | |
| 39 | # zcompile all .zsh files in the custom module |
| 40 | for file in ${zim_mods}/custom/**/^(README.md|*.zwc)(.); do |
| 41 | zcompare ${file} |
| 42 | done |
| 43 | |
| 44 | # zcompile all autoloaded functions |
| 45 | for file in ${zim_mods}/**/functions/^(*.zwc)(.); do |
| 46 | zcompare ${file} |
| 47 | done |
| 48 | |
| 49 | # syntax-highlighting |
| 50 | for file in ${zim_mods}/syntax-highlighting/external/highlighters/**/*.zsh; do |
| 51 | zcompare ${file} |
| 52 | done |
| 53 | zcompare ${zim_mods}/syntax-highlighting/external/zsh-syntax-highlighting.zsh |
| 54 | |
| 55 | # zsh-histery-substring-search |
| 56 | zcompare ${zim_mods}/history-substring-search/external/zsh-history-substring-search.zsh |
| 57 | |
| 58 | |
| 59 | ) &! |