新手问题 如何在 tmux 中绑定 Ctrl+ESC 键

betterthornbird · December 28, 2013 · Last by betterthornbird replied at December 30, 2013 · 4159 hits

我不想用 tmux 默认键 C-b, 也不想绑成 C-c, C-a, 就像用 C-ESC, 不过好像不成功。C-Escape, C-esc, 都试过不行。

搜索的时候不知道如何表达,找到 stack overflow 上面的这个提问,http://stackoverflow.com/questions/9922497/how-can-i-set-tmux-hotkey-as-ctrl-that-is-ctrlcomma

里面有这个结论

The control key can only be applied to letters, @, space and ? (and C-@ seems to be equivalent to C-space). Sorry, doesn't look like C-, is possible, at least in tmux-1.6.

但我确实听说过有人绑定 C-escape,很迷惑。有没有人知道如何绑定?

escape 键不是这么用的。不过还是可以绑定:

unbind C-b                                                                                                      
set -g prefix ^[
bind [ send-prefix

按起来比较痛苦...

unbind C-b set -g prefix C-[ bind [ send-prefix

似乎跟你说的不等同?现在我用的是 ctrol + [ 来控制的。

#1 楼 @gihnius

set -g prefix ^[` 不会设置成 Esc.

#3 楼 @betterthornbird 我以为你只想按 escape ! 按 control + [ 跟 按 Esc 是一样的. 另外,要用 Esc 可能还要设置 set -sg escape-time 0

#3 楼 @betterthornbird Esc 一般不能用于 组合键。

我觉得 C-a 是最方便了

#6 楼 @AlphaLiu 你肯定不是 Emacs 用户~

#1 楼 @gihnius 你 tips 中的^[ 是直接输入还是用另外的方式输入的?我发现在我的 tmux 配置里面是不 work 的。

其实我就是听说过有人绑 ESC 之后就一直想搞清楚到底怎么绑上去,我怎么就不能成功

#9 楼 @betterthornbird 晕 ^X 就是 C-X 嘛

unbind C-b
set -g prefix C-[
bind [ send-prefix

你这样就是了。按 C-[ 跟按 Esc (不是 C-Esc) 是一样的,你试试。不过这样不能用 vim 了。

如果用 emacs,我发现用得最少的是 C-o, 所以我的 tmux 就绑定到 C-o.

#10 楼 @gihnius 谢谢,这样是可以行哦。不过这样确实 Vim 用不了了,我是用 Vim 的。

#9 楼 @gihnius Esc 键在配置文件里面可以用C-[来表示,我在 tmux configuration 里面看了下,tmux 中不支持默认键设置成多于两个字符,比如C-^[这种会默认将[忽视掉。

另外我确认了下,我听说过的那人不是用的 Ctrl+Esc 来做默认键的。所以我的纠结至此为止了。我现在决定用 C-q, C-o 在 vim 中我是找上一个编辑的地方。

You need to Sign in before reply, if you don't have an account, please Sign up first.