How do I paste from vim to other apps with linux?

vim

Solution

There are lots of options for this:

Copy to the middle click register (selection clipboard):

gg"*yG

Copy to the copy-and-paste clipboard

gg"+yG

These both work by using `gg` to go to the start of the file, `"+` or `"*` select the register, `y` starts the yank and `G` is a motion to the end of the file.

To use the visual approach, you would do `ggvG"+y` (or replace `+` with `*` for the selection register).

Use command mode to do the same:

:%yank "
" Or:
:%yank +

For more information, see:

:help :yank
:help quoteplus

To use the `*` register by default, you can do:

:set clipboard=unnamed

This allows you to use `ggyG` or `:%yank` (without a register specifier) and then middle click to paste.

:help 'clipboard'

Problem

I'm trying out vim after being a long term user of textmate, and while I can see the appeal of the app, even something as simple as selecting all on vim called on the a command line to paste into another app seems needlessly complex. How do you make whatever you yank into the buffer available to other apps? At present, I'm typing `ggvG` to select the whole file, and then typing `y` to yank it into the buffer, but this buffer isn't available to other apps. I'm using Ubuntu Jaunty (the stock netbook remix install) and I'm using vim 7.2.79. Also, is there a way to get a simple gui wrapper vim this as well, like how you have with macvim?

Original source