evil conflicts in c-mode

Frank Fischer frank.fischer at mathematik.tu-chemnitz.de
Mon Dec 5 08:36:04 CET 2011


On Sun, Dec 04, 2011 at 04:38:57PM -0500, Jim Green wrote:
> Hello,
> I am an emacs newbie with vim background,
> 
> return key in N mode works alright for plain text files such as a text
> file called temp.
> 
> but in a c++ file for example temp.cpp, it is described as (newline-and-indent)
> 
> I did c-h k return to find it out.
> 
> Is this a desired behavior in c-mode? is there anyway to disable this
> behavior? in vim normal mode, return shouldn't do anything.

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.

Frank



More information about the implementations-list mailing list