aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d/tmux.bash
diff options
context:
space:
mode:
Diffstat (limited to 'bash/bashrc.d/tmux.bash')
-rw-r--r--bash/bashrc.d/tmux.bash9
1 files changed, 9 insertions, 0 deletions
diff --git a/bash/bashrc.d/tmux.bash b/bash/bashrc.d/tmux.bash
new file mode 100644
index 00000000..fd623271
--- /dev/null
+++ b/bash/bashrc.d/tmux.bash
@@ -0,0 +1,9 @@
+# Attach to existing tmux session rather than create a new one if possible
+function tmux {
+ if [[ -n "$*" ]]; then
+ command tmux $*
+ else
+ command tmux attach -d &>/dev/null || command tmux
+ fi
+}
+