1

I am using emacs with evil, and space is my leader key, however, space is bind to dired-next-line in dired-mode. So, how can I unbind space, so I can still use it as my leader key in dired-mode, and how can I achive this in genral.el.

1

The only reason that space won't work as expected in dired is because evil-integration.el sets up dired-mode-map to override evil keybindings. You can prevent the file from loading, but alternatively, you can bind your space commands in general-override-mode-map. Then you won't need to unbind space for any minor mode even when using evil-make-overriding-map. See my evil guide if you want more information.

3
  • Great answer, great guide. They help me know evil-mode much more. BTW, thank you for general.el, all my key bindings are defined in general now. Apr 25 '18 at 1:42
  • As the general README says: "When general-override-mode is enabled, keys bound in general-override-mode-map will take precedence over keys bound in any other minor mode keymaps." Since dired-mode is a major mode, how can I override SPC which is binded to dired-mode. Apr 25 '18 at 2:12
  • The same should apply to major modes for evil keybindings (evil overriding maps which are used to elevate dired's keymap have a lower precedence than the evil intercept maps used for general-override-mode-map). If you have any problems, please make an issue on the general.el repository (I don't check stack exchange very often).
    – noctuid
    Apr 25 '18 at 23:13
0

To unbind SPC in dired-mode, you can write something like this:

(define-key dired-mode-map (kbd "SPC") nil)

I don't know general.el but I guess you should be able to do something similar.

2
  • Please mark the answer as being the correct one. Apr 24 '18 at 7:52
  • Sorry, I find out that @noctuid's answer is more comprehensive, and explains some useful detail about how key bindings work. So, I chose his answer as accepted one. Apr 25 '18 at 1:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.