如何在Linux中使用Ctrl + M关闭替代Enter [英] How to turn off alternative Enter with Ctrl+M in Linux

查看:259
本文介绍了如何在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.

推荐答案

我认为你的问题是倒退的。它不是 C-m 绑定到输入,它是绑定到 C-m 的Enter。而 Cm RET 相同。

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

如果您运行 Ch k Cm ,您将看到类似 RET运行命令... 的内容。 Cm 发送 RET ,因为它是一个控制代码,请参阅 http://en.wikipedia.org/wiki/Control_character

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

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

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

您想要做的是首先从< return>到 RET ,直接将其绑定到当前间接绑定的内容,例如(global-set-key(kbd< return>)'newline)。然后,你可以自由地将 C-m 绑定到任何你想要的内容,而不影响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 C-m 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆