How to fix vim's default setting that enables visual mode on mouse click

A few years ago vim started to go into "visual" mode whenever I tried to copy text via the right click menu. Eventually I thought I had fixed it by setting up a /etc/vim/vimrc.local file like this:

source $VIMRUNTIME/defaults.vim
set mouse=

But then the issue cropped up again. Today I finally found the right GitHub issue with the information needed to fix it. You add the let line in the following code:

source $VIMRUNTIME/defaults.vim
let g:skip_defaults_vim = 1
set mouse=

I still have not found out why they made that change. I'd think you'd not want mouse interaction beyond what the terminal provides when working in a terminal editor. 

Anyway, I'm mostly posting this for myself. I'm sure there will be a time I need to reference it.

 

Submitted by david.reagan on