1

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.

  • 3
    What is the output of :verbose set mouse? in Vim, when you have set mouse=-a in /etc/vim/vimrc but not in ~/.vimrc? Also, does the output of :scriptnames include /etc/vim/vimrc? – muru Nov 11 '19 at 8:04
  • Hi, the first command tells me, that it ignores my /etc/vim/vimrc: mouse=a Last set from /usr/share/vim/vim81/defaults.vim line 79. For the secont part: No it does not. – Thorian93 Nov 11 '19 at 16:22
2

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.

|improve this answer|||||
  • That's exactly what I needed, thanks a lot! This has been bugging me for some time and know I understand the behaviour. An interesting way of configuration though. – Thorian93 Nov 12 '19 at 9:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.