diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2012-08-01 12:02:47 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2012-08-01 12:02:47 +1200 |
commit | 375273ebd756cebdc8bbc13fc1cc71e0922fe160 (patch) | |
tree | 1c4bd0d2990275a07d3e2282ab557ad5cf6da4f6 | |
parent | New commentary commits (diff) | |
download | dotfiles-375273ebd756cebdc8bbc13fc1cc71e0922fe160.tar.gz dotfiles-375273ebd756cebdc8bbc13fc1cc71e0922fe160.zip |
Attach rather than create tmux sessions
When called with no arguments
-rw-r--r-- | bash/bashrc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/bash/bashrc b/bash/bashrc index 56473547..7bcd7ef5 100644 --- a/bash/bashrc +++ b/bash/bashrc @@ -153,6 +153,15 @@ alias ed='ed -p:' # Make gdb shut up. alias gdb='gdb -q' +# Attach to existing tmux session rather than create a new one if possible. +function tmux { + if [[ -n "$*" ]]; then + command tmux $* + else + command tmux attach &>/dev/null || command tmux + fi +} + # Decide on color for prompt. if [[ $EUID -eq 0 ]]; then COLOR_PROMPT=${COLOR_ROOT} |