tmux:用一个键切换窗口和窗格

Ada*_*tan 6 keyboard-shortcuts tmux

我的问题

tmux键绑定需要两次单独的键击才能输入命令。第一个称为前缀,并设置为control+ a。第二个键执行实际命令,例如

  • c 创建窗口
  • w 列表窗口
  • n 下一个窗口
  • w 上一个窗口
  • f 查找窗口
  • , 名称窗口
  • & 杀死窗口

问题是连续两个组合键既麻烦又慢。大多数其他选项卡式 UI - 从 Chrome 到 Vim - 启用单个组合的选项卡切换。

我试过什么

  • STFW
  • bind-keysend-keys,例如bind-key C-c send-keys C-a n

我的问题

如何使用单个组合键运行特定的 tmux 命令,例如“下一个窗口”或“创建窗口”?

小智 7

解决方案

我的文件中有这样的内容~/.tmux.conf

bind -n C-h select-pane -L
Run Code Online (Sandbox Code Playgroud)

映射<Ctrl>-h到左侧的选择窗格。

参数的手动参考-n

bind-key [-nr] [-T key-table] key command [arguments]
    (alias: bind)
Bind key key to command.  Keys are bound in a key table.  By default (without -T), the key is
bound in the prefix key table.  This table is used for keys pressed after the prefix key (for
example, by default `c' is bound to new-window in the prefix table, so `C-b c' creates a new
window).  The root table is used for keys pressed without the prefix key: binding `c' to
new-window in the root table (not recommended) means a plain `c' will create a new window.
-n is an alias for -T root.  Keys may also be bound in custom key tables and the
switch-client -T command used to switch to them from a key binding.  The -r flag indicates
this key may repeat, see the repeat-time option.

To view the default bindings and possible commands, see the list-keys command.
Run Code Online (Sandbox Code Playgroud)