强制更新 tmux 状态栏

ger*_*rit 12 tmux

我想在我的tmux状态行中显示当前时间。我得到了:

$ tmux set status-right '"#22T" %H:%M:%S %d-%b-%y'
Run Code Online (Sandbox Code Playgroud)

这确实改变了状态行中的时间以包括秒。但是,状态行仅在“发生某些事情”时才会更新:我切换窗口、切换窗格等。如何配置 tmux 以每秒更新状态行,以便我可以运行时钟?

qqx*_*qqx 20

设置状态 inverval 使其每秒更新一次:

tmux set status-interval 1
Run Code Online (Sandbox Code Playgroud)


gos*_*pes 12

你也可以使用

tmux refresh-client -S
Run Code Online (Sandbox Code Playgroud)

手动刷新状态栏而不是依赖刷新间隔。我将它用作事件驱动的更新方法,例如在切换窗格时。在我的 .tmux.conf 中,我更改了以下内容:

bind -r k select-pane -U
bind -r j select-pane -D
bind -r l select-pane -R
bind -r h select-pane -L
Run Code Online (Sandbox Code Playgroud)

到:

bind -r k select-pane -U\; refresh-client -S
bind -r j select-pane -D\; refresh-client -S
bind -r l select-pane -R\; refresh-client -S
bind -r h select-pane -L\; refresh-client -S
Run Code Online (Sandbox Code Playgroud)

ps:以防万一,我目前正在使用 tmux 1.8。