From http://vim.wikia.com/wiki/Accessing_the_system_clipboard
set clipboard=unnamedplus
Then use "+y
for copying and "+p
for pasting.
This changes the default Vim register to the +
register, which is linked to the system clipboard. From :h clipboard-unnamedplus
:
clipboard-unnamedplus
unnamedplus A variant of the "unnamed" flag which uses the
clipboard register '+' (quoteplus) instead of
register '*' for all yank, delete, change and put
operations which would normally go to the unnamed
register. When "unnamed" is also included to the
option, yank operations (but not delete, change or
put) will additionally copy the text into register
'*'.
Only available with the +X11 feature.
Availability can be checked with:
if has('unnamedplus')