diff options
author | Shahin Sorkh <sorkh.shahin@protonmail.com> | 2021-11-08 18:02:09 +0330 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-08 15:32:09 +0100 |
commit | 55682e36920e2ab7633fc6eee11466d3faed0bf8 (patch) | |
tree | fd224cbfda2a495d8e3d2bfe67de4dbfcf584091 | |
parent | 90903779b942a12d273e8d158ad97b252dc74360 (diff) | |
download | zsh-55682e36920e2ab7633fc6eee11466d3faed0bf8.tar.gz zsh-55682e36920e2ab7633fc6eee11466d3faed0bf8.tar.bz2 zsh-55682e36920e2ab7633fc6eee11466d3faed0bf8.zip |
feat(tmux): set session name with `ZSH_TMUX_DEFAULT_SESSION_NAME` (#9063)
-rw-r--r-- | plugins/tmux/README.md | 1 | ||||
-rw-r--r-- | plugins/tmux/tmux.plugin.zsh | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/plugins/tmux/README.md b/plugins/tmux/README.md index 2ceaf1ad5..551814a39 100644 --- a/plugins/tmux/README.md +++ b/plugins/tmux/README.md @@ -39,3 +39,4 @@ The plugin also supports the following: | `ZSH_TMUX_FIXTERM_WITH_256COLOR` | `$TERM` to use for 256-color terminals (default: `screen-256color` | | `ZSH_TMUX_CONFIG` | Set the configuration path (default: `$HOME/.tmux.conf`) | | `ZSH_TMUX_UNICODE` | Set `tmux -u` option to support unicode | +| `ZSH_TMUX_DEFAULT_SESSION_NAME` | Set tmux default session name when autostart is enabled | diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index e52443a71..0ea3aa02a 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -76,7 +76,11 @@ function _zsh_tmux_plugin_run() { elif [[ -e "$ZSH_TMUX_CONFIG" ]]; then tmux_cmd+=(-f "$ZSH_TMUX_CONFIG") fi - $tmux_cmd new-session + if [[ -n "$ZSH_TMUX_DEFAULT_SESSION_NAME" ]]; then + $tmux_cmd new-session -s $ZSH_TMUX_DEFAULT_SESSION_NAME + else + $tmux_cmd new-session + fi fi if [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]]; then |