tmux 中的拆分窗格切换:每个命令切换一次 [英] Split pane switching in tmux: switch once per command
问题描述
一段时间以来,我一直是一个快乐的 tmux 用户,但有一种行为困扰着我.当我使用 ^b-arrow 切换窗格时,然后立即按向上箭头(例如,从历史记录中获取命令),窗口窗格再次切换.我知道如果您想快速浏览多个窗格,这会很有用,但对我来说,这在后面很痛苦,因为我一直在我从未打算进入的窗格中结束.
I've been a happy tmux user for a while now but there's one behaviour that's bugging me. When I switch panes using ^b-arrow, and then immediately press arrow-up (to get a command from history, for example), the window pane switches again. I understand this can be useful if you want to move through multiple panes quickly, but for me it's a pain in the backside since I keep ending up in panes I never meant to be in.
那么,有没有办法设置 tmux 以便 ^b-arrow 命令只切换窗格一次并忽略任何后续的箭头键按下?
So, is there a way to set tmux so that the ^b-arrow command only switches pane once and ignores any following arrow key presses?
推荐答案
发生这种情况是因为箭头键的默认绑定是使用 bind-key -r
设置的,指定它们可以重复.您可以通过两种方式禁用此功能.
That happens because the default bindings for the arrow keys are setup with bind-key -r
, specifying that they may be repeated. There are two ways that you can disable this.
首先,您可以使用 set-option repeat-time 0
完全禁用重复.这将影响所有绑定.我发现在调整窗格大小时这很烦人.
First, you can use set-option repeat-time 0
to disable repeating entirely. This will affect all bindings. I find that to be very annoying when resizing panes.
其次,您可以将箭头键的绑定更改为使用 bind-key
而不使用 -r
选项:
Secondly, you can change the bindings for the arrow keys to use bind-key
without the -r
option:
bind-key Up select-pane -U
bind-key Down select-pane -D
bind-key Left select-pane -L
bind-key Right select-pane -R
这篇关于tmux 中的拆分窗格切换:每个命令切换一次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!