I know, that I can unbind keys using unbind-key
. In this case I have to know the key I want to unbind. But I don't know the key. I just want to unbind all keys of some-mode-map
. I don't want override them, I just want to unbind them and then to define my own keys in the some-mode-map
. I know that I could iterate some-mode-map
and apply unbind-key
, but may be there is a more straightforward solution? And I don't know how to iterate a keymap
.
Update
Tried (as was suggested by phils in comments) this way and it didn't work:
(use-package neotree
:config
(setq neotree-mode-map (make-sparse-keymap))
(define-key neotree-mode-map (kbd "RET") 'neotree-enter)
)
(use-package evil
:init
(setq evil-overriding-maps '((neotree-mode-map)))
)
neotree-mode-map
remains not cleaned. And depending on package configuration order, evil
bindings gets overridden. It doesn't unless I redefine neotree-mode-map
. I know I could obtain desired result with evil-define-key
, but I want to keep package specific settings in its own configuration file. If I employ evil-define-key
, neotree
key binding definitions will be in setup-evil.el
and not in setup-neotree.el
Update 2
Answer works, as does (setq neotree-mode-map (make-sparse-keymap))
.
But it appears that neotree-mode-map
has parent map, and that's why some key bindings "come back" after "cleaning".
Another thing I figured out is, that evil
put into overriding maps some extra information.
(keymap
...
(override-state . all)
...
)
And that's why I should clear map before evil
configuration.