From 9dd65d3982c1265d5cca67edecf8a2a8067dd7a5 Mon Sep 17 00:00:00 2001 From: Matt Henkel Date: Thu, 8 May 2014 21:04:39 -0600 Subject: [PATCH] Adding the ability to specify tmux session name. Change-Id: Iee7f34de4448e9ab5d383e6e2eb871639271fdb5 --- modules/tmux/README.md | 4 ++++ modules/tmux/init.zsh | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/tmux/README.md b/modules/tmux/README.md index 0e2f652..233d874 100644 --- a/modules/tmux/README.md +++ b/modules/tmux/README.md @@ -23,6 +23,10 @@ following line to *zpreztorc*: In both cases, it will create a background session named _prezto_ if the tmux server is not started. +You can change the default session name with: + + zstyle ':prezto:module:tmux' session 'YOUR DEFAULT SESSION NAME' + With `auto-start` enabled, you may want to control how multiple sessions are managed. The `destroy-unattached` option of tmux controls if the unattached sessions must be kept alive, making sessions available for later use, configured diff --git a/modules/tmux/init.zsh b/modules/tmux/init.zsh index 29b547f..a1bca27 100644 --- a/modules/tmux/init.zsh +++ b/modules/tmux/init.zsh @@ -25,10 +25,10 @@ if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" ]] && ( \ # Create a 'prezto' session if no session has been defined in tmux.conf. if ! tmux has-session 2> /dev/null; then - tmux_session='prezto' + zstyle -s ':prezto:module:tmux' session 'session' || session='prezto' tmux \ - new-session -d -s "$tmux_session" \; \ - set-option -t "$tmux_session" destroy-unattached off &> /dev/null + new-session -d -s "$session" \; \ + set-option -t "$session" destroy-unattached off &> /dev/null fi # Attach to the 'prezto' session or to the last session used.