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

Ken Moffat zarniwhoop at ntlworld.com
Mon Mar 12 15:30:07 PDT 2018

On Mon, Mar 12, 2018 at 12:47:17PM -0500, Bruce Dubbs wrote:
> On 03/12/2018 12:19 PM, Ken Moffat wrote:
> > 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.
I don't claim to understand the details, but when I searched a few
hours ago there were various posts about changed behaviour (not
particularly recent).

> My understanding of the initialization process is to run:
> /etc/vimrc
> if ~/.vimrc exists
>   run  ~/.vimrc
> else
>   if skip_defaults_vim is not set
>     run $VIMRUNTIME/defaults.vim
>   endif
> endif
I think that with the /etc/vimrc currently in the book, defaults.vim
is always run.

I'll attach a specimen.xml file (one paragraph from the BLFS mutt
page).  Using a copy, open it in vim, go to the second line and
insert a linefeed (i.e. just press the enter key) before

With the /etc/vimrc from the book, I find that both the start of the
second line, and the new third line, are inset.  Moving the cursor
back, there is a tab at the start of each of these lines.

My reversal of the two lines in /etc/vimrc, or commenting both lines
there, fix this - I think that reversing the lines does what you
intended.  But maybe running scriptnames might provide more info
(just found a reference to that in another search result).

Using the /etc/vimrc where I commented out the lines as you
requested, and with my own ~/.vimrc, if I run :scriptnames in a vim
session I get:

  1: /etc/vimrc
  2: /usr/share/vim/vim80/syntax/syntax.vim
  3: /usr/share/vim/vim80/syntax/synload.vim
  4: /usr/share/vim/vim80/syntax/syncolor.vim
  5: /usr/share/vim/vim80/filetype.vim
  6: /usr/share/vim/vim80/colors/elflord.vim
  7: ~/.vimrc
  8: /usr/share/vim/vim80/syntax/nosyntax.vim
  9: /usr/share/vim/vim80/plugin/getscriptPlugin.vim
 10: /usr/share/vim/vim80/plugin/gzip.vim
 11: /usr/share/vim/vim80/plugin/logiPat.vim
 12: /usr/share/vim/vim80/plugin/manpager.vim
 13: /usr/share/vim/vim80/plugin/matchparen.vim
 14: /usr/share/vim/vim80/plugin/netrwPlugin.vim
 15: /usr/share/vim/vim80/plugin/rrhelper.vim
 16: /usr/share/vim/vim80/plugin/spellfile.vim
 17: /usr/share/vim/vim80/plugin/tarPlugin.vim
 18: /usr/share/vim/vim80/plugin/tohtml.vim
 19: /usr/share/vim/vim80/plugin/vimballPlugin.vim
 20: /usr/share/vim/vim80/plugin/zipPlugin.vim
 21: /usr/share/vim/vim80/scripts.vim
 22: /usr/share/vim/vim80/syntax/vim.vim

The elflord.vim line is because at the end of my /etc/vimrc I have
:colorscheme elflord

My point is that /etc/vimrc appears to be read before ~/.vimrc, not
just when ~/.vimrc is absent.

Truth, in front of her huge walk-in wardrobe, selected black leather
boots with stiletto heels for such a barefaced truth.
                                     - Unseen Academicals
-------------- next part --------------
A non-text attachment was scrubbed...
Name: specimen.xml
Type: application/xml
Size: 321 bytes
Desc: not available
URL: <http://lists.linuxfromscratch.org/pipermail/lfs-dev/attachments/20180312/6aec69b0/attachment.xml>

More information about the lfs-dev mailing list