0

I am trying to re-map a key in evil-mode/evil-commentary-mode when in dired-mode. I tried to add a hook to dired-mode to disable the minor commentary mode, but it disables it for other major modes as well. I've tried the following as well but it doesn't work (I've also tried it with evil-normal-state-map):

(add-hook 'dired-mode-hook
  (lambda ()
    (define-key evil-commentary-mode-map (kbd "g") 'revert-buffer)))
  • Is there a reason you have evil-commentary enabled in Dired? I mean, yes, you can edit things in dired, but this seems to be an odd workaround... – wasamasa May 14 '18 at 22:35
  • It's enabled by globally. I want to disable it for some non-editable modes. I guess I could do the other way around and try to enable it for editable modes only. When I disable it with a hook to dired-mode it gets disabled globally. – A. Blizzard May 15 '18 at 8:39
  • I see. Well, there should be a way... – wasamasa May 15 '18 at 19:59
  • I guess, it's because g is a prefix for other evil-mode commands, and I think I was silly trying to re-map it. I use space as my leading key in normal state so just binded revert-buffer to <SPC> r in dired-mode. – A. Blizzard May 15 '18 at 20:24
  • No, it's because evil-commentary-mode defines these keys for normal state and dired is in normal state. I see absolutely no reason for it to be. Other than, like, allow people to just navigate it without actually doing any useful action inside. – wasamasa May 15 '18 at 20:41

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.