本文介绍了如何在Linux中使用Ctrl + M关闭替代Enter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么在Ubuntu Jaunty中Ctrl + M绑定到Enter?如何关闭它?

Why is Ctrl+M bound to Enter in Ubuntu Jaunty? How to turn it off?

我正在使用Emacs,并希望将Ctrl + M绑定到其他命令。

I'm using Emacs and would like to bind Ctrl+M to some other command.

推荐答案

我认为你的问题是倒退的。它不是绑定到,它是绑定到的Enter。而与 RET 相同。

I think your question is backwards. It is not that is bound to , it is Enter that is bound to . And is the same as RET.

如果您运行,您将看到类似 RET运行命令... 的内容。 发送 RET ,因为它是一个控制代码,请参阅。

If you run , you will see something like "RET runs the command ...". sends RET because it is a control code, see http://en.wikipedia.org/wiki/Control_character.

键是绑定到;如果您运行,您将看到类似 RET(从< return>)转换)运行命令... 。请参阅正由emacs解释为< return>然后将该密钥转换为。

The key is bound to ; if you run , you will see something like "RET (translated from <return>) runs the command ...". See, is being interpreted by emacs as <return> and then that key is getting translated to .

您想要做的是首先从< return>到 RET ,直接将其绑定到当前间接绑定的内容,例如(global-set-key(kbd< return>)'newline)。然后,你可以自由地将绑定到任何你想要的内容,而不影响Enter。

What you want to do is first remove the translation from <return> to RET by binding it directly to what it's currently indirectly bound, e.g. (global-set-key (kbd "<return>") 'newline). Then you're free to bind to whatever you want without affecting Enter.

这假设你使用图形化的emacs。如果您在终端中运行,则无法运行,因为Enter将发送C-m,而不是< return> ;.您可以使用 window-system 变量来检查。

This assumes you're using the graphical emacs. If you're running it in a terminal, this won't work, because Enter will send C-m, not <return>. You can check that using the window-system variable though.

这篇关于如何在Linux中使用Ctrl + M关闭替代Enter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 05:51