f4dc8c5be365668810783ced01a86ff8f251bfd7
- Author
- fedor <60283525+izumrudik@users.noreply.github.com>
- Committer
- GitHub <noreply@github.com>
- Date
Message
fix(tmux): use `$...SESSION_NAME` while attaching (#10946)
Diff
1diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh
2index b9bb66d59de3195f32a6eb48cc64eaf22a29c810..311c2e6a9b5e3c1ee7d00cd2548443746e1b1260 100644
3--- a/plugins/tmux/tmux.plugin.zsh
4+++ b/plugins/tmux/tmux.plugin.zsh
5@@ -73,7 +73,11 @@ function _zsh_tmux_plugin_run() {
6 [[ "$ZSH_TMUX_UNICODE" == "true" ]] && tmux_cmd+=(-u)
7
8 # Try to connect to an existing session.
9- [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach
10+ if [[ -n "$ZSH_TMUX_DEFAULT_SESSION_NAME" ]]; then
11+ [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach -t $ZSH_TMUX_DEFAULT_SESSION_NAME
12+ else
13+ [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach
14+ fi
15
16 # If failed, just run tmux, fixing the TERM variable if requested.
17 if [[ $? -ne 0 ]]; then
18@@ -83,9 +87,9 @@ function _zsh_tmux_plugin_run() {
19 tmux_cmd+=(-f "$ZSH_TMUX_CONFIG")
20 fi
21 if [[ -n "$ZSH_TMUX_DEFAULT_SESSION_NAME" ]]; then
22- $tmux_cmd new-session -s $ZSH_TMUX_DEFAULT_SESSION_NAME
23+ $tmux_cmd new-session -s $ZSH_TMUX_DEFAULT_SESSION_NAME
24 else
25- $tmux_cmd new-session
26+ $tmux_cmd new-session
27 fi
28 fi
29