aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc
diff options
context:
space:
mode:
Diffstat (limited to 'bash/bashrc')
-rw-r--r--bash/bashrc9
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}