问题描述
我想使用 Ctrl-分号作为 tmux 的前缀.但是我的配置不起作用.
解除绑定键 C-b设置选项 -g 前缀 C-\;
我找到了一篇类似的文章.但这不适用于前缀. 的默认设置,tmux 前身
Ctrl-b
更容易输入,尤其是当您 重新映射时大写锁定到 ctrl.使用 Ctrl-a
的缺点是您不能在 bash 或 vim 中使用相同的键,但是通过在 .tmux.conf 中使用以下绑定可以轻松解决这个问题/代码>:
bind-key 'C-a' 发送前缀
这样,按
Ctrl-a
两次会将相同的字符发送到底层程序(例如 bash 或 vim).
I want to use Ctrl-semicolon for tmux's prefix. But my conf doesn't work.
unbind-key C-b
set-option -g prefix C-\;
I found a similar article. But it's not for the prefix.tmux bind semicolon
BTW, what's your favorite prefix key? :D Do you have a recommend key?
解决方案
Terminal can't register a
Ctrl-;
keystroke. It's just not a valid character. If you look at the control characters in the below ascii table, you'll see Ctrl-;
is not on the list.
I'm on OS X and when I type
Ctrl - ;
in the (terminal and in a "desktop" program) I get a bell sound indicating the character is not recognized or something.
As for the "favorite" prefix key: from what I saw reading other people's
.tmux.conf
files, Ctrl-a
is the most popular choice. This makes sense because:
Ctrl-a
was the default for GNU Screen, tmux predecessorit's much easier to type than the default
Ctrl-b
especially when you remap caps lock to ctrl.
The downside to using
Ctrl-a
is that you can't use the same key in bash or vim, but that's easily solved by having the following binding in .tmux.conf
:
bind-key 'C-a' send-prefix
With that, pressing the
Ctrl-a
twice will send the same character to the underlying program (eg bash or vim).
这篇关于如何在 tmux 中使用 Ctrl-分号作为前缀?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!