Diff
1diff --git a/plugins/tmux/README.md b/plugins/tmux/README.md
2index a253457f2b803da7e5204fe4bec7bbfd19c9891c..50f8b2c2f21a0cd48d2d4a739503a4219eb36316 100644
3--- a/plugins/tmux/README.md
4+++ b/plugins/tmux/README.md
5@@ -1,7 +1,7 @@
6 # tmux
7
8-This plugin provides aliases for [tmux](https://tmux.github.io/), the terminal multiplexer.
9-To use it add `tmux` to the plugins array in your zshrc file.
10+This plugin provides aliases for [tmux](https://tmux.github.io/), the terminal multiplexer. To use it add
11+`tmux` to the plugins array in your zshrc file.
12
13 ```zsh
14 plugins=(... tmux)
15@@ -29,17 +29,17 @@ The plugin also supports the following:
16
17 ## Configuration Variables
18
19-| Variable | Description |
20-| ----------------------------------- | ------------------------------------------------------------------------------------------- |
21-| `ZSH_TMUX_AUTOSTART` | Automatically starts tmux (default: `false`) |
22-| `ZSH_TMUX_AUTOSTART_ONCE` | Autostart only if tmux hasn't been started previously (default: `true`) |
23-| `ZSH_TMUX_AUTOCONNECT` | Automatically connect to a previous session if it exits (default: `true`) |
24-| `ZSH_TMUX_AUTOQUIT` | Automatically closes terminal once tmux exits (default: `ZSH_TMUX_AUTOSTART`) |
25-| `ZSH_TMUX_CONFIG` | Set the configuration path (default: `$HOME/.tmux.conf`, `$XDG_CONFIG_HOME/tmux/tmux.conf`) |
26-| `ZSH_TMUX_DEFAULT_SESSION_NAME` | Set tmux default session name when autostart is enabled |
27-| `ZSH_TMUX_DETACHED` | Set the detached mode (default: `false`) |
28-| `ZSH_TMUX_FIXTERM` | Sets `$TERM` to 256-color term or not based on current terminal support |
29-| `ZSH_TMUX_FIXTERM_WITHOUT_256COLOR` | `$TERM` to use for non 256-color terminals (default: `screen`) |
30-| `ZSH_TMUX_FIXTERM_WITH_256COLOR` | `$TERM` to use for 256-color terminals (default: `screen-256color` |
31-| `ZSH_TMUX_ITERM2` | Sets the `-CC` option for iTerm2 tmux integration (default: `false`) |
32-| `ZSH_TMUX_UNICODE` | Set `tmux -u` option to support unicode |
33+| Variable | Description |
34+| ----------------------------------- | ----------------------------------------------------------------------------------------------------------- |
35+| `ZSH_TMUX_AUTOSTART` | Automatically starts tmux (default: `false`) |
36+| `ZSH_TMUX_AUTOSTART_ONCE` | Autostart only if tmux hasn't been started previously (default: `true`) |
37+| `ZSH_TMUX_AUTOCONNECT` | Automatically connect to a previous session if it exits (default: `true`) |
38+| `ZSH_TMUX_AUTOQUIT` | Automatically closes terminal once tmux exits (default: `ZSH_TMUX_AUTOSTART`) |
39+| `ZSH_TMUX_CONFIG` | Set the configuration path (default: `$HOME/.tmux.conf`, `$XDG_CONFIG_HOME/tmux/tmux.conf`) |
40+| `ZSH_TMUX_DEFAULT_SESSION_NAME` | Set tmux default session name when autostart is enabled |
41+| `ZSH_TMUX_DETACHED` | Set the detached mode (default: `false`) |
42+| `ZSH_TMUX_FIXTERM` | Sets `$TERM` to 256-color term or not based on current terminal support |
43+| `ZSH_TMUX_FIXTERM_WITHOUT_256COLOR` | `$TERM` to use for non 256-color terminals (default: `tmux` if available, `screen` otherwise) |
44+| `ZSH_TMUX_FIXTERM_WITH_256COLOR` | `$TERM` to use for 256-color terminals (default: `tmux-256color` if available, `screen-256color` otherwise) |
45+| `ZSH_TMUX_ITERM2` | Sets the `-CC` option for iTerm2 tmux integration (default: `false`) |
46+| `ZSH_TMUX_UNICODE` | Set `tmux -u` option to support unicode |
47diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh
48index 0ecb0a5b5a5cd697962bb1d1654d0c8d1276ffb1..09e326344f705a8d844f033e5f8fd7ca997f2ae3 100644
49--- a/plugins/tmux/tmux.plugin.zsh
50+++ b/plugins/tmux/tmux.plugin.zsh
51@@ -20,13 +20,21 @@ fi
52 # Set '-CC' option for iTerm2 tmux integration
53 : ${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+# Tmux states this should be tmux|screen, but you may need to change it on
57 # systems without the proper terminfo
58-: ${ZSH_TMUX_FIXTERM_WITHOUT_256COLOR:=screen}
59+if [[ -e /usr/share/terminfo/t/tmux ]]; then
60+ : ${ZSH_TMUX_FIXTERM_WITHOUT_256COLOR:=tmux}
61+else
62+ : ${ZSH_TMUX_FIXTERM_WITHOUT_256COLOR:=screen}
63+fi
64 # The TERM to use for 256 color terminals.
65-# Tmux states this should be screen-256color, but you may need to change it on
66+# Tmux states this should be (tmux|screen)-256color, but you may need to change it on
67 # systems without the proper terminfo
68-: ${ZSH_TMUX_FIXTERM_WITH_256COLOR:=screen-256color}
69+if [[ -e /usr/share/terminfo/t/tmux-256color ]]; then
70+ : ${ZSH_TMUX_FIXTERM_WITH_256COLOR:=tmux-256color}
71+else
72+ : ${ZSH_TMUX_FIXTERM_WITH_256COLOR:=screen-256color}
73+fi
74 # Set the configuration path
75 if [[ -e $HOME/.tmux.conf ]]; then
76 : ${ZSH_TMUX_CONFIG:=$HOME/.tmux.conf}