54055c4530112439a04bf039d09c30c4b7330c84
- Author
- Marc Cornellà <marc.cornella@live.com>
- Committer
- Marc Cornellà <marc.cornella@live.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh
2index fb514a44c0202c48a2c426e8363a4d5afdc5cdf3..2d161c37719c322be2d0199250afd01fab00fef6 100644
3--- a/plugins/tmux/tmux.plugin.zsh
4+++ b/plugins/tmux/tmux.plugin.zsh
5@@ -1,6 +1,9 @@
6-#
7-# Aliases
8-#
9+if ! (( $+commands[tmux] )); then
10+ print "zsh tmux plugin: tmux not found. Please install tmux before using this plugin." >&2
11+ return 1
12+fi
13+
14+# ALIASES
15
16 alias ta='tmux attach -t'
17 alias tad='tmux attach -d -t'
18@@ -9,90 +12,79 @@ alias tl='tmux list-sessions'
19 alias tksv='tmux kill-server'
20 alias tkss='tmux kill-session -t'
21
22-# Only run if tmux is actually installed
23-if which tmux &> /dev/null
24- then
25- # Configuration variables
26- #
27- # Automatically start tmux
28- [[ -n "$ZSH_TMUX_AUTOSTART" ]] || ZSH_TMUX_AUTOSTART=false
29- # Only autostart once. If set to false, tmux will attempt to
30- # autostart every time your zsh configs are reloaded.
31- [[ -n "$ZSH_TMUX_AUTOSTART_ONCE" ]] || ZSH_TMUX_AUTOSTART_ONCE=true
32- # Automatically connect to a previous session if it exists
33- [[ -n "$ZSH_TMUX_AUTOCONNECT" ]] || ZSH_TMUX_AUTOCONNECT=true
34- # Automatically close the terminal when tmux exits
35- [[ -n "$ZSH_TMUX_AUTOQUIT" ]] || ZSH_TMUX_AUTOQUIT=$ZSH_TMUX_AUTOSTART
36- # Set term to screen or screen-256color based on current terminal support
37- [[ -n "$ZSH_TMUX_FIXTERM" ]] || ZSH_TMUX_FIXTERM=true
38- # Set '-CC' option for iTerm2 tmux integration
39- [[ -n "$ZSH_TMUX_ITERM2" ]] || ZSH_TMUX_ITERM2=false
40- # The TERM to use for non-256 color terminals.
41- # Tmux states this should be screen, but you may need to change it on
42- # systems without the proper terminfo
43- [[ -n "$ZSH_TMUX_FIXTERM_WITHOUT_256COLOR" ]] || ZSH_TMUX_FIXTERM_WITHOUT_256COLOR="screen"
44- # The TERM to use for 256 color terminals.
45- # Tmux states this should be screen-256color, but you may need to change it on
46- # systems without the proper terminfo
47- [[ -n "$ZSH_TMUX_FIXTERM_WITH_256COLOR" ]] || ZSH_TMUX_FIXTERM_WITH_256COLOR="screen-256color"
48+# CONFIGURATION VARIABLES
49+# Automatically start tmux
50+: ${ZSH_TMUX_AUTOSTART:=false}
51+# Only autostart once. If set to false, tmux will attempt to
52+# autostart every time your zsh configs are reloaded.
53+: ${ZSH_TMUX_AUTOSTART_ONCE:=true}
54+# Automatically connect to a previous session if it exists
55+: ${ZSH_TMUX_AUTOCONNECT:=true}
56+# Automatically close the terminal when tmux exits
57+: ${ZSH_TMUX_AUTOQUIT:=$ZSH_TMUX_AUTOSTART}
58+# Set term to screen or screen-256color based on current terminal support
59+: ${ZSH_TMUX_FIXTERM:=true}
60+# Set '-CC' option for iTerm2 tmux integration
61+: ${ZSH_TMUX_ITERM2:=false}
62+# The TERM to use for non-256 color terminals.
63+# Tmux states this should be screen, but you may need to change it on
64+# systems without the proper terminfo
65+: ${ZSH_TMUX_FIXTERM_WITHOUT_256COLOR:=screen}
66+# The TERM to use for 256 color terminals.
67+# Tmux states this should be screen-256color, but you may need to change it on
68+# systems without the proper terminfo
69+: ${ZSH_TMUX_FIXTERM_WITH_256COLOR:=screen-256color}
70+
71+# Determine if the terminal supports 256 colors
72+if [[ $(tput colors) == 256 ]]; then
73+ export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITH_256COLOR
74+else
75+ export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITHOUT_256COLOR
76+fi
77
78+# Set the correct local config file to use.
79+if [[ "$ZSH_TMUX_ITERM2" == "false" && -e "$HOME/.tmux.conf" ]]; then
80+ export _ZSH_TMUX_FIXED_CONFIG="${0:h:a}/tmux.extra.conf"
81+else
82+ export _ZSH_TMUX_FIXED_CONFIG="${0:h:a}/tmux.only.conf"
83+fi
84
85- # Get the absolute path to the current directory
86- local zsh_tmux_plugin_path="$(cd "$(dirname "$0")" && pwd)"
87+# Wrapper function for tmux.
88+function _zsh_tmux_plugin_run() {
89+ if [[ -n "$@" ]]; then
90+ command tmux "$@"
91+ return $?
92+ fi
93
94- # Determine if the terminal supports 256 colors
95- if [[ `tput colors` == "256" ]]
96- then
97- export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITH_256COLOR
98- else
99- export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITHOUT_256COLOR
100- fi
101+ local -a tmux_cmd=(command tmux)
102+ [[ "$ZSH_TMUX_ITERM2" == "true" ]] && tmux_cmd+=(-CC)
103
104- # Set the correct local config file to use.