I am a heavy vim user and want to be able to copy and paste from the system clipboard so that, for example, I can edit my posts in vim and then paste them from firefox in here. I should also mention that I prefer to use terminal not gui versions of vim which influences the solutions recommended below.
Use pbcopy and pbpaste. These are two very useful Mac OSX terminal commands that give access to the system clipboard. To use from vim pipe your selection (using ‘!’) through them, e.g. to copy the whole document to the clipboard:
Method 1: similar to Mac OSX trick using xclip (sudo apt-get install xclip) and then pipe through that. Specifically:
:%!xclip -i -selection clipboard
Method 2: If you have xterm-clipboard enabled in your version of vim (not the case in the default version of vim installed, you’ll need vim-full) you can access the clipboard as a register. Selection register is named ‘*’ and clipboard is named ‘+’. So to copy to the clipboard get your selection and then do:
For more information on vim and the xclipboard do: