如何在emacs中解除ctrl + c的绑定 [英] How can I unbind ctrl+c in emacs

查看:278
本文介绍了如何在emacs中解除ctrl + c的绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个新用户在emacs,并使用emacs因为ansi-term /多项
现在我必须键入ctrl + C两次发送到期限。
我想解除CTRL + C快捷方式在emacs中的绑定,所以我可以直接发送到该术语。
可以吗?

解决方案

解决方案覆盖术语模式缓冲区中的所有其他键图:

 (defun jpk / term-mode-hook()
(let((map(make-sparse-keymap)))
(define-key map(kbdCc)'term-send-raw)
(set-transient-map map(lambda()t))))

-to-hook'term-hook'jpk / term-mode-hook)






假设您没有任何其他绑定到 Cc (这不太可能,见下文):

 (define-key term-mode-map(kbdCc)'term-send-raw)
/ pre>

这对我来说使用 emacs -q (即没有任何我的自定义)启动emacs就足够了。






可以更改键绑定,但在我看来,这是不值得的。 C-c 是Emacs中的前缀键,意味着许多键绑定从它开始。你会战斗普遍的惯例,你可能会感到沮丧。接受Emacs不是100%的终端模拟器,还有一些小的妥协。


Im a new user in emacs, and use emacs because of the ansi-term/multi-term Now I have to type ctrl+C twice to send it to term. I would like to unbind the CTRL+C shortcut in emacs so I can send it directly to the term. Is it possible?

解决方案

Solution to override all other keymaps in term-mode buffers:

(defun jpk/term-mode-hook ()
  (let ((map (make-sparse-keymap)))
    (define-key map (kbd "C-c") 'term-send-raw)
    (set-transient-map map (lambda () t))))

(add-to-hook 'term-mode-hook 'jpk/term-mode-hook)


Assuming you don't have any other binds to C-c (this is unlikely, see below):

(define-key term-mode-map (kbd "C-c") 'term-send-raw)

This was sufficient for me when starting emacs with emacs -q (i.e. without any of my customizations).


It is possible to change the key binding, but in my opinion it isn't worth it. C-c is a prefix key in Emacs, meaning that many key bindings start with it. You'll be fighting pervasive conventions and you will probably be frustrated. Accept that Emacs is not 100% a terminal emulator and there are a few minor compromises to be made.

这篇关于如何在emacs中解除ctrl + c的绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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