0

What does cEnter (not ctrlEnter) do in Vim? I didn't have any mapping about it and it behaves like the S command. See below image:

1 Answer 1

3

The <CR> motion in Normal mode moves to the next line.

When you use that motion with an operator (such as c), it will select the current line and the next.

You can find (a little bit more) under :help <CR>, which says:

[count] lines downward, on the first non-blank character linewise.

The "linewise" part is the interesting one, indicating it acts on full lines when used with an operator.

So when you use c<CR>, Vim will replace the current line and the next and leave you in Insert mode to type a new line to replace them.

The + motion is a synonym for <CR>, so c+ will do the same as c<CR>. (You'll find +, <CR> and CTRL-M are listed together in the same help entry.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.