1diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh
2index 8dd20839957695115a1dbad38c073692941a7472..46c142b775c43157039982df8150f6c00ee3e4ef 100644
3--- a/plugins/tmux/tmux.plugin.zsh
4+++ b/plugins/tmux/tmux.plugin.zsh
5@@ -6,7 +6,7 @@
6 # Automatically close the terminal when tmux exits
7 [[ -n "$ZSH_TMUX_AUTOQUIT" ]] || ZSH_TMUX_AUTOQUIT=$ZSH_TMUX_AUTOSTART
8 # Set term to screen or screen-256color based on current terminal support
9-[[ -n "$ZSH_TMUX_FIXTERM" ]] || ZSH_TMUX_AUTOCONNECT=true
10+[[ -n "$ZSH_TMUX_FIXTERM" ]] || ZSH_TMUX_FIXTERM=true
1112 # Get the absolute path to the current directory
13 local zsh_tmux_plugin_path="$(cd "$(dirname "$0")" && pwd)"
14@@ -14,49 +14,50 @@ local zsh_tmux_plugin_path="$(cd "$(dirname "$0")" && pwd)"
15 # Determine if the terminal supports 256 colors
16 if [[ `tput colors` == "256" ]]
17 then
18- export $ZSH_TMUX_TERM="screen-256"
19+ export ZSH_TMUX_TERM="screen-256color"
20 else
21- export $ZSH_TMUX_TERM="screen"
22+ export ZSH_TMUX_TERM="screen"
23 fi
2425 # Local variable to store the local config file to use, if any.
26 local fixed_config=""
2728-# Set the correct local config file to use
29+# Set the correct local config file to use.
30 if [[ "$ZSH_TMUX_FIXTERM" == "true" ]]
31 then
32 if [[ -f $HOME/.tmux.conf || -h $HOME/.tmux.conf ]]
33 then
34 #use this when they have a ~/.tmux.conf
35- fixed_config=$zsh_tmux_plugin_path/tmux.extra.conf
36+ fixed_config="$zsh_tmux_plugin_path/tmux.extra.conf"
37 else
38 #use this when they don't have a ~/.tmux.conf
39- fixed_config=$zsh_tmux_plugin_path/tmux.only.conf
40+ fixed_config="$zsh_tmux_plugin_path/tmux.only.conf"
41 fi
42 fi
4344-# Override tmux with our function
45-function zsh_tmux_plugin_start()
46+# Wrapper function for tmux.
47+function zsh_tmux_plugin_run()
48 {
49 # We have other arguments, just run them
50- if [[ ! -n "$@" ]]
51+ if [[ -n "$@" ]]
52 then
53 \tmux $@
54 # Try to connect to an existing session.
55 elif [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]]
56 then
57- \tmux attach || tmux -f $fixed_config new-session
58+ \tmux attach || \tmux `[[ -n "$fixed_config" ]] && echo '-f ' $fixed_config` new-session
59 [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit
60- # Just try to fix the TERM variable.
61+ # Just run tmux, fixing the TERM variable if requested.
62 else
63- \tmux -f $fixed_config
64+ \tmux `[[ -n "$fixed_config" ]] && echo '-f ' $fixed_config`
65 [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit
66 fi
67 }
6869+# Alias tmux to our wrapper function.
70 alias tmux=zsh_tmux_plugin_start
7172 if [[ "$ZSH_TMUX_AUTOSTART" == "true" ]]
73 then
74- zsh_tmux_plugin_start
75+ zsh_tmux_plugin_run
76 fi