Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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

Haven't been able to figure this out...

So I usually like to select a word (say, albatross) and copy it to a register using v i w y, which–as I understand it–copies it into the * register.

Then I want to paste it back over another word (sparrow), so I'll do v i w p.

But often I'll want to paste the original word (albatross) over yet another word (osprey), but when I try to repeat my past commands, the pasted value comes out as sparrow, not albatross. This, I know, is because when the text is deleted before being pasted, it's copied into the * register, overwriting albatross with sparrow.

I thought I could work around this by using named registers, so I tried copying with v i w " 1 y and pasting with v i w " 1 p, but that just reproduces my original problem with the * register using the "1 register.

To all you VIM ninjas out there, what am I doing wrong? I'd like to be able to quickly yank some arbitrary text (preferably using the * register, as it saves me two keystrokes) and paste that original value n times afterwards at any point in the document.

How is something like this done efficiently?

share|improve this question
up vote 2 down vote accepted

You should use the "a to "z (named) registers, instead of the numbered registers, which stores previous deletes automatically.

share|improve this answer
Ahh, thanks; I didn't realize there was a difference between numbered and named registers. – neezer May 3 '12 at 18:10
Btw, :registers gives you the contents of all registers, can be helpful. – Bernhard May 3 '12 at 18:27

The 0 register holds the last text yanked, so once you yank some text, you should be able to paste it over and over again with "0p. For more about this, see

:help quote0
share|improve this answer
Also helpful, but "a is easier to type than "0. :) – neezer May 3 '12 at 18:10
Yeah, but with "a you also have to yank to "a, whereas with "0 you can just yank to the default register. – garyjohn May 3 '12 at 18:13
Very true, but it's less muscle-memory training for me to navigate "a for two extra keystrokes than it is to reach up to "0 even once. Still, useful info. Thanks! – neezer May 3 '12 at 18:24
@garyjohn great tip, didn't know that. – tidbeck May 4 '12 at 7:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .