Paste multiple times

jwerre picture jwerre · Aug 23, 2011 · Viewed 29k times · Source

What is the best way replace multiple lines with the contents of the clipboard?

The problem I'm having is when I yank a line and paste it over another line the "yank" is replaced with the line I just replace. Now, if I want to replace another line with the same line I have to go back up and yank it again.

There's got to be a better way to do this.

Answer

Benoit picture Benoit · Aug 23, 2011

I have this in my .vimrc:

xnoremap p pgvy

(note: this will work only with the default register, but this mapping is easy to remember). Writing a more elaborate version would be possible. Also, you still can use P to get the old behaviour.