tmux 更改键绑定(调整大小)未按预期工作

tmux changed keybinding (resizep) not working as expected

我使用 vim,所以我想更改几个 tmux 的默认绑定。特别是我想更改调整大小的命令,例如ctrl-b ctrl-k 将拆分的大小调整一个位置。我在 .tmux.conf:

中输入了以下内容
bind-key C-k resizep -U

它有效,除了它只允许我一次调整一个单位的大小,然后我必须再次按下 ctrl。换句话说,我不能按住 ctrl 并按 b 然后按 k 多次(同时仍然按住 ctrl),而我可以按住 ctrl,按 b,然后按向上箭头键多次。

有谁知道这是为什么,或者我如何复制我想要的行为?

您需要在命令中指定-r参数:

bind-key -r C-k resizep -U

如 tmux 手册页中所述:

bind-key [-cnr] [-t mode-table] key command [arguments]
                   (alias: bind)
             Bind key key to command.  By default (without -t) the primary
             key bindings are modified (those normally activated with the
             prefix key); in this case, if -n is specified, it is not neces‐
             sary to use the prefix key, command is bound to key alone.  The
             -r flag indicates this key may repeat, see the repeat-time
             option.