Last active window indication feature introduced by pull request #864
causes undesired behavior on older versions of tmux. Add version
checking to determine which method for feature implementation to use,
dropping the feature entirely for tmux versions less that v1.8. For tmux
v1.9, use the newer 'window-status-last-style' option rather than the
deprecated (starting with v1.9) 'window-status-last-fg' option. Ideally,
the other `foo-{attr,fg,bg}` options used in the `tmux` powerline config
file should also be version checked and replaced with the corresponding
`foo-style` option as well.
Prefix active colorization feature introduced by pull request #863
causes undesired behavior on older versions of tmux. Add version
checking and revert to old powerline configuration if the tmux version
is less than v1.8. tmux v1.8 was the first version to support the
client_prefix format variable.
Use a feature of tmux v1.8+ to change the FG color of the last active
window to blue. This uses the foo-{attr,bg,fg} format, which is
deprecated (although still available) starting with tmux v1.9 in favor
of the corresponding foo-style variable. However, tmux v1.9 is not yet
ubiquitous enough to move to the foo-style variables. For example, the
latest Ubuntu LTS (14.04) only has tmux v1.8 available in its
repositories, so the foo-{attr,bg,fg} variables prove to be more
'compatible' for now.
For future reference, here is the modification that should be made once
tmux v1.8 is deemed old enough to drop support for (or whenever the
deprecated foo-{attr,bg,fg} variables go away in the latest version of
tmux):
-set -g window-status-last-fg colour31
+set -g window-status-last-style fg=colour31
It might be appropriate to add version checking around some of these
types of options for maximum compatibility, but my initial attempt to
explore version checking in the tmux config file got extremely messy in
a hurry.
This modification to the tmux powerline binding allows the user to
easily identify when the prefix has been sent. When the prefix has
been sent, the session block changes from white to blue (matching the
color of the active window). This is accomplished using the conditional
functionality of tmux format strings and the 'client_prefix' format
variable. Unfortunately, the tmux parser fails to properly parse out
comma-separated format strings inside a format conditional, so those
have been split out into individual segments as well. Attempting to
re-combine the formats inside the conditionals will break this feature.
Reason: tmux may be launched and $TMUX set, but current shell still not under
tmux (and most likely there are no active session). In this case `tmux refresh
-S` may fail with “no clients” message, which is annoying.
It seems that old fix for old code is no longer needed. At least I do not see
any problems with
vim -u NONE -S ~/.vam/powerline/powerline/bindings/vim/plugin/powerline.vim --cmd 'set ls=2'
.
Fixes#250
Reason: $? may be overridden by the previous commands in PROMPT_COMMAND that do
not keep it like _powerline_prompt does (see `return $last_exit_code`).
(@ascrane)
Closes#836