Search code examples
vim

How to copy a word and paste it over another word in Vim?


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?


Solution

  • 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