To paste between vim and something else, use the + (plus) buffer in vim. It contains the contents of your system clipboard, and you can also write to it. If you’re not already using buffers in vim, then you should probably read the excellent documentation but for a very quick start:
- To copy something into the buffer, select it in visual mode and type
"+y
- To paste from the buffer, type
"+P
I had no idea how I’d missed this really fundamental trick, so I thought I’d share!