Bug#864074: defaults.vim: broken configuration

James McCoy jamessan at debian.org
Wed Jul 19 00:21:19 UTC 2017


On Sat, Jul 08, 2017 at 11:36:07PM +0200, Martin Steigerwald wrote:
> James McCoy - 05.07.17, 21:09:
> > This _is_ the behavior.  The _only_ way that defaults.vim is used is
> > when $HOME/.vimrc doesn't exist.
> > 
> > Note that /etc/vim/vimrc.local is a Debian-specific extension of the
> > system-wide vimrc, to avoid conffile prompts during upgrades, so 1 & 2
> > are the same thing.
> 
> My order wasn´t complete. I think it should be:
> 
> 1. Global vim configuration
> 2. /etc/vim/vimrc.local
> 3. $HOME/.vimrc
> 4. defaults.vim
> 
> so that defaults.vim can only ever set any setting that has *not* been set by 
> any of the other configuration files.

Then you would actually want defaults.vim to be first, so that anything
else set overrides it.  You can do exactly that by putting this in your
/etc/vim/vimrc.local:

    " Explicitly source defaults.vim so you can override its settings
    source $VIMRUNTIME/defaults.vim
    " Prevent it from being loaded again later if the user doesn't have
    " a vimrc
    let skip_defaults_vim = 1
    " Disable the settings you don't like
    set mouse=

> It is completely unintuitive that defaults.vim overwrites settings in 
> vimrc.local by default. If I write "set mouse=" in there, I mean it. I really 
> dislike software that pretends it knows better than me unless I tell that 
> software to stop that behavior.
> 
> Never *ever* overwrite user/admin made settings.

Yes, that was another part that Bram just punted on when he was deciding
how defaults.vim would work.

> > defaults.vim is intentionally loaded _after_ $HOME/.vimrc so that Vim
> > can choose not to load it when $HOME/.vimrc exists.  The situation
> > you're running into is that you don't have $HOME/.vimrc and therefore
> > are having the system-wide values adjusted by defaults.vim.
> 
> Alternatively vim should not load defaults.vim if vimrc.local exists I think.

/etc/vim/vimrc is the only thing Vim knows about.  It just happens to
have a snippet at the end which sources /etc/vim/vimrc.local.

If anything, I'll add a commented out version of the code I posted
above to /etc/vim/vimrc.  I thought this sort of stuff would be easily
figured out for people that wanted to customize the behavior, but
apparently I was wrong.

Cheers,
-- 
James
GPG Key: 4096R/91BF BF4D 6956 BD5D F7B7  2D23 DFE6 91AE 331B A3DB



More information about the pkg-vim-maintainers mailing list