How does one send S-RET to Emacs in a terminal?

社会主义新天地 提交于 2019-11-28 09:56:49

You can get Emacs to pretend that it got S-RET with C-x @ S RET (note uppercase S).

This also works for adding control, meta, alt, hyper or super modifiers; type C-x @ C-h for the list of bindings. The Modifier Keys section in the Emacs manual mentions this as well.

In general, lots of keystrokes are simply impossible to send via a terminal, since terminals emulate an old protocol that only allowed 256 separate keys (or maybe only 128).

Chances are, when you press S-RET, Terminal.app does exactly the same thing as if you'd pressed RET. Thus Emacs has no way to distinguish those two cases.

phils

Cross-linking to other Q&As:

If you are using an xterm, then the modifyOtherKeys option may facilitate that binding. See the following for details:

Send "C-(" to Emacs in VT100/xterm terminal (Mac OS X's Terminal)?

I suspect Emacs recognises those codes by default, but if not then also see input-decode-map as described here: Binding M-<up> / M-<down> in Emacs 23.1.1

See explanation and alternative shortcuts for TTY here.

Some of these have worked for me in a terminal in Ubuntu Linux (both locally and over SSH), but not all of them seem to work. For example, the alternative provided for S-RET (which I expected to run org-table-copy-down) instead seems to run org-clone-subtree-with-time-shift for some reason. However, I have found the list of alternatives useful, particularly those with the M- prefix. For example ESC UP for M-UP to move text around in tables.

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