本文介绍了在 VT100/xterm 终端(Mac OS X 的终端)中将“C-("发送到 Emacs?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过 VT100/xterm 终端(Mac OS X 终端)以任何方式将密钥C-("发送到 Emacs?是否有可以发送的转义序列来实现等效?

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?

我怀疑根本问题是不存在将控制与字符("(以及其他使用 shift 产生的此类字符)组合在一起的概念.

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.

注意:使用 Cocoa Emacs 不是一种选择.需要C-("的原因是 paredit.el 在其他组合键中使用它,最好不要重新映射它(因为将它放在C-(") 上是有意义的.

Note: Using Cocoa Emacs is not an option. 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-(").

推荐答案

VT100 终端不能这样做,因为没有 ^( 对应于 ( 控制字符>. 但是,xterm 有所谓的modifyOtherKeys"模式,它允许为这样的组合发送唯一的键码.

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.

要启用它,请设置 modifyOtherKeys 资源,例如在 ~/.Xdefaults 中:

To enable it, set the modifyOtherKeys resource, e.g. in ~/.Xdefaults:

XTerm*vt100.modifyOtherKeys: 1

这样,Ctrl+( 将发送以下键码:

With that, Ctrl+( will send the following keycode:

^[[27;6;40~

虽然这很长,所以引入了另一种类似的键码格式,可以通过设置 formatOtherKeys 资源来启用:

That's rather long though, so another format for keycodes like that was introduced, which can be enabled by setting the formatOtherKeys resource:

XTerm*vt100.formatOtherKeys: 1

这样,Ctrl+( 发送:

With that, Ctrl+( sends:

^[[40;6u

在这两个键码中,40 是 ( 的十进制 ASCII 码,6 代表 Ctrl.

In both of these keycodes, the 40 is the decimal ASCII code for (, and the 6 represents the Ctrl.

参见 man xtermhttp://invisible-island.net/xterm/ctlseqs/ctlseqs.html 了解更多详情.不知道 Terminal.app 是否支持.

See man xterm and http://invisible-island.net/xterm/ctlseqs/ctlseqs.html for further details. No idea whether Terminal.app supports any of it.

这篇关于在 VT100/xterm 终端(Mac OS X 的终端)中将“C-("发送到 Emacs?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 16:26