55682e36920e2ab7633fc6eee11466d3faed0bf8
- Author
- Shahin Sorkh <sorkh.shahin@protonmail.com>
- Committer
- GitHub <noreply@github.com>
- Date
Message
feat(tmux): set session name with `ZSH_TMUX_DEFAULT_SESSION_NAME` (#9063)
Diff
1diff --git a/plugins/tmux/README.md b/plugins/tmux/README.md
2index 2ceaf1ad5d00fb129c1a88117d64eda9a17ce8bf..551814a39b442fdc5a3107230eea23fcf4a9d518 100644
3--- a/plugins/tmux/README.md
4+++ b/plugins/tmux/README.md
5@@ -39,3 +39,4 @@ The plugin also supports the following:
6 | `ZSH_TMUX_FIXTERM_WITH_256COLOR` | `$TERM` to use for 256-color terminals (default: `screen-256color` |
7 | `ZSH_TMUX_CONFIG` | Set the configuration path (default: `$HOME/.tmux.conf`) |
8 | `ZSH_TMUX_UNICODE` | Set `tmux -u` option to support unicode |
9+| `ZSH_TMUX_DEFAULT_SESSION_NAME` | Set tmux default session name when autostart is enabled |
10diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh
11index e52443a717cb160c101af7abda04a7ef88c01de5..0ea3aa02a04e17b6fd1ffaf48b7b0370d7eaed11 100644
12--- a/plugins/tmux/tmux.plugin.zsh
13+++ b/plugins/tmux/tmux.plugin.zsh
14@@ -76,7 +76,11 @@ function _zsh_tmux_plugin_run() {
15 elif [[ -e "$ZSH_TMUX_CONFIG" ]]; then
16 tmux_cmd+=(-f "$ZSH_TMUX_CONFIG")
17 fi
18- $tmux_cmd new-session
19+ if [[ -n "$ZSH_TMUX_DEFAULT_SESSION_NAME" ]]; then
20+ $tmux_cmd new-session -s $ZSH_TMUX_DEFAULT_SESSION_NAME
21+ else
22+ $tmux_cmd new-session
23+ fi
24 fi
25
26 if [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]]; then