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
These remaps work like a charm for me:
vmap "*y " Yank current selection into system clipboard
nmap "*Y " Yank current line into system clipboard (if nothing is selected)
nmap "*p " Paste from system clipboard
So, when I'm at visual mode, I select the lines I want and press Ctrl + c and then Ctrl + v to insert the text in the receiver file. You could use "*y as well, but I think this is hard to remember sometimes.
This is also useful to copy text from Vim to clipboard.
Source: Copy and paste between sessions using a temporary file