tags:

views:

436

answers:

5

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?

+1  A: 

Oh dear, hanging my head in shame.

Just discovered gvim in accessories on ubuntu.

Chris Adams
Oh hang on, this still doesn't solve the pasting problem - I'm still unable to paste from vim to other apps.Is this standard behaviour?
Chris Adams
+1  A: 

Why not "select with mouse" - "paste with middle button" pattern?

EFraim
That wouldn't work well if you want to select all I suspect.
Alex
+4  A: 

Copy your text to the * register:

  gg"*yG

Then middle-click on any application to paste it..

CMS
This requires +xterm_clipboard - see :version - which I think is only available in "big Vim" on Ubuntu. The default Vim is the minimal version that had lots of features disabled at compile time!
rq
+1  A: 

I do it like this:

  • in vim: gg SHIFT+v G "+y
  • in other app: middle button or ctrl+v
jaux
+7  A: 

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'
Al
and if this is too much to type, then define some mappings for the relevant commands in your .vimrc
Blixtor