Vim: insert empty line above current line (not open, i.e. without entering Insert mode)

is there a way of inserting a new line above the current, without opening the line (so without entering Insert mode)? That is, like "O", but without opening.


I use Tim Pope's plugin unimpared which has a command specifically for this purpose:

[<space>

And if you want to add a space after the line you are on:

]<space>


The definition of your request is O.

Logically when inserting a new line above would be O.

To insert before the curser: i
After: a
Before the line (home): I
Append at the end of line: A

The closest I think you'll come is I which will put the cursor at the beginning of the line.


:h append()

It won't move the cursor, it will let you insert as many lines (empty or not) as you wish, and it won't modify the previous position mark.

call append(line('.')-1, '')

You can map whatever key or key sequence you like to

m`O<ESC>``

this inserts a blank line above the current one keeping you in normal mode and without changing cursor position.


:nmap <CR>_i<CR><ESC>