禁用Ctrl + Enter(Disable Ctrl+Enter)

编程入门 行业动态 更新时间:2024-10-21 03:49:07
禁用Ctrl + Enter(Disable Ctrl+Enter)

我正在使用python模式的python工作正常,但是我真的很烦恼默认情况下运行执行命令下的命令每当我按CTRL + ENTER,因为我不断意外按下它。 如何禁用此行为? 我试过了

(global-set-key (kbd "<C-return>") nil)

但这似乎没有效果。 任何帮助深表感谢。

I am using python with elpy mode which work fine, however I am really annoyed by the default which runs executes the command under the cursor whenever I press CTRL+ENTER since I keep pressing it accidentally. How do I disable this behavior? I tried

(global-set-key (kbd "<C-return>") nil)

but that does not seem to have an effect. Any help is much appreciated.

最满意答案

它可能没有在全局键映射中设置,而是在主模式的映射或某些次模式的映射中。 在具有键绑定的缓冲区中,执行Ch k C-<return>以查看绑定; 它应该显示它所在的键映射。然后使用define-key进行更改。 例如,如果foo-mode-map包含绑定,请执行

(define-key foo-mode-map (kbd "C-<return>") nil)

您可能希望将该代码添加到挂钩或with-eval-after-load将其包装,因此在运行时定义foo-mode-map 。

It's probably not set in the global key map, but in the major mode's map or some minor mode's map. In a buffer with the key bound, do C-h k C-<return> to see the binding; it should show the key map that it's in. Then use define-key to change it. E.g. if foo-mode-map contains the binding, do

(define-key foo-mode-map (kbd "C-<return>") nil)

You will probably want to add that code to either a hook or wrap it in with-eval-after-load, so foo-mode-map is defined when it runs.

更多推荐

本文发布于:2023-07-23 18:41:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1235673.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Ctrl   Enter   Disable

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!