Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have this keybinding in .vimrc:

map + :put=''<cr>
map - dd

I find it really useful for fast layout and source file cleaning with + and -.

But using :put=""<cr> adds a line after the current cursor line, whereas dd removes a line at the current cursor.

I'd rather have my + keybinding insert a line rather than add it after. What command should I try ?

share|improve this question
up vote 2 down vote accepted

Edit: Reading it again I gather I misunderstood. But, what about:


It inserts line above current.


As do:


To insert at mark (m[a-z]) one can say 'aput=xx, 'bput=xx etc.

share|improve this answer
after your correction -put is ok. However I don't have understood the difference between .put and put. – Stephane Rolland Mar 13 '13 at 22:44
@StephaneRolland: AFAIK they are the same. As is +0put and -0put. If you do not know one also have $put as last line, 0put to NNput for line specific. +1put two down, +2put three down -3put three up etc. Believe one can also put on marks, but have to check that. – Runium Mar 13 '13 at 22:51

Why not O<Esc>?

:map + O<Esc>
share|improve this answer
...but it also makes vim switch and reswitch of mode. – Stephane Rolland Mar 13 '13 at 23:40
@StephaneRolland, So does :put. (normal <-> cmd), why does that matter? – Stéphane Chazelas Mar 13 '13 at 23:41
just because I thought vim was slow to change of mode, but I have just checked, and that doesn't seem to be the case. – Stephane Rolland Mar 13 '13 at 23:44

Your Answer


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.