Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

3 Answers 3

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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