Skip to content

Instantly share code, notes, and snippets.

@markstos
Forked from florianbeer/set-tmux-title
Created October 26, 2017 19:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markstos/e6056fd8062862fc9ba7ef63570e8389 to your computer and use it in GitHub Desktop.
Save markstos/e6056fd8062862fc9ba7ef63570e8389 to your computer and use it in GitHub Desktop.
Set tmux pane title to short hostname on ssh connections
ssh() {
if [ "$(ps -p $(ps -p $$ -o ppid=) -o comm=)" = "tmux" ]; then
tmux rename-window "$(echo $* | cut -d . -f 1)"
command ssh "$@"
tmux set-window-option automatic-rename "on" 1>/dev/null
else
command ssh "$@"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment