I know how to copy a word, but I seem to overwrite what is in my clipboard because, when I try to copy over a word, it does not seem to be working.
To copy a word, I can use
bye
How to copy over a word?
To copy selected text to system clipboard type "+y in Normal Mode. Now you can paste it anywhere else using Ctrl-v . To copy text from outside applications into Vim editor, first copy the text using the usual Ctrl-C command then go to Vim editor and type "+p in Normal Mode.
Perhaps you just want to do this:
viwp
which will visually select a new word, and paste over it.
Now, if you don't want to lose your register when doing this, you can also put in your vimrc:
xnoremap p pgvy
Copy the source word as usual (e.g., with yiw
) and use
viw"0p
to paste over the destination word.
Since the p
command in Visual mode (see :help v_p
) does not alter
the numbered register 0
containing the text from the most recent
yank command, the same copied word can be pasted over and over again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With