So I usually find myself copying text from one point to another while overwriting old text where the new is pasted:
blah1 newtext blah2 wrong1 blah3 wrong2 blah4
Suppose I visual-mark
yank it. Now I select
wrong1 (which could be anything, not necessarily just a word) and
newtext. However, if I now do the same with
wrong2 it will be replaced with
wrong1 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?
Although I quite like the reigister suggestions (I think I will start using registers more, now that I discovered the
:dis command), I am going with a modification of jinfield's answer, because I do not use the swapping mode.
vnoremap p "0p vnoremap P "0P vnoremap y "0y vnoremap d "0d
does the trick perfectly.
I was too fast; romainl's solution is precisely what I was looking for, without the hack in Edit 1.
vnoremap p "_dP is enough!
So, changing accepted answer.