This is answered to some degree in statox's answer to the question you linked.
The key to your question is an understanding of vi's registers.
When you yank text, it gets placed in register 0, and the unnamed register gets pointed to register 0. When you delete text, it gets placed in register 1, and the unnamed register gets pointed to register 1.
When you "put" text, it gets pasted from the unnamed register by default.
However, you can specify what register you want to paste from or copy into. That's what the double-quote ("
) key does: specify a register.
So there are several simple approaches, any of which will work. The two basic approaches are:
- Yank the text you are going to paste just as you usually would (perhaps with
yw
, delete the text you want to overwrite just as you usually would (with dw
), then paste from register 0 by typing "0P
or "0p
.
- Yank the text as usual with
yw
, then delete the text you want to overwrite into the black hole register by typing "_dw
, then paste with p
or P
.
You could also yank into a named register ("kye
to yank into register k
, for example) and then paste from that register.
If you want the operation to be repeatable with the .
command and perform it in one step, you could also use "_ce
to "change to the end of the word", dumping the word being changed into the black hole register, and then type <C-r>0<Esc>
while in insert mode to paste from register 0 and exit insert mode.
EDIT: As pointed out in the comments, some of the above approaches may use Vim extensions. An approach that strictly uses POSIX vi
features but is perhaps not as handy is, yank the word you want into a named register (I'll say register k) by using "kye
, then delete the word you don't want with de
, and paste in the word you yanked with "kP
.
cw
and then paste/put from your register?:h scp
Pde
? if you yanked the word word with something likeyw
then in most cases it will include the space after word, so if you move to another word and doPde
you will insert new one and erase existing. In some cases you may needPlde
- paste, move left and then delete util the end.