login_init.zsh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. local dir file
  9. setopt LOCAL_OPTIONS EXTENDED_GLOB
  10. autoload -U zrecompile
  11. # zcompile the completion cache; siginificant speedup
  12. zrecompile -pq ${ZDOTDIR:-${HOME}}/${zcompdump_file:-.zcompdump}
  13. # zcompile .zshrc
  14. zrecompile -pq ${ZDOTDIR:-${HOME}}/.zshrc
  15. # zcompile enabled module autoloaded functions
  16. for dir in ${ZIM_HOME}/modules/${^zmodules}/functions(/FN); do
  17. zrecompile -pq ${dir}.zwc ${dir}/^([_.]*|prompt_*_setup|README*|*.zwc|*.zwc.old)(-.N)
  18. done
  19. # zcompile enabled module init scripts
  20. local zmodule zmodule_dir
  21. for zmodule (${zmodules}); do
  22. zmodule_dir=${ZIM_HOME}/modules/${zmodule}
  23. if [[ -d ${zmodule_dir} ]]; then
  24. for file (${zmodule_dir}/{,zsh-}${zmodule}.zsh-theme \
  25. ${zmodule_dir}/init.zsh \
  26. ${zmodule_dir}/{,zsh-}${zmodule}.plugin.zsh \
  27. ${zmodule_dir}/{,zsh-}${zmodule}.{z,}sh); do
  28. if [[ -f ${file} ]]; then
  29. zrecompile -pq ${file}
  30. break
  31. fi
  32. done
  33. fi
  34. done
  35. # zcompile all prompt setup scripts
  36. for file in ${ZIM_HOME}/modules/prompt/functions/prompt_*_setup; do
  37. zrecompile -pq ${file}
  38. done
  39. # syntax-highlighting
  40. for file in ${ZIM_HOME}/modules/syntax-highlighting/external/highlighters/**^test-data/*.zsh; do
  41. zrecompile -pq ${file}
  42. done
  43. zrecompile -pq ${ZIM_HOME}/modules/syntax-highlighting/external/zsh-syntax-highlighting.zsh
  44. # zsh-histery-substring-search
  45. zrecompile -pq ${ZIM_HOME}/modules/history-substring-search/external/zsh-history-substring-search.zsh
  46. ) &!