绑定键前缀 + ;在 tmux 中打开命令提示符

Bind key prefix + ; to open command-prompt in tmux

tmux 中打开命令提示符的正常方法是 prefix + :。我想绑定序列 prefix + ; 以打开命令提示符。我懒得按shift键了

当我将其放入我的 tmux.conf 中时:bind-key ; command-prompt,出现此错误:/Users/skilbjo/.tmux.conf:19: usage: bind-key [-cnr] [-t mode-table] [-T key-table] key command [arguments]

这很有趣,因为当我执行 prefix + ?tmux list-keys 的别名)时,会列出:bind-key -T prefix : command-prompt。这个魔法是如何运作的?我什至尝试 bind-key -T prefix ; command-prompt 无济于事,同样的错误消息

tmux 使用分号作为命令分隔符。

来自 tmux 手册页:

Multiple commands may be specified together as part of a command sequence. Each command should be separated by spaces and a semicolon; commands are executed sequentially from left to right and lines ending with a backslash continue on to the next line, except when escaped by another backslash. A literal semicolon may be included by escaping it with a backslash (for example, when specifying a command sequence to bind-key).

您要做的是:

unbind-key \;
bind-key \; command-prompt