I want to get rid of the C-e
binding so I can bind C-e e
, and C-e r
to a command. How do I do this?
My init file has this:
(global-set-key (kbd "C-e e") 'move-end-of-line)
(global-set-key (kbd "C-e r") 'end-of-buffer)
I want to get rid of the C-e
binding so I can bind C-e e
, and C-e r
to a command. How do I do this?
My init file has this:
(global-set-key (kbd "C-e e") 'move-end-of-line)
(global-set-key (kbd "C-e r") 'end-of-buffer)
You can unset the key in at least two ways:
(global-set-key (kbd "C-e") nil)
(global-unset-key (kbd "C-e"))
Note that I got this information with a web search for emacs unset key.
See @lawlist's comment.
Use C-h m
, C-h k
, and C-h b
wherever you want to make the change. That will help you figure out the keymap in which you need to make the change. If Dan's suggestion didn't help then clearly that keymap is not the global map.
Setting the key binding to nil
is indeed the way to unbind it. You just need to do that in the right map.
Using C-h M-k
(describe-keymap
), from library help-fns+.el
will give you a human-readable list of the bindings in a given keymap (bound to a keymap variable, such as global-map
.
You don't need to unset a key before you rebind it to something else. This should do what you want:
;; create a new prefix map
(define-prefix-command 'my-keymap)
;; bind the new keymap to C-e
(global-set-key "\C-e" my-keymap)
;; bind the individual commands:
(define-key my-keymap "e" 'move-end-of-line)
(define-key my-keymap "r" 'end-of-buffer)
Now hitting C-e
is a prefix, and C-e e
calls end-of-line
etc.