zlogin 1.6 KB

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