summaryrefslogtreecommitdiff
path: root/plugins/tmux
diff options
context:
space:
mode:
authorStelFux <22601105+StelFux@users.noreply.github.com>2019-11-08 21:44:44 +0100
committerMarc Cornellà <marc.cornella@live.com>2019-11-08 21:44:44 +0100
commit86b39cfa0a42cd0962be2b8072e73229280c362b (patch)
treee789fdc8b62e73fba87ad42e2c56672917dc2b5e /plugins/tmux
parentef96a38fa599c983823f0e1ef530de847ee76da0 (diff)
downloadzsh-86b39cfa0a42cd0962be2b8072e73229280c362b.tar.gz
zsh-86b39cfa0a42cd0962be2b8072e73229280c362b.tar.bz2
zsh-86b39cfa0a42cd0962be2b8072e73229280c362b.zip
tmux: allow to define a custom configuration path (#7606)
Diffstat (limited to 'plugins/tmux')
-rw-r--r--plugins/tmux/README.md1
-rw-r--r--plugins/tmux/tmux.extra.conf2
-rw-r--r--plugins/tmux/tmux.plugin.zsh9
3 files changed, 8 insertions, 4 deletions
diff --git a/plugins/tmux/README.md b/plugins/tmux/README.md
index e887ceebb..1e25af38f 100644
--- a/plugins/tmux/README.md
+++ b/plugins/tmux/README.md
@@ -37,3 +37,4 @@ The plugin also supports the following -
| `ZSH_TMUX_ITERM2` | Sets the `-CC` option for iTerm2 tmux integration (default: `false`) |
| `ZSH_TMUX_FIXTERM_WITHOUT_256COLOR` | `$TERM` to use for non 256-color terminals (default: `screen`) |
| `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`) | \ No newline at end of file
diff --git a/plugins/tmux/tmux.extra.conf b/plugins/tmux/tmux.extra.conf
index beffd380c..3420d19d4 100644
--- a/plugins/tmux/tmux.extra.conf
+++ b/plugins/tmux/tmux.extra.conf
@@ -1,2 +1,2 @@
set -g default-terminal $ZSH_TMUX_TERM
-source $HOME/.tmux.conf
+source $ZSH_TMUX_CONFIG \ No newline at end of file
diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh
index 2f3c3e79d..d7b299690 100644
--- a/plugins/tmux/tmux.plugin.zsh
+++ b/plugins/tmux/tmux.plugin.zsh
@@ -34,6 +34,8 @@ alias tkss='tmux kill-session -t'
# Tmux states this should be screen-256color, but you may need to change it on
# systems without the proper terminfo
: ${ZSH_TMUX_FIXTERM_WITH_256COLOR:=screen-256color}
+# Set the configuration path
+: ${ZSH_TMUX_CONFIG:=$HOME/.tmux.conf}
# Determine if the terminal supports 256 colors
if [[ $terminfo[colors] == 256 ]]; then
@@ -43,7 +45,7 @@ else
fi
# Set the correct local config file to use.
-if [[ "$ZSH_TMUX_ITERM2" == "false" && -e "$HOME/.tmux.conf" ]]; then
+if [[ "$ZSH_TMUX_ITERM2" == "false" && -e "$ZSH_TMUX_CONFIG" ]]; then
export _ZSH_TMUX_FIXED_CONFIG="${0:h:a}/tmux.extra.conf"
else
export _ZSH_TMUX_FIXED_CONFIG="${0:h:a}/tmux.only.conf"
@@ -65,8 +67,9 @@ function _zsh_tmux_plugin_run() {
# If failed, just run tmux, fixing the TERM variable if requested.
if [[ $? -ne 0 ]]; then
- [[ "$ZSH_TMUX_FIXTERM" == "true" ]] && tmux_cmd+=(-f "$_ZSH_TMUX_FIXED_CONFIG")
- $tmux_cmd new-session
+ [[ "$ZSH_TMUX_FIXTERM" == "true" ]] && tmux_cmd+=(-f "$_ZSH_TMUX_FIXED_CONFIG") || \
+ [[ -e "$ZSH_TMUX_CONFIG" ]] && tmux_cmd+=(-f "$ZSH_TMUX_CONFIG")
+ $tmux_cmd new-session
fi
if [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]]; then