Vim – Disable Visual Mode in /etc/vim/vimrc on Debian

debianvivimvimrc

I found plenty of questions regarding disabling visual mode in vim but none that tackles my particular problem:

I added set mouse-=a to my /etc/vim/vimrc file to disable visual mode for good. Thing is: That seems to do nothing. However when I put the exact same directive into my user's .vimrc file it works.

Is this expected behaviour? Did I miss something? Has anyone a solution which doesn't involve managing a .vimrc file for each and every user?

Thanks in advance!

I am on Debian 10, fully updated by the way.

Best Answer

Debian's /etc/vim/vimrc contains this comment:

" Vim will load $VIMRUNTIME/defaults.vim if the user does not have a vimrc.
" This happens after /etc/vim/vimrc(.local) are loaded, so it will override
" any settings in these files.
" If you don't want that to happen, uncomment the below line to prevent
" defaults.vim from being loaded.
" let g:skip_defaults_vim = 1

As :verbose set mouse? says, that was set by /usr/share/vim/vim81/defaults.vim mentioned above ($VIMRUNTIME on Debian would be /usr/share/vim/vim<version>).

So, you can either create a ~/.vimrc (or ~/.vim/vimrc) for your user (even an empty one will do), or uncomment let g:skip_defaults_vim = 1 in /etc/vim/vimrc.

Related Question