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