禁用前缀密钥绑定 [英] Disabling prefix key binding

查看:136
本文介绍了禁用前缀密钥绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在emacs的shell模式下,退出shell模式的当前密钥绑定('comint-interrupt-subjob )是\Cc \Cc,我想将其更改为普通linux shell中的\Cc。我尝试

 (add-hook'shell-mode-hook'(lambda()
(local-set-键\Cc'comint-interrupt-subjob)
))

但是不工作。可能我需要禁用分配给\C-c的前缀。如何做到这一点?

解决方案

尝试这样:

 (eval-after-loadshell
'(define-key shell-mode-map(kbdCc)'comint-interrupt-subjob))


一般来说,定义键时,您应该在特定的键图中定义它们,而不是只希望 local-set-key 做你想要的。



注意:我更喜欢使用 kbd 用于描述密钥,您的\Cc将正常工作。


In shell mode on emacs, the current key binding for quitting the shell mode ('comint-interrupt-subjob) is "\C-c \C-c", and I want to change it to "\C-c" as in ordinary linux shell. I tried

(add-hook 'shell-mode-hook '(lambda ()
  (local-set-key "\C-c" 'comint-interrupt-subjob)
))

But it did not work. Probably I need to disable the prefix assigned to "\C-c". How can I do that?

解决方案

Try this:

(eval-after-load "shell"
  '(define-key shell-mode-map (kbd "C-c") 'comint-interrupt-subjob))

In general, when you define keys you should define them in particular keymaps, as opposed to just hoping the local-set-key does what you want.

Note: I prefer using kbd for describing keys, your "\C-c" would work just fine.

这篇关于禁用前缀密钥绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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