I'm a vim user and I somehow completely missed this excellent feature until much more recently than I care to admit! Usually vim has its own clipboard, but it doesn't share with the operating system. You will need a vim-gtk install, this isn't available in really basic vim (I'm a little unclear exactly on the dependencies).
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
- To paste from the buffer, type
I had no idea how I'd missed this really fundamental trick, so I thought I'd share!