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.

  • 2
    What does "opening a line" mean? – Matteo Riva Jun 1 '10 at 18:41
  • "opening a line" means going form normal mode to insert mode, which is what happens when you press "O" (oh). – tmadsen Jun 1 '10 at 19:14

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


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


| improve this answer | |

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.

| improve this answer | |
  • 1
    Maybe I wasn't clear. The scenario is this: I'm in normal mode and want to insert a blank line above the one I'm currently on, while staying in normal mode. Pressing "O" puts me in insert mode. Maybe there's no way to do it and that's ok, just thought I would ask :) – tmadsen Jun 1 '10 at 19:16
  • 3
    Just map it, m`O+Esc` – Josh K Jun 1 '10 at 19:33
  • 1
    Good idea, hadn't considered that. Did a :noremap <leader>O O<ESC> – tmadsen Jun 1 '10 at 20:05
  • 2tmadsen: You can map this <yourkey> O<ESC> – Dzung Nguyen Jun 2 '10 at 4:01
: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, '')
| improve this answer | |
  • yah, that is +1 neat! /me changes his vimrc – akira Jun 2 '10 at 6:52
  • Well, it got a few advantages when it comes to scripting. It's bit overkill to type otherwise. – Luc Hermitte Jun 2 '10 at 7:53
  • +1 for a solution that works regardless of how one has set formatoptions – Micah Smith Oct 12 '15 at 1:39

You can map whatever key or key sequence you like to


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

| improve this answer | |
  • so the command to map this to Alt-O would be :map <M-o> m`O<ESC>`` – K Robinson Jun 3 '10 at 16:47
  • That's correct. – Matteo Riva Jun 3 '10 at 19:05
:nmap <CR>_i<CR><ESC>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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