Vim Tips Wiki
(Change to TipImported template + severe manual clean)
(Added some code for a todo on disabling auto-copy)
 
(7 intermediate revisions by 4 users not shown)
Line 4: Line 4:
 
|previous=1153
 
|previous=1153
 
|next=1155
 
|next=1155
|created=February 27, 2006
+
|created=2006
 
|complexity=basic
 
|complexity=basic
|author=Anon
+
|author=
 
|version=6.0
 
|version=6.0
 
|rating=26/8
 
|rating=26/8
  +
|category1=Mouse
  +
|category2=
 
}}
 
}}
 
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).
 
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
 
Put these commands in ~/.gvimrc
 
 
<pre>
 
<pre>
 
" Method 1 (for Xwindows and mswindows), this map is different from the one shown in vim documentation:
 
" Method 1 (for Xwindows and mswindows), this map is different from the one shown in vim documentation:
:noremap &lt;LeftRelease&gt; "+y&lt;LeftRelease&gt;
+
:noremap <LeftRelease> "+y<LeftRelease>
   
 
" Method 2 (works only on ms-windows vim63):
 
" Method 2 (works only on ms-windows vim63):
:set guioptions=a
+
:set guioptions+=a
 
</pre>
 
</pre>
   
Line 26: Line 27:
   
 
----
 
----
  +
{{todo}}
Also you want to use this (to just append the "a" to your options):
 
  +
Can someone tell me how to disable this autocopy function. I often want to replace some selected text
<pre>
 
  +
with some other text i have copied before. The autocopy function always owerwrites my buffer.
:set guioptions+=a
 
</pre>
 
   
  +
To Disable Auto Copy:
----
 
  +
  +
Put this in .gvimrc
  +
" Following three lines remove the auto copy function from VIM
 
set guioptions-=a
  +
set guioptions-=A
  +
set guioptions-=aA
  +
  +
  +
: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]].
  +
  +
:--[[User:Fritzophrenic|Fritzophrenic]] 13:23, 5 September 2008 (UTC)

Latest revision as of 09:41, 31 January 2011

Tip 1154 Printable Monobook Previous Next

created 2006 · complexity basic · 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.

To Disable Auto Copy:

Put this in .gvimrc

" Following three lines remove the auto copy function from VIM
 set guioptions-=a
 set guioptions-=A
 set guioptions-=aA


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)