tmux: Use pane-border as indicator for {copy,sync}

In tmux version 3.2 all style options were changed to string
options, making them support formats.[^1]

From that version on, use the pane-borders as indicator for the
{copy,sync}-mode instead of the prefix_highlight plugin.

Keep the pure style fallback, as Ubuntu 20.4 for example still only
ships with version 3.0a.

[^1]: https://github.com/tmux/tmux/commit/f03b61131b34079
This commit is contained in:
2022-06-27 12:05:21 +02:00
parent 747ffd01e3
commit a8f6973968

View File

@@ -134,17 +134,30 @@ set -g status-style bg=default,fg=white
set -g message-command-style bg=default,fg=brightyellow
set -g message-style bg=brightyellow,fg=black
set -g mode-style bg=brightyellow,fg=black
set -g pane-border-style bg=default,fg=brightblack
set -g pane-active-border-style bg=default,fg=brightyellow
# NOTE: `<` does string comparison with `strcmp()`. This means that the
# condition will break from a double digit major version (e.g. `10.0`) on.
if -F "#{<:#{version},3.2}" {
# Use pure style default for tmux < 3.2 in combination with the
# prefix_highlight plugin.
set -g pane-border-style bg=default,fg=brightblack
set -g pane-active-border-style bg=default,fg=brightyellow
set -g @prefix_highlight_show_copy_mode 'on'
set -g @prefix_highlight_show_sync_mode 'on'
set -g @prefix_highlight_copy_mode_attr 'fg=black,bg=brightyellow'
set -g @prefix_highlight_sync_mode_attr 'fg=black,bg=brightred'
} {
# From 3.2 on, we can use formats in styles, so that all indicators can be
# done by the borders.
set -g pane-border-style "#{?synchronize-panes,fg=brightred,fg=brightblack}"
set -g pane-active-border-style "#{?pane_in_mode,bg=brightyellow#,fg=brightblack,#{?synchronize-panes,fg=brightred,fg=brightyellow}}"
}
# Display in the status bar when the prefix was pressed, copy-mode is active, or
# `synchronize-panes` is turned on
set -g @prefix_highlight_fg 'brightyellow'
set -g @prefix_highlight_bg 'default'
set -g @prefix_highlight_show_copy_mode 'on'
set -g @prefix_highlight_show_sync_mode 'on'
set -g @prefix_highlight_copy_mode_attr 'fg=black,bg=brightyellow'
set -g @prefix_highlight_sync_mode_attr 'fg=black,bg=brightred'
set -g status-right "#{prefix_highlight}"
set -g status-left "#{prefix_highlight}"