0

I have some settings in my debian (in /etc/vim/vimrc.local), which are overwritten by some plugins. Exactly which ones, at the moment is it hard to say, however I find it quite an annoying one.

I found the problem after some of my settings (in /etc/vim/vimrc.local) simply did not work. I have made a debugging with the command vim -V9logfile.log testfile and I have found this:

finished sourcing /usr/share/vim/vim90/debian.vim
finished sourcing /usr/share/vim/vim90/colors/lists/default.vim
finished sourcing /usr/share/vim/vim90/syntax/syncolor.vim
finished sourcing /usr/share/vim/vim90/syntax/synload.vim
finished sourcing /usr/share/vim/vim90/filetype.vim
finished sourcing /usr/share/vim/vim90/autoload/dist/script.vim
finished sourcing /usr/share/vim/vim90/scripts.vim
finished sourcing /usr/share/vim/vim90/syntax/syntax.vim
finished sourcing /etc/vim/vimrc.local
finished sourcing /etc/vim/vimrc
finished sourcing /usr/share/vim/vim90/filetype.vim
finished sourcing /usr/share/vim/vim90/ftplugin.vim
finished sourcing /usr/share/vim/vim90/indent.vim
finished sourcing /usr/share/vim/vim90/syntax/nosyntax.vim
finished sourcing /usr/share/vim/vim90/syntax/syncolor.vim
finished sourcing /usr/share/vim/vim90/syntax/synload.vim
finished sourcing /usr/share/vim/vim90/syntax/syntax.vim
finished sourcing $VIMRUNTIME/defaults.vim
finished sourcing /usr/share/vim/vim90/plugin/getscriptPlugin.vim
finished sourcing /usr/share/vim/vim90/plugin/gzip.vim
finished sourcing /usr/share/vim/vim90/plugin/logiPat.vim
finished sourcing /usr/share/vim/vim90/plugin/manpager.vim
finished sourcing /usr/share/vim/vim90/plugin/matchparen.vim
finished sourcing /usr/share/vim/vim90/plugin/netrwPlugin.vim
finished sourcing /usr/share/vim/vim90/plugin/rrhelper.vim
finished sourcing /usr/share/vim/vim90/plugin/spellfile.vim
finished sourcing /usr/share/vim/vim90/plugin/tarPlugin.vim
finished sourcing /usr/share/vim/vim90/plugin/tohtml.vim
finished sourcing /usr/share/vim/vim90/plugin/vimballPlugin.vim
finished sourcing /usr/share/vim/vim90/plugin/zipPlugin.vim
finished sourcing /usr/share/vim/vim90/scripts.vim
finished sourcing /usr/share/vim/vim90/ftplugin/vim.vim
finished sourcing /usr/share/vim/vim90/indent/vim.vim

Fine. So, I have a lot of sources read in before and also after my vimrc.local, which is the ordinary place in debian for system-wide vi settings. Somewhere there, my settings are overwritten and it really annoys me. I believe, what I set up manually, should be stronger settings as some distro defaults.

Maybe we have a "battle of worlds" here, i.e. debian has some ideas how configs should look and vim has contradicting ones? Or it might be only some bug? Anyways, what should I do to let these things do what I want?

P.S.: The settings are:

set mouse=
set ttymouse=

But please do not make this the focus of the answer. I do not find first this problem, and mysteriously unworking config directives are the worst what a command line guy can annoy. Question is to get a clear picture, what is the root of the cause in the general case and how to solve it. If debian is maybe too orthodox then I will find a way to enforce into what I want from him.)

7
  • 1
    Couple tips: use :verbose set opt? and :verbose setlocal opt? to find out where opt was last set. And, unless you need system-wide configuration, try a user vimrc (e.g., ~/.vim/vimrc). Unfortunately overly general questions are hard to answer, so I think it would be better to focus in on what you want to solve.
    – D. Ben Knoble
    Mar 30 at 21:58
  • OMG, it is set up in /usr/share/vim/vim90/defaults.vim! Which is after my vimrc.local... the problem was very simple, set mouse= worked well directly but not in my /etc/vim/vimrc.local. I... just felt that something overwrites it. And now I know, who!!
    – peterh
    Mar 30 at 22:24
  • But I do not know, how to make this question useful. I think it is likely useful, I had the some problem already not once, but only now I had the... mental resource to track it. I think so is this question not so bad and it could help a lot for the googlers of the future. Previously I did not find anything by google, this is why am I here.
    – peterh
    Mar 30 at 22:28
  • 1
    Another victim of defaults.vim… and of not doing their config where it belongs: in their $HOME.
    – romainl
    Mar 31 at 9:34
  • 1
    $HOME is where you should do that stuff.
    – romainl
    Mar 31 at 10:44

2 Answers 2

2

Copying my comment here:

Couple tips: use :verbose set opt? and :verbose setlocal opt? to find out where opt was last set. And, unless you need system-wide configuration, try a user vimrc (e.g., ~/.vim/vimrc): etc and friends for system-wide configuration are rarely touched by most unless you are a sysadmin who really needs to tweak something for all users to make Vim work.

It seems that the defaults.vim script which is in effect if you have no vimrc (or if you explicitly execute with :runtime) is changing options after your etc scripts. Creating an (empty) user vimrc will disable it, though you may miss other such « defaults ». Copy the bits that you understand and like to said vimrc.

0
In short: put let g:skip_defaults_vim = 1 in /etc/vim/vimrc.local .

Ben Knobles answer helped a lot to understand, what is going on. Finally I wanted to report a bug to the debian, but it had been a duplicate :-), here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=856273

And also the solution works, although it is not very well documented. The essence of the solution:

  1. Yes, defaults.vim (in $VIMRUNTIME) override the vimrc.local settings. Their explanation does not say a reason, it only states that the purpose of their defaults is for the users without any vimrc et al. That is imho not a really acceptable explanation.
  2. Putting let g:skip_defaults_vim = 1 in /etc/vim/vimrc.local disables the factory vim defaults, including the overrides (vim players probably do not need too much default).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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