How to show current mode in status-line in tmux?

10

2

In vim: :set showcmd tells me what key I've typed(such as f).

In tmux: after typing Ctrl-b, I stop to think about the next key I need.
Sometimes I forgot I've typed Ctrl-b, so I type it again, it causes problem.

How to change the status-line to let me know I've typed Ctrl-b?

kev

Posted 2012-05-28T06:52:18.740

Reputation: 9 972

I don't think there is a way, although it sounds like a good feature to add to tmux. – chepner – 2012-05-29T01:40:10.837

Answers

6

For anyone still looking for a solution, you can know when you have typed the tmux prefix, by adding this to your statusline:

#{?client_prefix,#[fg=colour2]^A,}

When added to status line, you will get a nice little ^A inside your tmux statusline when you press your prefix. Please, change colour and prefix message accordingly.

You can go fancy, and even toggle all bg colors in your statusline when prefix is typed.

set -g status-left "#{?client_prefix,#[bg=colour2],#[bg=colour1]}#[fg=colour0] #S "

Stoic

Posted 2012-05-28T06:52:18.740

Reputation: 212

1

As chepner already said here, no options to show currently typed keys or prefixes seem to exist (nor are mentioned in the manpage).

As a workaround, you can press Esc before you use the prefix Ctrl+b again. This way you will discard any previously typed (forgotten) prefixes and avoid accidentally sending multiple Ctrl+b.

speakr

Posted 2012-05-28T06:52:18.740

Reputation: 3 379