Notes:
- I had to launch script twice because tcsh does not actually support multiline
prompt: it squashes everything into one line.
- Thus I had to add POWERLINE_TCSH_NO_ABOVE_PROMPT: running python twice is not
nice for performance.
- Due to 1) tcsh shifting rprompt by 1 and 2) tcsh not accepting %{%}-escaped
color section at the very end of rprompt (actually it is accepting it, just
makes user input colored as that section) I had to reduce computed width by 2.
- As running powerline command in precmd modifies status code I had to use
POWERLINE_STATUS variable to save status.
- As tcsh does not accept names that start with underscore non-API powerline
variables do not start with underscore.
Notes:
- Unlike fish zsh outputs right prompt shifted by one to the left. Which means
I have to subtract 1 from computed width.
- PS2 and PS3 produce too lengthy prompts when fed with real width. Thus they
are fed with PS1 prompt width like in ipython (out prompts).
Not that I wanted this: cmake cannot be told I do not want `lib` prefix. `zsh/`
prefix in any case should have been removed: zpython is not pretending it is
a part of zsh now. Keeping old name for those who are still using zpython branch
(i.e. nearly everybody since zpython got moved less then an hour ago).
tmux configuration has become very fragmented between versions due to a
combination of new features and deprecation of older options. As such,
version checking for tmux became a requirement to allow maximum
functionality along with version-appropriate configuration. However,
wrapping nearly every line with `if-shell` is tedious and becomes
virtually unreadable.
This enhancement to tmux version-checking creates a logical
configuration file structure that reflects the development of tmux. As
additional configurations are added and tmux development continues, this
structure can be leveraged appropriately and extended as needed.
Rather than having multiple `if-shell` checks for the same version, each
version or version group with specific requirements can be checked only
once. This leads to simpler and fewer `if-shell` version checks. It also
reduces the ambiguity introduced by complex `if-shell` commands that
include an 'else' conditional.
A caveat to adding this enhancement is the additional requirement of the
end user to add a tmux variable definition (`POWERLINE_BINDINGS_DIR`) to
his/her `~/.tmux.conf` file. For existing tmux users leveraging
powerline, this may prove to be a slight one-time nuisance immediately
after upgrading. Without this definition, there is no way to determine
the location of the additional tmux powerline config files that have
been added with this enhancement. The docs have also been updated in
this commit to reflect this initial configuration requirement change.
Also added are some additional troubleshooting notes that point to
definition of this variable as a potential issue. Powerline will
continue to work without the definition of `POWERLINE_BINDINGS_DIR`, but
some of the functionality will be reduced and the appearance incomplete
(i.e. colors).
Ultimately, the caveat above is a small price to pay in exchange for a
framework that can be leveraged for proper version-appropriate
configuration of tmux going forward.
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.