Tip: #564 - Mouse wheel for scroll only - disable middle button paste
Created: September 26, 2003 12:58 Complexity: basic Author: Girish Gajwani Version: 5.7 Karma: 52/23 Imported from: Tip#564
I have had a problem when using the mousewheel for scrolling. I occasionaly press the wheel and it pastes text in the clipboard's "*" register at the place where the scroll wheel was pressed accidentally. This has been a constant irritation.
The workaround is documented in VIM help -
- help <MiddleMouse>
From change.txt (VIM help):
"If you have a scrollwheel and often accidentally paste
text, you can use these mappings to disable the
pasting with the middle mouse button: >
:map <MiddleMouse> <Nop>
:imap <MiddleMouse> <Nop>"
Also, to revert to the original setting for middle button click, simply unmap the previous setting.
:unmap <MiddleMouse>
:iunmap <MiddleMouse>
Enjoy!
Comments
While at it, take care also of 2-MiddleMouse, 3-MiddleMouse and (oh, humanity! :) ) 4-MiddleMouse. (that's for middle double clicks and triple and ...) Alternatively, instead of simply ignoring it, make it the same as a left click with a noremap <MiddleMouse> <LeftMouse> (also with noremap!, and the whole 2-,3-,etc. list above).
cristi001 at hotmail , October 7, 2003 17:08
These tips are helpful in stopping an accidental *single* click, but 2+ clicks in same location (such as the button being pressed on by a book) will still cause a paste to occur... Anyone know why?
scraimer--AT--softhome.net , May 22, 2005 12:35
I find it easier to hold down the Ctrl key since I have nothing mapped to Ctrl-Middle. And then the middle mouse button still works according to my creaky old X-windows-originated intuitions.
kemosabi--AT--reductio.com
, April 18, 2006 14:28