Skip to content

Instantly share code, notes, and snippets.

View erikmansson's full-sized avatar

Erik Månsson erikmansson

View GitHub Profile
@nevesnunes
nevesnunes / set-tmux-title.sh
Created July 6, 2020 12:55 — forked from florianbeer/set-tmux-title
Set tmux pane title to short hostname on ssh connections
ssh() {
# grep -w: match command names such as "tmux-2.1" or "tmux: server"
if ps -p $$ -o ppid= \
| xargs -i ps -p {} -o comm= \
| grep -qw tmux; then
# Note: Options without parameter were hardcoded,
# in order to distinguish an option's parameter from the destination.
#
# s/[[:space:]]*\(\( | spaces before options
# \(-[46AaCfGgKkMNnqsTtVvXxYy]\)\| | option without parameter