I copy several lines of text and open a brand new file.

If I paste with p, I get an empty line above the pasted text.

If I paste with P, I get an empty line below the pasted text.

How can I paste and remove/replace/delete the current line?

2 Answers 2


Select the current line in visual mode before pasting: Vp.

  • Makes sense. I was hoping there was something more simple, without visual mode.
    – aharris88
    Feb 5, 2015 at 18:44
  • @aharris88 I did a little research on this and I can't find a simpler way to do it. I'd love to be proven wrong, though!
    – user2
    Feb 5, 2015 at 18:46
  • 1
    You can always rebind this key combination to something else (like noremap p Vp). Feb 5, 2015 at 18:57
  • Yeah, but p is too useful to overwrite. Vp is fine. I don't need it that often.
    – aharris88
    Feb 5, 2015 at 19:06

As you have mentioned that you want to paste the text in a new file. This would work once you have the text selected

:'<,'>w new_filename

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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