【问题标题】:How to switch to the previous pane by any shortcut in tmux?如何通过 tmux 中的任何快捷方式切换到上一个窗格?
【发布时间】:2015-11-05 22:29:51
【问题描述】:

例如,我在一个带有 tmux 的窗口中有三个窗格。 现在我的光标位于第二个窗格中。如果我使用:

C-b o

我可以移动到第三个窗格。

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

它可以在一个窗口中列出所有的窗格:

C-b q

它将显示:0、1、2

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

【问题讨论】:

  • C-b q 之后,您可以在它们仍显示时键入窗格编号以切换到该窗格。

标签: linux terminal tmux


【解决方案1】:

复制自@lyuboslav-kanev

prefix + ; 非常适合我。

prefix + l 切换到最后一个窗口
prefix + L 切换到最后一个会话

【讨论】:

  • ++ 用于添加prefix + l,即使问题的作者没有询问。
【解决方案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

【讨论】:

  • ^b + ; 是切换到最后一个窗格的默认快捷方式。
  • @lyuboslavkanev 你是个传奇。
  • 请注意,'last' 与 tmux 中的 'previous' 不同。对于窗口,您可以跳到当前窗口之前使用的“最后一个”窗口; tmux 的窗口列表中的前一个;或下一个。所以'previous'是tmux'next'的反义词,'last'是一个不同的概念。 'previous-pane' 似乎没有 tmux 命令。 (我现在在 macOS 上使用 tmux 3.1b)
猜你喜欢
  • 2021-03-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-04-14
  • 2021-10-25
相关资源
最近更新 更多