summaryrefslogtreecommitdiff
path: root/plugins/tmux
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2023-01-17 12:46:15 +0100
committerTuowen Zhao <ztuowen@gmail.com>2023-01-17 12:46:15 +0100
commitdb7efd2336e4dbe6abf321b00dbc11bc5afb1355 (patch)
tree720a58ff82bf0a0e0167594131f872d453b1828e /plugins/tmux
parent04b8c052e5b624873b352889423c753ed1baf9c4 (diff)
parent8f0e296dbf27026ea0515ebae0d3cc41f236ecdc (diff)
downloadzsh-db7efd2336e4dbe6abf321b00dbc11bc5afb1355.tar.gz
zsh-db7efd2336e4dbe6abf321b00dbc11bc5afb1355.tar.bz2
zsh-db7efd2336e4dbe6abf321b00dbc11bc5afb1355.zip
Merge remote-tracking branch 'github/master'
Diffstat (limited to 'plugins/tmux')
-rw-r--r--plugins/tmux/tmux.plugin.zsh10
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