How can I do a 'change word' in Vim using the current paste buffer?
189
votes
17
answers
112480
views
I have some text in my paste buffer, e.g. I did a
yw
(yank word) and now I have 'foo' in my buffer.
I now go to the word 'bar', and I want to replace it with my paste buffer.
To replace the text manually I could do cw
and then type the new word.
How can I do a 'change word', but use the contents of my paste buffer instead of manually typing out the replacement word?
The best option I have right now is to go to the beginning of the word I want to replace and do dw
(delete word), go to the other place, and do the yw
(yank word). Then go back to the replacement area and do p
(paste) which is kind of clumsy, especially if they are not on the same screen.
Asked by Michael Durrant
(43563 rep)
Aug 29, 2013, 02:45 PM
Last activity: Oct 3, 2023, 11:04 AM
Last activity: Oct 3, 2023, 11:04 AM