[Fix #543] Do not set tmux destroy-unattached

Signed-off-by: Sorin Ionescu <sorin.ionescu@gmail.com>
main
Xavier Cambar 11 years ago committed by Sorin Ionescu
parent 10cf701864
commit 478653fab2

@ -20,12 +20,15 @@ following line to *zpreztorc*:
zstyle ':prezto:module:tmux:auto-start' remote 'yes' zstyle ':prezto:module:tmux:auto-start' remote 'yes'
In both cases, it will create a background session named _#Prezto_ and attach In both cases, it will create a background session named _prezto_ if the tmux
every new shell to it. server is not started.
To avoid keeping open sessions, this module sets `destroy-unattached off` on With `auto-start` enabled, you may want to control how multiple sessions are
the background session and `destroy-unattached on` on every other session managed. The `destroy-unattached` option of tmux controls if the unattached
(global setting). sessions must be kept alive, making sessions available for later use, configured
in *tmux.conf*:
set-option -g destroy-unattached [on | off]
Aliases Aliases
------- -------
@ -54,6 +57,7 @@ Authors
- [Sorin Ionescu](https://github.com/sorin-ionescu) - [Sorin Ionescu](https://github.com/sorin-ionescu)
- [Colin Hebert](https://github.com/ColinHebert) - [Colin Hebert](https://github.com/ColinHebert)
- [Georges Discry](https://github.com/gdiscry) - [Georges Discry](https://github.com/gdiscry)
- [Xavier Cambar](https://github.com/xcambar)
[1]: http://tmux.sourceforge.net [1]: http://tmux.sourceforge.net
[2]: https://github.com/sorin-ionescu/prezto/issues/62 [2]: https://github.com/sorin-ionescu/prezto/issues/62

@ -5,6 +5,7 @@
# Sorin Ionescu <sorin.ionescu@gmail.com> # Sorin Ionescu <sorin.ionescu@gmail.com>
# Colin Hebert <hebert.colin@gmail.com> # Colin Hebert <hebert.colin@gmail.com>
# Georges Discry <georges@discry.be> # Georges Discry <georges@discry.be>
# Xavier Cambar <xcambar@gmail.com>
# #
# Return if requirements are not found. # Return if requirements are not found.
@ -22,25 +23,16 @@ if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" ]] && ( \
); then ); then
tmux_session='prezto' tmux_session='prezto'
if ! tmux has-session -t "$tmux_session" 2> /dev/null; then # Create a first 'prezto' session if tmux is starting.
# Ensure that tmux server is started. if ! tmux has-session 2> /dev/null; then
tmux start-server tmux \
start-server \; \
# Disable the destruction of unattached sessions globally. new-session -d -s "$tmux_session" \; \
tmux set-option -g destroy-unattached off &> /dev/null set-option -t "$tmux_session" destroy-unattached off &> /dev/null
# Create a new session.
tmux new-session -d -s "$tmux_session"
# Disable the destruction of the new, unattached session.
tmux set-option -t "$tmux_session" destroy-unattached off &> /dev/null
# Enable the destruction of unattached sessions globally to prevent
# an abundance of open, detached sessions.
tmux set-option -g destroy-unattached on &> /dev/null
fi fi
exec tmux new-session -t "$tmux_session" # Attach to the 'prezto' session or to the last session used.
exec tmux attach-session
fi fi
# #

@ -152,4 +152,3 @@ zstyle ':prezto:module:prompt' theme 'sorin'
# Auto start a session when Zsh is launched in a SSH connection. # Auto start a session when Zsh is launched in a SSH connection.
# zstyle ':prezto:module:tmux:auto-start' remote 'yes' # zstyle ':prezto:module:tmux:auto-start' remote 'yes'

Loading…
Cancel
Save