How can I do the following?

Copy all text from vim and paste it to an external program e.g. mail Outlook? I tried +y and gg*yG but the paste does not work.

  • 2
    If vim is built with X support, then you should be able to paste into other apps: check with: vim --version | grep clipboard
    – jasonwryan
    Commented Oct 1, 2013 at 20:50
  • Then see :help clipboard. In general you should be able to just plain cut 'n' paste with the mouse, although this can get messed up with TUI vim (but not gvim).
    – goldilocks
    Commented Oct 1, 2013 at 21:40
  • 4
    What's mail Outlook? Commented Oct 1, 2013 at 22:29
  • 3
    Are you running a text mode Vim or Gvim? What's “mail Outlook”? Are you running vim in Cygwin? Or are you running Outlook in a virtual machine? Or are both running on OSX? Commented Oct 1, 2013 at 23:12

1 Answer 1


This requires vim to have X11 clipboard integration. You can check this by doing vim --version and looking for +xterm_clipboard (+clipboard is not it, that's for using the GUI, which may actually be what you're after, the question doesn't specify GUI or terminal).

If you don't have +xterm_clipboard, you'll need to get a version of vim that does have it (or recompile yourself).

If you do have it, then awesome. Lets continue.

X11 has 2 "clipboards". There's the select buffer, and then the real clipboard. The select buffer is the highlight/middle_click thing. The clipboard is the normal CTRL+C/CTRL+V.
To copy the current line into the selection buffer, do "*yy. (yes, that's shift+quote shift+8 y y)
To copy into the clipboard, do "+yy.
(you can use other selection specifiers, like "+yG, or "+y in visual mode)

If you want to make one of these the default, so you can just do yy, without the "+/"* bit, you can add one of the following to your ~/.vimrc:

set clipboard=unnamed


set clipboard=unnamedplus

You didn't specify if you were accessing the machine remotely, but if so you can still do this, but you will need X11 forwarding turned on and working in SSH. I will warn you however that it can cause vim to take several seconds to start up.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .