From 0f3a5f745e3dd66449f49b4defc101c5ea597a37 Mon Sep 17 00:00:00 2001 From: alan blount Date: Tue, 11 Jul 2017 15:15:24 -0400 Subject: [PATCH] Detach from tmux if attached, before attach (#1088) If you are in a tmux session, and auto-start is enabled Then you `sudo su` and then `su ` it will re-attach, in a loop. This resolves that problem, by forcing a detach before a (re)attach. --- modules/tmux/init.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/tmux/init.zsh b/modules/tmux/init.zsh index aadf6bf..720fb04 100644 --- a/modules/tmux/init.zsh +++ b/modules/tmux/init.zsh @@ -37,8 +37,8 @@ if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" ]] && ( \ set-option -t "$tmux_session" destroy-unattached off &> /dev/null fi - # Attach to the 'prezto' session or to the last session used. - exec tmux $_tmux_iterm_integration attach-session + # Attach to the 'prezto' session or to the last session used. (detach first) + exec tmux $_tmux_iterm_integration attach-session -d fi #