vimcopy-pastevicut

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


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't work for different files. How is this done?

Also, is there a way to cut-paste? I have tried googling, but most of the resources only talk about copy-paste.


Solution

  • Since you already know how to cut/yank text, here are a few ideas for pasting it back into another file: