zsh_reload.plugin.zsh 503 B

12345678910111213141516171819202122
  1. src() {
  2. local cache="$ZSH_CACHE_DIR"
  3. autoload -U compinit zrecompile
  4. compinit -i -d "$cache/zcomp-$HOST"
  5. for f in ${ZDOTDIR:-~}/.zshrc "$cache/zcomp-$HOST"; do
  6. zrecompile -p $f && command rm -f $f.zwc.old
  7. done
  8. # Use $SHELL if it's available and a zsh shell
  9. local shell="$ZSH_ARGZERO"
  10. if [[ "${${SHELL:t}#-}" = zsh ]]; then
  11. shell="$SHELL"
  12. fi
  13. # Remove leading dash if login shell and run accordingly
  14. if [[ "${shell:0:1}" = "-" ]]; then
  15. exec -l "${shell#-}"
  16. else
  17. exec "$shell"
  18. fi
  19. }