How do I replace-paste yanked text in vim without yanking the deleted lines?
Problem
So I usually find myself copying text from one point to another while overwriting old text where the new is pasted: Suppose I visual-mark and ank it. Now I select (which could be anything, not necessarily just a word) and aste the . However, if I now do the same with it will be replaced with instead of . So how do I keep the text that is in the buffer from being swapped with the text that I am currently overwriting? Edit 1 Although I quite like the reigister suggestions (I think I will start using registers more, now that I discovered the command), I am going with a modification of jinfield's answer, because I do not use the swapping mode. does the trick perfectly. Edit 2 I was too fast; romainl's solution is precisely what I was looking for, without the hack in Edit 1. Actually, is enough! So, changing accepted answer.
Error Output
blah1 newtext blah2 wrong1 blah3 wrong2 blah4
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Fix for: How do I replace-paste yanked text in vim without yanking the deleted lines?
I have these mappings in my .vimrc: is the "blackhole register", according to : "When writing to this register, nothing happens. This can be used to delete text without affecting the normal registers. When reading from this register, nothing is returned. {not in Vi}"
Awaiting Verification
Be the first to verify this fix
Sign in to verify this fix