在emacs中解除密钥绑定 [英] Unset key binding in emacs
问题描述
newline-and-indent
) (define-key zencoding-mode-keymap(kbdCj)'zencoding-expand-line)
然后如何取消设置此键绑定,并使用 Cj
newline-and-indent
再次出现
我尝试过这个,但不行:
(add-hook'html-mode-hook
(lambda()
(progn
(zencoding-mode)
(local-set-key(kbdCj)'newline-and-indent))))
有没有人有这方面的想法?
解除密钥(对于任何键盘映射)的一般方式是定义
( define-key KEYMAP KEY nil)
为方便起见,有als o两个标准函数,用于解除与全局键盘映射和本地键盘映射(这是通常主要模式的键盘映射)的标准功能。
- $ b $ X-4545454545X-45454545 X- 20045 X-454545 X-454545 X-454545 X-454545 X- 20045 CEEC X- 2004545 X- 20045 CEEC X-
那些是交互式命令,根据各自的补充全局集-key
和 local-set-key
。
至于你的具体例子,你可能想要这样的东西:
(eval-after-loadzencoding-mode
'(define-key zencoding-mode-keymap(kbdCj)nil))
For example, in the codes of zen-coding, the "C-j" shadows the normal behavior of "C-j" (newline-and-indent
)
(define-key zencoding-mode-keymap (kbd "C-j") 'zencoding-expand-line)
Then how can I unset this keybinding and use C-j
for newline-and-indent
again?
I tried this, but it doesn't work:
(add-hook 'html-mode-hook
(lambda ()
(progn
(zencoding-mode)
(local-set-key (kbd "C-j") 'newline-and-indent))))
Does anyone have ideas about this?
The general way to unbind a key (for any keymap) is to define a binding of nil
:
(define-key KEYMAP KEY nil)
For convenience, there are also two standard functions for unbinding from the global keymap and from the local keymap (which is usually the major mode's keymap).
(global-unset-key KEY)
(local-unset-key KEY)
Those ones are interactive commands, as per their respective complements global-set-key
and local-set-key
.
As to your specific example, you probably want something like this:
(eval-after-load "zencoding-mode"
'(define-key zencoding-mode-keymap (kbd "C-j") nil))
这篇关于在emacs中解除密钥绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!