Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Oh My Zsh
Commits
691630a8
Commit
691630a8
authored
Feb 26, 2013
by
Josh Matthews
Browse files
Adding option to prevent autostarting tmux more than once in the same session.
parent
f096644c
Changes
1
Hide whitespace changes
Inline
Side-by-side
plugins/tmux/tmux.plugin.zsh
View file @
691630a8
# Configuration variables
# Configuration variables
#
# Automatically start tmux
# Automatically start tmux
[[
-n
"
$ZSH_TMUX_AUTOSTART
"
]]
||
ZSH_TMUX_AUTOSTART
=
false
[[
-n
"
$ZSH_TMUX_AUTOSTART
"
]]
||
ZSH_TMUX_AUTOSTART
=
false
# Only autostart once. If set to false, tmux will attempt to
# autostart every time your zsh configs are reloaded.
[[
-n
"
$ZSH_TMUX_AUTOSTART_ONCE
"
]]
||
ZSH_TMUX_AUTOSTART_ONCE
=
true
# Automatically connect to a previous session if it exists
# Automatically connect to a previous session if it exists
[[
-n
"
$ZSH_TMUX_AUTOCONNECT
"
]]
||
ZSH_TMUX_AUTOCONNECT
=
true
[[
-n
"
$ZSH_TMUX_AUTOCONNECT
"
]]
||
ZSH_TMUX_AUTOCONNECT
=
true
# Automatically close the terminal when tmux exits
# Automatically close the terminal when tmux exits
...
@@ -8,6 +12,7 @@
...
@@ -8,6 +12,7 @@
# Set term to screen or screen-256color based on current terminal support
# Set term to screen or screen-256color based on current terminal support
[[
-n
"
$ZSH_TMUX_FIXTERM
"
]]
||
ZSH_TMUX_FIXTERM
=
true
[[
-n
"
$ZSH_TMUX_FIXTERM
"
]]
||
ZSH_TMUX_FIXTERM
=
true
# Get the absolute path to the current directory
# Get the absolute path to the current directory
local
zsh_tmux_plugin_path
=
"
$(
cd
"
$(
dirname
"
$0
"
)
"
&&
pwd
)
"
local
zsh_tmux_plugin_path
=
"
$(
cd
"
$(
dirname
"
$0
"
)
"
&&
pwd
)
"
...
@@ -54,7 +59,13 @@ function zsh_tmux_plugin_run()
...
@@ -54,7 +59,13 @@ function zsh_tmux_plugin_run()
# Alias tmux to our wrapper function.
# Alias tmux to our wrapper function.
alias
tmux
=
zsh_tmux_plugin_start
alias
tmux
=
zsh_tmux_plugin_start
# Autostart if not already in tmux and enabled.
if
[[
!
-n
"
$TMUX
"
&&
"
$ZSH_TMUX_AUTOSTART
"
==
"true"
]]
if
[[
!
-n
"
$TMUX
"
&&
"
$ZSH_TMUX_AUTOSTART
"
==
"true"
]]
then
then
zsh_tmux_plugin_run
# Actually don't autostart if we already did and multiple autostarts are disabled.
if
[[
"
$ZSH_TMUX_AUTOSTART_ONCE
"
==
"false"
||
"
$ZSH_TMUX_AUTOSTARTED
"
!=
"true"
]]
then
export
ZSH_TMUX_AUTOSTARTED
=
true
zsh_tmux_plugin_run
fi
fi
fi
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment