How can I clear scrollback buffer in Tmux?

前端 未结 13 2570
悲&欢浪女
悲&欢浪女 2020-12-12 09:10

FYI, I am using Tmux through the Mac OS X Terminal app.

13条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-12 10:11

    Ctrl-L is used in console applications to redraw the screen. I found that when bound to send-keys -R it would cause the arrow keys to no longer function correctly in some applications (eg vim, mc).

    To retain the redraw functionality in console applications, I used:

    bind-key -n C-l if-shell -F '#{alternate_on}' 'send-keys C-l' 'send-keys -R C-l; clear-history'
    

    This requires the tmux option alternate-screen to be on (which it is by default).

提交回复
热议问题