about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--home/zsh/tmux.zsh10
1 files changed, 8 insertions, 2 deletions
diff --git a/home/zsh/tmux.zsh b/home/zsh/tmux.zsh
index 4120512..97944f5 100644
--- a/home/zsh/tmux.zsh
+++ b/home/zsh/tmux.zsh
@@ -1,3 +1,9 @@
-if command -v tmux &> /dev/null && [ -z "$TMUX" ]; then
-  tmux attach -t default || tmux new -s default
+# If we're not in an ssh connection, and tmux is installed, and we're
+# not already in a tmux session, attach to the session named
+# 'default', and if the session does not exist, start one named
+# 'default'
+if [ -z "$SSH_CONNECTION" ]; then
+  if command -v tmux &> /dev/null && [ -z "$TMUX" ]; then
+    tmux attach -t default || tmux new -s default
+  fi
 fi