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

发布于 2024-10-05 20:59:28 字数 239 浏览 4 评论 0原文

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

我怀疑根本问题是不存在将控制与字符“(”(以及使用 Shift 生成的其他此类字符)相结合的概念。

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

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?

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.

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-(").

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

被你宠の有点坏 2024-10-12 20:59:28

VT100 终端无法做到这一点,因为没有与 ( 对应的 ^( 控制字符。但是,xterm 有所谓的“modifyOtherKeys”模式,它可以允许发送类似的组合的唯一键码

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

XTerm*vt100.modifyOtherKeys: 1

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

^[[27;6;40~

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

XTerm*vt100.formatOtherKeys: 1

这样,Ctrl+( 发送:

^[[40;6u

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

请参阅 man xtermhttp://invisible-island.net/xterm/ctlseqs/ctlseqs.html 了解更多详细信息。不知道 Terminal.app 是否支持其中任何一个。

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.

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

XTerm*vt100.modifyOtherKeys: 1

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

^[[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:

XTerm*vt100.formatOtherKeys: 1

With that, Ctrl+( sends:

^[[40;6u

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

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文