Permalink
Browse files

Disable auto-start for multiplexers with SSH

Do not automatically start multiplexers if the machine is access with a
remote connection (SSH).
This avoids having the 'remote' screen or tmux session embedded in the local
session
  • Loading branch information...
ColinHebert committed Sep 16, 2012
1 parent fb4ffd9 commit 75682fb87f018631a53d0e2669afcfcfbd9f66e7
Showing with 27 additions and 2 deletions.
  1. +9 −0 modules/screen/README.md
  2. +2 −1 modules/screen/init.zsh
  3. +9 −0 modules/tmux/README.md
  4. +2 −1 modules/tmux/init.zsh
  5. +5 −0 runcoms/zpreztorc
View
@@ -14,6 +14,15 @@ To enable this feature, add the following line to *zpreztorc*:
zstyle ':prezto:module:screen' auto-start 'yes'
+#### SSH and auto-start
+
+To avoid having screen sessions inside screen sessions, auto-start is disabled for
+SSH access.
+
+It is possible to re-enable auto-start for SSH sessions with
+
+ zstyle ':prezto:module:screen' remote 'yes'
+
Aliases
-------
View
@@ -14,7 +14,8 @@ fi
# Auto Start
#
-if [[ -z "$STY" ]] && zstyle -t ':prezto:module:screen' auto-start; then
+if ( [[ -z "$SSH_CLIENT" ]] || zstyle -t ':prezto:module:screen' remote ) &&
+ ( [[ -z "$STY" ]] && zstyle -t ':prezto:module:screen' auto-start ); then
session="$(
screen -list 2> /dev/null \
| sed '1d;$d' \
View
@@ -21,6 +21,15 @@ To avoid keeping open sessions, this module sets `destroy-unattached off` on
the background session and `destroy-unattached on` on every other session
(global setting).
+#### SSH and auto-start
+
+To avoid having tmux sessions inside tmux sessions, auto-start is disabled for
+SSH access.
+
+It is possible to re-enable auto-start for SSH sessions with
+
+ zstyle ':prezto:module:tmux' remote 'yes'
+
Aliases
-------
View
@@ -15,7 +15,8 @@ fi
# Auto Start
#
-if [[ -z "$TMUX" ]] && zstyle -t ':prezto:module:tmux' auto-start; then
+if ( [[ -z "$SSH_CLIENT" ]] || zstyle -t ':prezto:module:tmux' remote ) &&
+ ( [[ -z "$TMUX" ]] && zstyle -t ':prezto:module:tmux' auto-start ); then
tmux_session='#Prezto'
if ! tmux has-session -t "$tmux_session" 2> /dev/null; then
View
@@ -81,6 +81,9 @@ zstyle ':prezto:module:prompt' theme 'sorin'
# Auto start a session when Zsh is launched.
# zstyle ':prezto:module:screen' auto-start 'yes'
+# Allow auto-start with an SSH connection
+# zstyle ':prezto:module:screen' remote 'yes'
+
#
# SSH-Agent
#
@@ -118,3 +121,5 @@ zstyle ':prezto:module:terminal' auto-title 'yes'
# Auto start a session when Zsh is launched.
# zstyle ':prezto:module:tmux' auto-start 'yes'
+# Allow auto-start with an SSH connection
+# zstyle ':prezto:module:tmux' remote 'yes'

0 comments on commit 75682fb

Please sign in to comment.