如何通过 tmux 中的任何快捷方式切换到上一个窗格?

How to switch to the previous pane by any shortcut in tmux?

例如,我使用 tmux 在 window 中有三个窗格。 现在我的光标在第二个窗格中。如果我使用:

C-b o

我可以移到第三个窗格。

但是我想移动到第二个窗格上的第一个窗格。怎么办?

它可以在一个列表中列出所有窗格window:

C-b q

它将显示:0、1、2

有什么键可以转到特殊窗格编号吗?如果有,我也可以快速切换到第一个窗格。

在 tmux 手册 ($man tmux) 中你可以找到这个部分:

select-pane [-DdeLlRU] [-t target-pane]
    (alias: selectp)

    Make pane target-pane the active pane in window target-window.   
    If one of -D, -L, -R, or -U is used, respectively the pane below,
    to the left, to the right, or above the target pane is used.  -l
    is the same as using the last-pane command.  -e enables or -d
    disables input to the pane.

所以,我想你想要的是使用“-l”标志,它用于切换到最后一个窗格。我不知道是否有为此任务定义的默认键映射,但您可以通过自己的绑定来完成此操作。像这样:

bind -r <your key> select-pane -l

Copied from @lyuboslav-kanev

prefix + ; 非常适合我。

prefix + l切换到最后window
prefix + L 切换到上一节课