evil conflicts in c-mode

Jim Green student.northwestern at gmail.com
Tue Dec 6 01:40:23 CET 2011

On 5 December 2011 07:36, Frank Fischer
<frank.fischer at mathematik.tu-chemnitz.de> wrote:
> The default binding of "RET" in normal state is `evil-ret', which
> usually moves the cursor COUNT lines downwards. The binding is in
> `evil-motion-state-map' which acts as a base keymap for other states
> like normal or visual state.
> So if this binding is *not* active in normal state in your case,
> something went wrong or some configuration changes this binding.
> In insert (and emacs) state evil does not override the binding of
> "RET", therefore the default binding of the currently active
> (major-)mode is active, which is probably `newline-and-indent' for
> c/c++ mode.
> If you do not like `evil-ret' in normal state you can, e.g., disable
> this binding using
> (define-key 'evil-motion-state-map (kbd "RET") nil)
> but then the default binding of the currently active modes will be
> active again, or
> (define-key 'evil-motion-state-map (kbd "RET") 'undefined)
> or
> (define-key 'evil-normal-state-map (kbd "RET") 'undefined)
> which will disable the RET key in either all states based on
> motion-state or on normal-state.

I think I didn't state the issue clear in the post.

basicall for non c++/c files, RET behaves as expected, it does

but in c++/c files, even in evil normal mode, RET would do
"new-line-indent", I guess the reason is cc-mode doesn't differentiate
the evil normal mode or insert mode.

Is there a way to make sure whatever major mode emacs is in, in evils
normal mode, 'RET' would not cause emacs go into insert mode?

Thank you!


More information about the implementations-list mailing list