Copy and paste content from one file to another file in vi

后端 未结 18 1525
南方客
南方客 2020-12-04 05:02

I am working with two files, and I need to copy a few lines from one file and paste into another file. I know how to copy (yy) and paste (p) in the same file. But that doesn

18条回答
  •  孤街浪徒
    2020-12-04 05:18

    2017-05 update:

    I just found that if you add the following line into your vimrc file,

    set clipboard=unnamed

    then Vim is using the system clipboard.


    I just found the yank way won't work on the way where I copy contents between different Vim instance windows. (At least, it doesn't work based on my Vim knowledge. I don't know if there is another way to enable it to work).

    The yank way only works on the way where multiple files are opened in the same window according to my test.

    If you want to do that, you'd better use OS cut-copy-past way such as Ctrl + x, Ctrl + c (under Windows).

提交回复
热议问题