Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In vim, the J key joins two lines together. Is there a similar, built-in, key combination to split lines with a newline (at the cursor position, or similar)? Alternatively, what would be the most robust way to define a key combination to do that (in normal mode, not insert mode)?

share|improve this question
up vote 1 down vote accepted

No, there's no built-in command for that.

When I want to split on a <Space>, I do r<CR>.

share|improve this answer
    
Accepted as the answer as this seems the simplest. – Andrew Ferrier Jun 24 '13 at 15:34

a Enter Esc to split to the right of the cursor, or i Enter Esc to split to the left.

share|improve this answer
1  
That is it. Just insert a single newline. Alternatively: use r+<return> to replace the character under the cursor with a newline. Would be nice to have a single letter command for it, but as far as I know there isn't one. – Tonny Jun 24 '13 at 15:23

You could define your own using map. To define z as the command for example:

:map z i<CTRL+m>
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .