Vim Tips Wiki
(Adding categories)
(Adjust previous/next navigation)
Line 9: Line 9:
 
|version=6.0
 
|version=6.0
 
|rating=26/8
 
|rating=26/8
|category1=
+
|category1=Mouse
 
|category2=
 
|category2=
 
}}
 
}}
Line 37: Line 37:
   
 
:--[[User:Fritzophrenic|Fritzophrenic]] 13:23, 5 September 2008 (UTC)
 
:--[[User:Fritzophrenic|Fritzophrenic]] 13:23, 5 September 2008 (UTC)
[[Category:Mouse]]
 

Revision as of 02:52, 20 July 2009

Tip 1154 Printable Monobook Previous Next

created February 27, 2006 · complexity basic · author Anon · version 6.0


With this tip, just selecting text with mouse in gvim, will copy that text to the clipboard for pasting into other applications (on Windows and on Xwindows, ala Xterms).

Put these commands in ~/.gvimrc

" Method 1 (for Xwindows and mswindows), this map is different from the one shown in vim documentation:
:noremap <LeftRelease> "+y<LeftRelease>

" Method 2 (works only on ms-windows vim63):
:set guioptions+=a

Comments

I suppose you meant vnoremap.


 TO DO 
Can someone tell me how to disable this autocopy function. I often want to replace some selected text with some other text i have copied before. The autocopy function always owerwrites my buffer.

This is an important question about the tip that needs to be addressed. For method 1, try selecting the text you wish to replace with visual mode instead of selection mode (i.e. use v, V, or CTRL-V instead of the mouse). Method 2 will not allow this, because it copies the visual selection. Perhaps using A instead of a in the guioptions would allow it to work?
Of course, you could alway just dispense with the automatic copying, and copy manually instead. See Accessing the system clipboard.
--Fritzophrenic 13:23, 5 September 2008 (UTC)