[PLUG] vim versus the clipboard

Terry Griffin griffint at pobox.com
Wed Feb 23 21:29:44 UTC 2005


On Wed, Feb 23, 2005 at 12:50:29PM -0800, Ovid wrote:
> Google fails me again and I've done a great job of spamming this list
> lately.  Thanks for your patience.
> 
> I am editing a bunch of files in vim and I need to paste the contents
> into an HTML text area.  To do that I have to launch Kate or a similar
> text editor to copy stuff directly to the clipboard.  This is seriously
> slowing me down.
> 
> With gvim, I just did ...
> 
>   ggVG and "+y
> 
> ... to copy the current buffer contents, but that doesn't work when I'm
> using vim in a terminal window.  I thought the "*" buffer would work,
> but it doesn't seem to.  How can I copy the current vim buffer file
> contents to the clipboard (on Fedora Core 2)?
> 
> I'm hoping for something similar to "map ,cp :!pbcopy <%<CR>" on Mac OS
> X.
> 
> Cheers,
> Ovid
> 

The only way I know of to copy-and-paste from a non-X11 application is to 
do it with the mouse, with the unfortunate restrictions that you can only
copy what's visible and that tabs will be converted to spaces. Just select
your vim text with the left mouse button, then go to the other application 
and paste with the center button. Note that this type of copying is a 
feature of the terminal application, not vim.

The above procedure may not work for certain terminal applications. KDE's 
Konsole program for example wants you to select the text and then do 
Edit->Copy to copy it to the clipboard. But for most X11 terminal programs
(xterm, rxvt, etc) just the act of selecting the text will automatically 
copy it to the clipboard.

Terry
-- 
Terry Griffin <griffint at pobox.com>
http://www.blindchicken.com/~terryg/



More information about the PLUG mailing list