Create New Line While in Insert Mode

Escape to Normal Mode

There are probably a number of ways to do what you want, but one option is to use CTRL-O to escape to normal mode to insert the line. For example CTRL-O o will open a new line below the current line and place your cursor there in insert mode.

If you want to map this rather than use it as a one-off, you can use an imap to set your mnemonic of choice. For example:

:imap \nn <C-O>o

will create an insert-mode mapping for \nn that will do the same thing.


<ESC> o - To open a line below

<ESc> Shift + o - To open a line above.

Tags:

Vim