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
I suppose you meant vnoremap.
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)