[lfs-dev] Configuring vim and position of defaults.vim

Bruce Dubbs bruce.dubbs at gmail.com
Mon Mar 12 10:47:17 PDT 2018

On 03/12/2018 12:19 PM, Ken Moffat wrote:
> On Mon, Mar 12, 2018 at 11:40:19AM -0500, Bruce Dubbs wrote:
>> On 03/12/2018 10:57 AM, Ken Moffat wrote:
>>> TL;DR - I think 'let skip_defaults_vim=1' should come BEFORE
>>> 'source $VIMRUNTIME/defaults.vim' in /etc/vimrc.
> [...]
>>> So, I tried changing my own /etc/vimrc to start:
>>> " Begin /etc/vimrc
>>> let skip_defaults_vim=1
>>> source $VIMRUNTIME/defaults.vim
>>> set nocompatible
>>> (etc)
>>> And that now seems to have restored the old behaviour, both when
>>> editing that command explanation, and when making my own local git
>>> commits.
>> Hmm.  What I interpret from your experience is that "defaults_vim" are
>> different from $VIMRUNTIME/defaults.vim.
> The skip variable says that defaults.vim can be skipped (if it is
> set), I am suggesting that it has to be set before sourcing
> defaults.vim, setting it after is too late.
>> What is your experience if you have both /etc/vimrc and ~/.vimrc, and
>> comment out both the source $VIMRUNTIME/defaults.vim line and the
>> skip_defaults_vim line?
> Dunno.  I might try that later.
>> What I had in mind with the current setup is that the upstream default
>> settings would be invoked and then the user could override them if desired.

> My experience is that the override does not work when the set comes
> after the defaults have already been loaded in /etc/vimrc.

Seems odd.  If $VIMRUNTIME/defaults.vim is explicitly run, then the 
defaults *should* be set, but the skip_defaults_vim should then inhibit 
the defaults from being read again.   The settings after reading 
defaults.vim should override the earlier settings.

My understanding of the initialization process is to run:


if ~/.vimrc exists
   run  ~/.vimrc
   if skip_defaults_vim is not set
     run $VIMRUNTIME/defaults.vim

   -- Bruce

More information about the lfs-dev mailing list