Feb 2020

I want to have an indicator in my status bar when the prefix was pressed. The indicator could be anything, but I want to have it show the prefix (without hardcoding the key).

The following line overwrites the left status area to be empty, but show the prefix with inverted colors when it was pressed. (Obviously this can be part of a longer status string.)

set -g status-left "#{?client_prefix,#[reverse]#{prefix},}"

The client_prefix variable will be set when the prefix was pressed and tmux is waiting for another key. After a key has been pressed, client_prefix will be set to false again.

The #{?if,then,else} construct conditionally evaluates to then or else depending on the value of if.

The #{prefix} variable contains whatever the prefix was configured to be, so by default it evaluates to C-b.