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?
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.
Sign up to join this communitySelect the current line in visual mode before pasting: Vp
.
noremap p Vp
).
Feb 5, 2015 at 18:57
p
is too useful to overwrite. Vp
is fine. I don't need it that often.
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