什么是 tmux 的有效密钥?

Cha*_*ker 26 tmux key-mapping

我试图学习如何bind-key [-cnr] [-t key-table] key command [arguments]更好地使用,但在弄清楚命令的“有效密钥”是什么时遇到了一些麻烦bind-key

我也试过做man tmux和谷歌,但我找不到任何有用的东西。

  • 我怎样才能弄清楚有效键的语法是什么?
  • 是否有帮助命令或man页面?
  • 也许我不知道这个有效密钥的技术术语,是否有这些密钥的术语,以便我可以进行更好的谷歌搜索?

例如,我试图弄清楚以下命令重新映射的含义:

bind-key -n M-S-Left resize-pane -L 2
bind-key -n M-S-Right resize-pane -R 2
bind-key -n M-S-Up resize-pane -U 2
bind-key -n M-S-Down resize-pane -D 4
Run Code Online (Sandbox Code Playgroud)

-n很容易的找到man页(无需前缀)。但我无法弄清楚M-S-Left关键是什么意思。

我猜它的映射移位和左箭头加上命令的任何M含义resize-pane -L 2

  • 我怎么知道是什么M意思?
  • 如果我想要控制+我想要的任何键怎么办。控制 = C?
  • 我怎么能在不尝试键盘上随机键的情况下解决这个问题呢?
  • 另外,我如何确认,弄清楚我是否没有将其映射到已使用的密钥集?
  • 是否有“显示所有别名”之类的东西?
  • 作为问题的补充,这些有效密钥是否与vim?

问题是vim它自己的语言似乎有不同的脚本,因为它有时需要和东西。

pol*_*lym 32

可用键

看看man tmux,搜索/KEY BINDINGS

tmux 允许将命令绑定到大多数键,带或不带前缀键。

指定键时,大多数代表他们自己(例如“A”到“Z”)。Ctrl 键可能以“C-”或“^”为前缀,而 Alt(元)以“M-”为前缀。

此外,还接受以下特殊键名:

Up, Down, Left, Right, BSpace, BTab, DC (Delete), End, Enter, Escape, F1 to F20, Home, IC (Insert), NPage/PageDown/PgDn, PPage/PageUp/PgUp, Space, and Tab . 请注意,要绑定 '"' 或 ''' 键,必须使用引号 [...]

MS-左应Alt+ Shift+Left例如。


列出所有绑定键

要列出所有键绑定,只需在会话中按Ctrl-b然后。?tmux

这也记录man tmux在部分EXAMPLES

键入“Cb?” 列出当前窗口中的当前键绑定;up 和 down 可用于导航列表或 'q' 退出列表。

您还可以通过 列出所有键绑定tmux list-keys。如果你想检查已经设置的键,你可以grep输出来检查它是否已经设置。


研究

要通过 Google 查找更多信息,请在其中搜索部分名称man tmux- 只需输入tmux default key bindings例如 :)。但往往man tmux就足够了。

tmux如果您在 Google 中搜索所述字符串,该站点是一个非常好的文档,并且会弹出。

Arch wiki也总是好的。


小智 12

这是 tmux 2.2 中可用的“扩展”键名的完整列表(从源代码中提取):

    /* Function keys. */
F1
F2
F3
F4
F5
F6
F7
F8
F9
F10
F11
F12
IC
DC
Home
End
NPage
PageDown
PgDn
PPage
PageUp
PgUp
Tab
BTab
Space
BSpace
Enter
Escape
    /* Arrow keys. */
Up
Down
Left
Right
    /* Numeric keypad. */
KP/
KP*
KP-
KP7
KP8
KP9
KP+
KP4
KP5
KP6
KP1
KP2
KP3
KPEnter
KP0
KP.
    /* Mouse keys. */
MouseDown1Pane
MouseDown1Status
MouseDown1Border
MouseDown2Pane
MouseDown2Status
MouseDown2Border
MouseDown3Pane
MouseDown3Status
MouseDown3Border
MouseUp1Pane
MouseUp1Status
MouseUp1Border
MouseUp2Pane
MouseUp2Status
MouseUp2Border
MouseUp3Pane
MouseUp3Status
MouseUp3Border
MouseDrag1Pane
MouseDrag1Status
MouseDrag1Border
MouseDrag2Pane
MouseDrag2Status
MouseDrag2Border
MouseDrag3Pane
MouseDrag3Status
MouseDrag3Border
MouseDragEnd1Pane
MouseDragEnd1Status
MouseDragEnd1Border
MouseDragEnd2Pane
MouseDragEnd2Status
MouseDragEnd2Border
MouseDragEnd3Pane
MouseDragEnd3Status
MouseDragEnd3Border
WheelUpPane
WheelUpStatus
WheelUpBorder
WheelDownPane
WheelDownStatus
WheelDownBorder
Run Code Online (Sandbox Code Playgroud)

这些除了可以ASCII可打印字符组一起使用,并与组合M-C-以及S-前缀。