I want keybinding X to do one thing in c-mode
and another thing in other modes. I'm trying to figure out how to do this in evil
, specifically evil
's insert-state
.
I tried setting the keybinding in a mode hook:
(add-hook 'c-mode-hook (lambda ()
(define-key evil-insert-state-map (kbd "RET")
'c-indent-new-comment-line)))
And left everything else defined in my init file as:
(define-key evil-insert-state-map (kbd "RET") 'comment-indent-new-line)
But the problem is that the hook does not seem to override my default keybinding. How do I override a key binding in evil
based on a mode?