Disable vim automatic visual mode using mouse
Last updated on Thu, 2010-10-14 20:33. Originally submitted by fabio on 2007-07-12 11:41.
I usually use Vim for command line text file editing.
Some days ago, probably due to a change in /etc/vimrc after a system update, the behavior of the mouse changed.
Selecting some text with the mouse automatically enter visual mode. I rarely use the visual feature and when I use it I prefer using the v keyboard command.
I found this new setting pretty annoying. So I decided to disable it.
If you also want do the same you can either:
- issue the command :set mouse-=a
- insert the directive set mouse-=a into your ~/.vimrc file



vi(m) and mice ... just say no.
just commented the offending section from /usr/local/share/vim/vimrc:
. . .
. . .
" In many terminal emulators the mouse works just fine, thus enable it.
" NO .... just no. Learn to use vi commands instead of this.
"if has('mouse')
" set mouse=a
"endif
rather than add:
set mouse-=a
Seems default behaviour is visual off and default vimrc was on. tada!.
Hope it helps.
Another aonnoying feature
Recently the new version of vim when you make some visual-mode selection, put the "visualized" into the mouse buffer.
May be you know how to disable this feature, can you help me?
TIA
nope..
I'm sorry, never experienced that.. maybe you should ask directly to vim developers?
Good luck!
Toggle mouse on and off
You can add this code into vimrc to toggle mouse on and off for (F12) Function key.
nnoremap :call ToggleMouse()
function! ToggleMouse()
if &mouse == 'a'
set mouse=
echo "Mouse usage disabled"
else
set mouse=a
echo "Mouse usage enabled"
endif
endfunction
This doesn't seem to work for
This doesn't seem to work for me.. Would you please check?
Slightly wrong
Here's a version that uses F1 and turns off line numbering:
"Enable and disable mouse use
noremap :call ToggleMouse()
function! ToggleMouse()
if &mouse == 'a'
set mouse=
set nonumber
echo "Mouse usage disabled"
else
set mouse=a
set number
echo "Mouse usage enabled"
endif
endfunction
should have previewed, tags are being removed
"Enable and disable mouse use
noremap <f1> :call ToggleMouse() <CR>
function! ToggleMouse()
if &mouse == 'a'
set mouse=
set nonumber
echo "Mouse usage disabled"
else
set mouse=a
set number
echo "Mouse usage enabled"
endif
endfunction
This feature makes actually
This feature makes actually sense if one uses vim for more than basic editing. I am using vim for programming and have therefore line-numbers and color coding enabled always (set number, syntax on). When using the xterm for selecting text, line numbers are also selected which is very annoying.
Thanks for the hint on how i can set vim into visual mode by selecting with the mouse. in visual mode, the selection doesn't include the line numbers.
This combination makes actually sense:
set number
set mouse=a
Cheers,
-S
Thanks for your contribution.
Thanks for your contribution. With line numbers enabled the automatic visual mode using mouse actually makes sense.
Very thanks
It's very wonderful.
I don't see this answer in vim docs. Thanks again!
Thanks! I have no idea why
Thanks! I have no idea why anybody would want a mouse in vim. That's a stupid feature. If you're using the mouse, you probably want to copy something OUT of the terminal, like text into a browser.
Anyway, thanks.
thanks a million
I wonder what happened to my putty software. I normally use the mouse right click to copy text into vi within putty. I stopped working oneday when there was a system update.
Now things back to normal. Visual mode is a bit confusing and I never used it anyway.
gnome-terminal
Thank you very much! This was really annoying.
I assumed that this is a case of gnome-terminal.
So it took a while till I found your blog.
Best regards
R. Henze
Vim is not compiled with this enabled, except for gvim
If you're seeing this effect in Putty, that means your sysadmin put it into the global vimrc file. If you build vim from source on your own machine, which doesn't already have a global vimrc file, you shouldn't this effect when you login to SSH using putty.
simple alternative solution
There's no need to disable this feature. Just hold shift while selecting text.
BRILLIANT!
BRILLIANT!
thank you
hi,
thank you for this information,
this fix my problems and i can now working
with (g)vi(m).
Reply
It happened when I tried to write a code to add an action and enabled my module for the 1st time
I cannot see any connection between this and my code I actually just contained empty functions and hooks
This is not the 1st time I got this, last time I recovered from my nightly backup and lost the accesslog, watchdog and some cache I am not backing up nightly
I think this is a critical issue, I'll do my best to investigate it anyway your tip saved me! 10x!
Florida Permit Test
That is anoying
I hardly came across something more annoying as "visual" edit mode in VIM. I'm using putty a lot and the left mouse button is to paste text, not to enter "visual" mode, thank you very much.
If I want a "visual" editor vi, or vim, is the last thing I think about.
adding set mouse-=a to a file called ~/vimrc didn't change a thing. vim insisted on "visual" mode.
Please give me back vi
The file is called ~/.vimrc
The file is called ~/.vimrc - Note the dot: without it, it won't work.
THAT drives me insane!!! I
THAT drives me insane!!! I hate to say this but that one that decided to do this as default setting should ___ right NOW!!!!
Thanks A LOT for this hint!
EDIT: removed offensive words
you shouldn't say that to
you shouldn't say that to anyone.
Thankyou thankyou ...the
Thankyou thankyou ...the mouse feature was annoying me .... now i am happy
thank you, thank you thank
thank you, thank you thank you ;)
this was annoying the crap out of me...
Thanks so much!
I had resorted to head|tail file everytime I had to copy it over because of this annoying auto visual feature. Thanks for this setting and note!
hey, thanks for that. I
hey, thanks for that. I wonder what they were thinking.
Thanks for the fix!
This has been killing me too. Now if I can only find an app that will let me cat files to the clipboard. BTW it looks like you're using Drupal for you website. Drupal rocks!
I'm glad i wasn't the only
I'm glad i wasn't the only one going nuts.. thanks!
Oh my god THANKS
Was driving me crazy, I knew something was up with my .vimrc because renaming it would restore the old behaviour, but jeez...
This was a horribad feature, leave my mouse alone >.<
thankyou very much!
it fixs haha
THANKS !!!
Now that I control my mouse, i can work again.
thank you
Aaargh. Another source of frustration conquered. Thank you. My wheel continues to work, too. Yay!
yes, that visual mouse was
yes, that visual mouse was highly irritating. thanks for the post.
good point with old dogs :)
thanks, tip was really
thanks, tip was really helpful.
i was trying to copy the name of function from the vim editor into gbd window. Was unsuccessful till now :)
Oh dear, THANK YOU!
It was driving me crazy too, I thought at first that there was sth wrong with my laptop.
Looks like vim people can't teach old dogs new tricks:)
cheers
I too had this problem.
I too had this problem. However, one thing I now miss about vim is that the mouse wheel no longer works. It seems as if setting mouse=a instead of mouse-=a, while producing the annoying auto-visual mode behavior, also enables the mouse wheel. Ah well, the trade-offs are worth it.
thank you for posting this
thank you for posting this fix. This problem has been driving me nuts
Post new comment