0008534147a28eeeea52cfd92154ae2e801678ae

Author
Carlo Sala <carlosalag@protonmail.com>
Committer
Carlo Sala <carlosalag@protonmail.com>
Date

Message

fix(tmux): regression with detached sessions

See https://github.com/ohmyzsh/ohmyzsh/pull/12242#issuecomment-1973236605

Diff

 1diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh
 2index 436e2671d06a9673c5de1ece219320876501bba7..11550d6879d2ba888eb654c3356cb9550642adf8 100644
 3--- a/plugins/tmux/tmux.plugin.zsh
 4+++ b/plugins/tmux/tmux.plugin.zsh
 5@@ -100,11 +100,13 @@ function _zsh_tmux_plugin_run() {
 6   [[ "$ZSH_TMUX_ITERM2" == "true" ]] && tmux_cmd+=(-CC)
 7   [[ "$ZSH_TMUX_UNICODE" == "true" ]] && tmux_cmd+=(-u)
 8 
 9+  local _detached=""
10+  [[ "$ZSH_TMUX_DETACHED" == "true" ]] && _detached="-d"
11   # Try to connect to an existing session.
12   if [[ -n "$ZSH_TMUX_DEFAULT_SESSION_NAME" ]]; then
13-    [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach ${ZSH_TMUX_DETACHED:+"-d"} -t $ZSH_TMUX_DEFAULT_SESSION_NAME
14+    [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach $_detached -t $ZSH_TMUX_DEFAULT_SESSION_NAME
15   else
16-    [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach ${ZSH_TMUX_DETACHED:+"-d"}
17+    [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach $_detached
18   fi
19 
20   # If failed, just run tmux, fixing the TERM variable if requested.