简体   繁体   English

发送“C-(”到VT100 / xterm终端的Emacs(Mac OS X的终端)?

[英]Send “C-(” to Emacs in VT100/xterm terminal (Mac OS X's Terminal)?

Is it possible in any way to send the key "C-(" to Emacs over a VT100/xterm terminal (Mac OS X Terminal)? Is there an escape sequence that could be sent to achieve the equivalent? 是否有可能通过VT100 / xterm终端(Mac OS X终端)将密钥“C-(”发送到Emacs?是否有可以发送的转义序列以实现等效?

I suspect the fundamental problem is that the concept of combining control with the character "(" (and other such characters that are produced using shift) does not exist. 我怀疑基本问题是控制与字符“(”(以及使用shift生成的其他此类字符)组合的概念不存在。

Note: Using Cocoa Emacs is not an option. 注意:使用Cocoa Emacs不是一种选择。 And the reason for needing "C-(" is that paredit.el uses it amongst other key combinations, and it would be preferable to not remap it (because it makes sense to have it on "C-("). 需要“C-(”的原因是paredit.el在其他键组合中使用它,并且最好不重新映射它(因为将它放在“C-(”)上是有意义的。

A VT100 terminal couldn't do that, because there is no ^( control character corresponding to ( . However, xterm has the so-called "modifyOtherKeys" mode, which does allow to send unique keycodes for combinations like that. VT100终端无法做到这一点,因为没有^(控制字符对应于( 。但是,xterm具有所谓的“modifyOtherKeys”模式,它允许为这样的组合发送唯一的密钥代码。

To enable it, set the modifyOtherKeys resource, eg in ~/.Xdefaults : 要启用它,请设置modifyOtherKeys资源,例如~/.Xdefaults

XTerm*vt100.modifyOtherKeys: 1

With that, Ctrl+( will send the following keycode: 有了它,Ctrl +(将发送以下密钥代码:

^[[27;6;40~

That's rather long though, so another format for keycodes like that was introduced, which can be enabled by setting the formatOtherKeys resource: 这是相当长的,所以引入了formatOtherKeys代码的另一种格式,可以通过设置formatOtherKeys资源来启用:

XTerm*vt100.formatOtherKeys: 1

With that, Ctrl+( sends: 有了它,Ctrl +(发送:

^[[40;6u

In both of these keycodes, the 40 is the decimal ASCII code for ( , and the 6 represents the Ctrl. 在这两个密钥代码中,40是十进制ASCII代码( ,而6表示Ctrl。

See man xterm and http://invisible-island.net/xterm/ctlseqs/ctlseqs.html for further details. 有关详细信息,请参阅man xtermhttp://invisible-island.net/xterm/ctlseqs/ctlseqs.html No idea whether Terminal.app supports any of it. 不知道Terminal.app是否支持它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM