Unset key binding in emacs

后端 未结 1 792
灰色年华
灰色年华 2020-12-10 01:15

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-keym         


        
相关标签:
1条回答
  • 2020-12-10 01:36

    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))
    
    0 讨论(0)
提交回复
热议问题