Disable vim automatic visual mode using mouse

Submitted by fabio on Thu, 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:

  1. issue the command :set mouse-=a
  2. insert the directive set mouse-=a into your ~/.vimrc file
Posted in:

This feature makes actually

Submitted by Spliffster (not verified) on Mon, 2010-08-09 22:11.

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.

Submitted by fabio on Tue, 2010-08-10 00:05.

Thanks for your contribution. With line numbers enabled the automatic visual mode using mouse actually makes sense.

Very thanks

Submitted by Valtoni Boaventura (not verified) on Mon, 2009-11-30 19:43.

It's very wonderful.
I don't see this answer in vim docs. Thanks again!

Thanks! I have no idea why

Submitted by James (not verified) on Mon, 2009-11-23 17:40.

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

Submitted by ben (not verified) on Fri, 2009-11-20 14:28.

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

Submitted by R. Henze (not verified) on Thu, 2009-10-22 11:37.

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

Submitted by Anonymous (not verified) on Thu, 2009-10-15 21:03.

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

Submitted by Paweł (not verified) on Wed, 2009-10-07 12:32.

There's no need to disable this feature. Just hold shift while selecting text.

thank you

Submitted by slacki (not verified) on Tue, 2009-08-11 15:35.

hi,
thank you for this information,
this fix my problems and i can now working
with (g)vi(m).

Reply

Submitted by Anonymous (not verified) on Sat, 2009-07-25 21:24.

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

Submitted by JO (not verified) on Sat, 2009-05-23 18:47.

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

Submitted by fabio on Sun, 2009-05-24 08:57.

The file is called ~/.vimrc - Note the dot: without it, it won't work.

THAT drives me insane!!! I

Submitted by Anonymous (not verified) on Wed, 2009-03-25 20:16.

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

Submitted by fabio on Wed, 2009-03-25 20:51.

you shouldn't say that to anyone.

Thankyou thankyou ...the

Submitted by Anonymous (not verified) on Tue, 2009-03-24 12:18.

Thankyou thankyou ...the mouse feature was annoying me .... now i am happy

thank you, thank you thank

Submitted by marsh (not verified) on Thu, 2009-03-12 00:51.

thank you, thank you thank you ;)

this was annoying the crap out of me...

Thanks so much!

Submitted by Anonymous (not verified) on Wed, 2009-02-25 06:04.

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

Submitted by icebird (not verified) on Fri, 2009-02-20 10:32.

hey, thanks for that. I wonder what they were thinking.

Thanks for the fix!

Submitted by Jason (not verified) on Fri, 2009-02-13 04:10.

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

Submitted by Anonymous (not verified) on Tue, 2009-01-06 17:14.

I'm glad i wasn't the only one going nuts.. thanks!

Oh my god THANKS

Submitted by Dam (not verified) on Thu, 2008-12-11 10:40.

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!

Submitted by lll9p (not verified) on Wed, 2008-11-05 17:39.

it fixs haha

THANKS !!!

Submitted by Anonymous (not verified) on Mon, 2008-07-21 15:51.

Now that I control my mouse, i can work again.

thank you

Submitted by Anonymous (not verified) on Tue, 2008-07-15 18:25.

Aaargh. Another source of frustration conquered. Thank you. My wheel continues to work, too. Yay!

yes, that visual mouse was

Submitted by iv (not verified) on Tue, 2008-06-03 15:43.

yes, that visual mouse was highly irritating. thanks for the post.

good point with old dogs :)

thanks, tip was really

Submitted by sundeep (not verified) on Fri, 2008-03-28 09:10.

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!

Submitted by jiki (not verified) on Tue, 2007-11-06 21:38.

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.

Submitted by Jobias (not verified) on Fri, 2007-09-14 21:09.

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

Submitted by Anonymous (not verified) on Fri, 2007-08-03 15:14.

thank you for posting this fix. This problem has been driving me nuts

Post new comment

The content of this field is kept private and will not be shown publicly.
If you have a personal or company website insert its address in the form http://www.example.com/ .
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <pre> <del> <img> <h2> <h3> <h4> <b> <video>
  • Lines and paragraphs break automatically.
  • Images can be added to this post.
  • You may use [inline:xx] tags to display uploaded files or images inline.
  • You may insert videos with [video:URL]

More information about formatting options