move the text after the cursor to a new line
If the cursor is on a <space>
as in ([]
marks the cursor):
lorem ipsum[ ]dolor sit amet
the simplest is to do r<CR>
, that is "replace the current character with a linebreak".
Otherwise, use @knittl's solution.
As I answered in this post, How do I insert a linebreak where the cursor is without entering into insert mode in Vim?.
Please try Control + j
.
So you want to move everything in the current line, which comes after the cursor to the next line? Read: insert a line break??
(move cursor)
i (or a)
<return>
<esc> (or ^C)
To map this sequence of keystrokes to a single key, follow @thb's suggestion and use the :map
command:
:map <F2> i<CR><ESC>
:map <F2> i<CR>
This keeps vi in insert mode.