Skip to content

Instantly share code, notes, and snippets.

@moshe
Last active June 1, 2019 06:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moshe/f042461cf6e014e5276b to your computer and use it in GitHub Desktop.
Save moshe/f042461cf6e014e5276b to your computer and use it in GitHub Desktop.
reload zshrc with signal

How To

Add those lines into your zshrc and now every time you update you zshrc run: reload_zsh

and all you zsh sessions will be updated.

be aware

  • for the first time you must source your zshrc manully otherwise they will terminated
  • running reload_zsh with root will close sessions for users that didnt add those lines.
# Reload zshrc on all sessions
TRAPHUP() {
print "Caught HUP, reloading zsh"
. ~/.zshrc
}
alias reload_zsh="killall -HUP zsh"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment