tmux-cpu icon indicating copy to clipboard operation
tmux-cpu copied to clipboard

Add plugin_interpolated_options support

Open ins0mniaque opened this issue 2 years ago • 2 comments

When using a multi-line status-format, having the interpolation restricted to status_left and status_right is problematic.

This adds an option to configure which options are interpolated by the plugin. Because there are multiple plugins using the same interpolation technique, and they are all subject to the same restrictions, I used "@plugin_interpolated_options" as the option name. That option could be reused by other plugins for the same purpose.

If the option is not found, it defaults to "status-right status-left", the current behavior.

To support multi-line status-format, the status line to interpolate can be added to @plugin_interpolated_options in ~/.tmux.conf:

set -g @plugin_interpolated_options 'status-format[0] status-left status-right'

This option also allows a very small improvement in startup performance by only interpolating the necessary options. For example, to only interpolate status-right:

set -g @plugin_interpolated_options 'status-right'

ins0mniaque avatar Mar 14 '22 01:03 ins0mniaque

Documentation is missing. However, I'm ok with your solution but I will wait on https://github.com/tmux-plugins/tmux-battery/pull/103 decision before merging.

ctjhoa avatar Apr 06 '22 14:04 ctjhoa

I might have been a bit zealous when I did this, but there's also: https://github.com/tmux-plugins/tmux-prefix-highlight/pull/37, https://github.com/tmux-plugins/tmux-maildir-counter/pull/5, https://github.com/tmux-plugins/tmux-net-speed/pull/15, https://github.com/tmux-plugins/tmux-newsboat/pull/1 and https://github.com/tmux-plugins/tmux-online-status/pull/18.

I'll add documentation to all of these as soon as possible, starting with tmux-cpu and tmux-battery.

ins0mniaque avatar Apr 06 '22 14:04 ins0mniaque