Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Disable vim automatic visual mode on mouse select
Disable vim automatic visual mode on mouse select
issue: :set mouse-=a
add to ~/.vimrc: set mouse-=a
my ~/.vimrc for preserving global defaults and only changing one option:
source $VIMRUNTIME/defaults.vim
set mouse-=a
@gardner
Copy link

gardner commented Jul 14, 2020

Thanks! I don't understand why this is a default in neovim.

@damnms
Copy link

damnms commented Jul 18, 2020

this is what happens when a dev thinks "i think thats a good feature", instead of first asking what the customers think ;)

@vinay1591
Copy link

vinay1591 commented Jul 23, 2020

Thanks a lot!

@yogi8091
Copy link

Thanks Folks... Made the day...Finally my struggle is over.

@thakurashwani1983
Copy link

Thanks for this solution. it worked for me

@CMoH
Copy link

CMoH commented Sep 24, 2020

Finally! The way debian set this up seems like they really want us to use their options

@ngosang
Copy link

ngosang commented Oct 2, 2020

Thank God!!!

@MaMrEzO
Copy link

MaMrEzO commented Oct 9, 2020

This way ends with text copied to clipboard with line numbers, Of course if you have one window vertically.
Instead I used to this option.
JUST HOLD SHIFT KEY DURING SELECTING TERMINAL TEXT TO BEHAVE LIKE set mouse-=a

@pappu687
Copy link

pappu687 commented Oct 29, 2020

This way ends with text copied to clipboard with line numbers, Of course if you have one window vertically.
Instead I used to this option.
JUST HOLD SHIFT KEY DURING SELECTING TERMINAL TEXT TO BEHAVE LIKE set mouse-=a

In MacOSX with Iterm2, you would use ALT key instead of SHIFT.

@gregshay79
Copy link

Ye who muck with 'vi' shall be anathema forever!

@kasumiru
Copy link

use the shift yourself, and return me as it was before. without fu "hotfix" echo 'set mouse -=a' >> ~/.vimrc

@xylo
Copy link

xylo commented Jan 19, 2021

Thanks a lot, very annoying "feature".

@artjomaverin
Copy link

artjomaverin commented Feb 18, 2021

use the shift yourself, and return me as it was before. without fu "hotfix" echo 'set mouse -=a' >> ~/.vimrc

Thanks a lot, very annoying "feature".

I was working with RHEL servers for 8 years and now with the news about widthrawing CentOS after it's been sold to IBM - I am setting up debian servers around. GOD was I furious with vim there.

So while looking through the ways of installing vim 2.7 instead of 2.8, I found this one:
https://github.com/neovim/neovim/wiki/Installing-Neovim

Guess what:

alias vi='nvim'
alias vim='nvim'

No more pain!

@konsolebox
Copy link

This helped me instead:

set mouse=
set ttymouse=

Source: https://stackoverflow.com/a/55979801/445221

@hinorashi
Copy link

thanks 🐧

@flaviogoncalves
Copy link

Thanks, whoever changed this setting almost changed me to prefer nano.

@psingarakannan
Copy link

Thanks

@hakling
Copy link

hakling commented Nov 26, 2021

Thanks. Was driving me crazy

@marathone
Copy link

Driving me crazy as well — Does one need to reboot in order for the root change to be accepted? Changed it, and I'm still in visual mode when attempting cpy/paste while using sudo.

@hakling
Copy link

hakling commented Nov 29, 2021

In current editing session just use
:set mouse-=a
If you want it to persist, put it into .vimrc as descibed above. If you only put it in .vimrc it won't take affect until you restart vim

@marathone
Copy link

marathone commented Nov 29, 2021 via email

@Willy65
Copy link

Willy65 commented Dec 10, 2021

set mouse-=a worked for me, thumbs up!
I did have to add "syntax on" in my .vimrc, but then it all worked like a charm.

@mevin-e
Copy link

mevin-e commented Jan 7, 2022

This has helped. Thanks

@stm32repo
Copy link

It still doesn't work as expected. If I change the parameter in /usr/share/vim/vim82/defaults.vim then it is removed after vim update. Changes to /etc/vim/vimrc don't work either. The only solution is to add parameters to ~ /.vimrc for each user. It blows my mind.

@OriBenHur-akeyless
Copy link

OriBenHur-akeyless commented May 3, 2022

to not lose the defaults.vim just put this at the top of your ~/.vimrc

unlet! skip_defaults_vim
source $VIMRUNTIME/defaults.vim

this will survive vim upgrades

@wxiaoguang
Copy link

It still doesn't work as expected. If I change the parameter in /usr/share/vim/vim82/defaults.vim then it is removed after vim update. Changes to /etc/vim/vimrc don't work either. The only solution is to add parameters to ~ /.vimrc for each user. It blows my mind.

If the set mouse= is not in ~/.vimrc, then you need another line for it: let skip_defaults_vim=1 in /etc/vim/vimrc.

@irathore
Copy link

This is the most annoying thing, there is no reason for this. Most useless thing, should not be default.

@gargravarr
Copy link

Thanks, you're the OG

@ixtk
Copy link

ixtk commented Jan 1, 2023

If only this worked for IdeaVim. What a pain.

@scamianbas
Copy link

Thank you so much !! ^_^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment