When I have to replace a word with another word I yank before, I usually use a workflow which seems unnatural to me:
Let's say I have this text:
foo bar buzz
And I want to yank foo
and replace bar
with what I yanked before.
After yanking foo
, I see the following options:
Option 1
Place the cursor on
bar
withw
Put
foo
in front ofbar
withP
Put the cursor on the
b
of the remainingbar
and delete the word withde
Option 2
Put the cursor on bar with
w
Use
de
to erasebar
Put the content of the register 0 with
"0P
(since I erasedbar
,foo
isn't accessible anymore with a simplep
)
Both ways seems over-complicated to me and I'm sure there is a more efficient way to achieve this action but I can't find how. This idea would be to combine the delete and the put actions in only one, or at least avoid to keep the deleted word in the yank register so as I can put the desired word with a simple p
.
Also I know the replace mode triggered with R
but it doesn't allow to put what was yanked.
TL;DR: How to replace a word with the content of the yank register?