Bug#837761: vim: doesn't honor local admin settings in /etc/vim/vimrc.local

James McCoy jamessan at debian.org
Wed Oct 5 11:34:58 UTC 2016


On Wed, Oct 05, 2016 at 12:02:32PM +0200, Francois Gouget wrote:
> The fix in 8.0.0022 does not sound like much of a fix: it is still
> impossible to override specific defaults.vim settings.
> 
> I'll also note that, at least in 8.0.0003, defaults.vim says:
> 
> | " This is loaded if no vimrc file was found.
> | " Except when Vim is run with "-u NONE" or "-C".
> | " Individual settings can be reverted with ":set option&".
> 
> Which is patently false:
> * /etc/vim/vimrc exists and yet /usr/share/vim/vim80/defaults.vim is
>   loaded too.

Correct, because defaults.vim is loaded if no *user* vimrc exists.
Quoting ":help defaults.vim":

							*defaults.vim*
    If Vim is started normally and no user vimrc file is found, the
    $VIMRUTIME/defaults.vim script is loaded.

> * The settings cannot be reverted with ":set option&" since the Debian
>   package makes it impossible to run commands after defaults.vim.

It has nothing to do with the packaging.  defaults.vim is working as
intended, which is to be a fallback when no user vimrc exists.  Again,
from the help:

    ...
    This should work well for new Vim users.  If you create your own .vimrc, it is
    recommended to add this line somewhere near the top: >
	    unlet! skip_defaults_vim
	    source $VIMRUNTIME/defaults.vim

> As harald said this is at the root an "order of inclusion" issue. So a
> better solution would be to load all these extra configuration files 
> near the end of /etc/vim/vimrc but before /etc/vim/vimrc.local is 
> invoked.

So do that.  Nothing is stopping you from sourcing defaults.vim in
/etc/vim/vimrc(.local) and then overriding specific settings.

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



More information about the pkg-vim-maintainers mailing list