简体   繁体   English

在终端中创建复杂的转义代码(转义序列)的正确方法

[英]Proper way of creating complex escape code (escape sequence) in terminal

I don't understand how to generate escape sequences eg. 我不明白如何生成转义序列。 if: 如果:

^[[27;7;47~ maps to: CM-/ ^[[27;7;47~映射到: CM-/

^[[27;6;40~ maps to: C-( ^[[27;6;40~映射至: C-(

so why this doesn't work as I would image: 所以为什么这不能像我想象的那样工作:

^[[27;6;83~ doesn't map to: CSs or control/shift/s ^[[27;6;83~不会映射到: CSs or control/shift/s

while 83 is ASCII for uppercase 'S'. 而83是大写字母“ S”的ASCII。

What is the correct escape code for control/shift/s (lowercase)? control/shift/s (小写)的正确转义码是什么?

The sequences that you're listing as examples look like xterm's programmed mode (the modifyOtherKeys resource, introduced in 2006 ). 作为示例列出的序列看起来像xterm的编程模式( 2006年引入的ModifyOtherKeys资源)。 The resource setting corresponds to a control sequence which some emacs configurations know how to initialize. 资源设置对应于一些emacs配置知道如何初始化的控制序列 Referring to the manual pages, that is 2 : 参考手册页,即2

   2    enables this feature for keys including the exceptions
        listed.

Because it affects all of the modifiers (including Shift ), just setting the corresponding resource is not very useful. 因为它影响所有修饰符(包括Shift ),所以仅设置相应的资源不是很有用。

OSX Terminal doesn't support that control sequence (or anything like it). OSX Terminal不支持该控制序列(或类似的东西)。 If you want OSX Terminal to send those escape sequences, you'll have to setup your preferences as mentioned in How to create custom escape sequence in mac terminal (using xterm as a reference). 如果要OSX Terminal发送这些转义序列,则必须按照如何在mac终端中创建自定义转义序列 (使用xterm作为参考)中所述设置首选项。 The same comment applies to other terminals which someone may suggest. 同一条评论适用于某人可能建议的其他终端。

For the sake of example, here's a screenshot from one of my test programs showing s , Shift s , Control s and Shift Control s 例如起见,这里是从我的测试程序的一个截图显示S, 偏移 s, 控制单元 SShift 控制单元 S

ModifyOtherKeys的示例

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

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