Skip to content

Instantly share code, notes, and snippets.

@j1cs
Created September 4, 2024 19:17
Show Gist options
  • Save j1cs/247f80d9a6e5d818339f8134c7b870f8 to your computer and use it in GitHub Desktop.
Save j1cs/247f80d9a6e5d818339f8134c7b870f8 to your computer and use it in GitHub Desktop.
# Add this to your .zprofile or .zshrc
case $TERM in
xterm*|rxvt*)
precmd() {
# Use the appropriate shell variables to get the username and hostname
local user="%n" # %n is the username
local host="%m" # %m is the hostname up to the first '.'
print -Pn "\e]0;${user}@${host}\a"
}
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment