How to create custom escape sequence in mac terminal

匆匆过客 提交于 2019-12-11 16:08:31

问题


I don't understand how to create custom escape sequence for Ctrl+Shift+S like in this question

My problem is that I want to use Ctrl+Shift+S in emacs no-window mode under MacOS terminal. Currently I'm trying to bind this escape sequence to Ctrl+Shift+F12 but I have troubles creating that escape sequence. Maybe there is a batter way to use complex (Ctrl-Shift+anykey) bindings in MacOS terminal with emacs in no-window mode?


回答1:


You're probably assuming that F12 is a character. It is not. Conventionally, function keys send a sequence of characters.

In Terminal's preferences screen, you can review (most of) the key bindings:

You can also add a key definition (after deciding what characters it ought to send), and associate the Shift and Control modifiers with that key:

For the sake of example, I used the sequence that xterm would send. However, Terminal is not the same as xterm, and you may find other sequences more interesting.

Regarding the related question "What is the correct escape code for control/shift/s": there is no correct escape code because terminals (unless specially configured as illustrated above) do not distinguish between shifted- and unshifted-control characters. To determine what is "correct", you will have to examine your emacs bindings to see what you should send to make it recognize the function you are asking about.



来源:https://stackoverflow.com/questions/45803063/how-to-create-custom-escape-sequence-in-mac-terminal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!