diff options
author | fedor <60283525+izumrudik@users.noreply.github.com> | 2022-12-08 14:38:13 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-08 12:38:13 +0100 |
commit | f4dc8c5be365668810783ced01a86ff8f251bfd7 (patch) | |
tree | 28c00a308ecbc88d41634c61d9c546b11ad0b1eb | |
parent | b692ff2e1597816563cbdaeeedf0966ad9babeca (diff) | |
download | zsh-f4dc8c5be365668810783ced01a86ff8f251bfd7.tar.gz zsh-f4dc8c5be365668810783ced01a86ff8f251bfd7.tar.bz2 zsh-f4dc8c5be365668810783ced01a86ff8f251bfd7.zip |
fix(tmux): use `$...SESSION_NAME` while attaching (#10946)
-rw-r--r-- | plugins/tmux/tmux.plugin.zsh | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index b9bb66d59..311c2e6a9 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -73,7 +73,11 @@ function _zsh_tmux_plugin_run() { [[ "$ZSH_TMUX_UNICODE" == "true" ]] && tmux_cmd+=(-u) # Try to connect to an existing session. - [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach + if [[ -n "$ZSH_TMUX_DEFAULT_SESSION_NAME" ]]; then + [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach -t $ZSH_TMUX_DEFAULT_SESSION_NAME + else + [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach + fi # If failed, just run tmux, fixing the TERM variable if requested. if [[ $? -ne 0 ]]; then @@ -83,9 +87,9 @@ function _zsh_tmux_plugin_run() { tmux_cmd+=(-f "$ZSH_TMUX_CONFIG") fi if [[ -n "$ZSH_TMUX_DEFAULT_SESSION_NAME" ]]; then - $tmux_cmd new-session -s $ZSH_TMUX_DEFAULT_SESSION_NAME + $tmux_cmd new-session -s $ZSH_TMUX_DEFAULT_SESSION_NAME else - $tmux_cmd new-session + $tmux_cmd new-session fi fi |