Debian9 / stretch – disable mouse in vim

For those who are working with the newest Debian version and are used to work along with the vim editor, the auto-enabled mouse behaviour might be quite offending.

At least for me, it was, that’s why was looking for a solution to turn off the mouse constantly.

So when you are working inside vim, and want to „right click“ paste – you have to enter the following commands to get things temporary to work:

:set mouse=""

:set paste

But those settings will get lost when you close the editor.

 

To make them persistent, go to the file:

/usr/share/vim/vim80/defaults.vim

From Line 69 it should look like the following:

if has('mouse')
set mouse=a
endif

comment out those three lines with “ to

" if has('mouse')
" set mouse=a
" endif

 

If you want to have paste mode enabled by default as well, add the following to the end of the file

/usr/share/vim/vim80/defaults.vim

set paste

to revert this setting during operation – just type:

:set nopaste

within vim command mode and you’re set.

About the Author

Mike Schiessl