Vim Tips Wiki
Register
Advertisement
Tip 696 Printable Monobook Previous Next

created 2004 · complexity basic · author Gabe Dalbec · version 6.0


It drives me crazy that frequently when I click in a window, it goes into visual mode for a few characters and thus I can't type normal command mode commands. I'm finding I always have to press "v" to exit visual mode before I can use vim again.

I finally figured out how to disable visual mode using the mouse:

noremap <LeftDrag> <LeftMouse>
noremap! <LeftDrag> <LeftMouse>

Comments[]

In my vimrc:

set mouse=nicr

No more visual mode from using mouse! :help 'mouse'


That doesn't quite work, as the mouse still puts you into visual mode (which is really all I was trying to avoid).

Also, with my way, you can use Shift-LeftDrag to still select visual.


What works for me is :set mouse-=a


If you want to have mouse=a enabled and still want to copy, On mac you can use press fn and select the area. Cmd+c and Cmd+v anywhere you want to.


Yep, having the mouse do anything within VIM itself irritates me to no end. I discovered that to completely disable the mouse, at least in VIM 8.2, place this in your .vimrc file:

set mouse=

Then if you are in your favorite xterm and just want to select stuff without having the VIM visual mode get in your way, you are good to go.

Advertisement