Tuesday, April 28, 2009

Copying the entire contents of a file to system clipboard using Vim

I've been collecting MouseHunt journal logs and putting them into pooflinger's Log Summariser. Since I try to use Vim as my text editor as much as possible, it's become quite annoying when time comes to copy the contents of the file to be pasted onto the page.

Hence, tonight I've gone and found myself the way to copy the whole shebang onto GNOME's system clipboard so I can just paste the journal logs instead of opening the file in another (GUI) text editor for the purpose.

Here's the command to copy the entire file contents from Vim to the clipboard:

:%y+

Simple, no? Learn something new every now and then ;-)

The link provided even lists other variations that might come in handy someday.