I want to copy text from vim, eg. by selecting in visual mode, then ctrl+insert and I'd like to have the copied text in system buffer, so I can paste it anywhere I like with eg ctrl+v. Is it possible somehow?

Problem arises when I need to copy long text from vim window to buffer. I cannot simply select it all with a mouse and then copy it, because the text doesn't fit in the window.

link|improve this question

feedback

migrated from serverfault.com Jul 6 '11 at 13:24

This question came from our site for system administrators and desktop support professionals.

1 Answer

up vote 4 down vote accepted

Yes. Vim has references to the system clipboards as registers, which you can use like any other registers.

The main clipboard is *, so you can highlight in visual mode, then type "*y. If you're using X11 you can copy to the X11 buffer using the + register. Lastly, you can reassign the default register to the clipboard register with :set clipboard=unnamed. If you do this then any copies, yanks, or kills will automatically go to the system clipboard without you manually specifying the register first.

link|improve this answer
It worked first time after I rebooted my PC. But after that when I've used console buffer, system buffer, etc, they seems to have mixed up. So now when I do "*y, text doesn't go to system buffer. But X11 buffer + still working fine. Thanks anyway. – gasan Jul 7 '11 at 10:44
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.