give a hint when press prefix key in tmux

worldterminator picture worldterminator · Aug 17, 2012 · Viewed 7.5k times · Source

When I press the prefix-key Ctrl-b tmux doesn't give me a hint that it has been pressed.

Sometimes I can not remember whether I have already pressed it or not.

Can I set up a hint like highlight/change color or show some special symbol in the status bar to show me when I have pressed the prefix-key?

Answer

Chris Johnsen picture Chris Johnsen · Mar 9, 2013

The development version of tmux has support for this, so the next release (1.8?) should also support it.

There have been two changes that can be combined to indicate in your status line whether a prefix key has been pressed:

  • You can include the extended “format” replacements in the values of the “status” options. These replacements were first available in tmux 1.6, but they were not previously usable in the status options.
  • The client_prefix format replacement was added.

You could add a (conditional) highlighted <Prefix> string before the default status-right like this:

set -g status-right ' #{?client_prefix,#[reverse]<Prefix>#[noreverse] ,}"#{=21:pane_title}" %H:%M %d-%b-%y'