On 03/12/2018 05:30 PM, Ken Moffat wrote:
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.
That is correct because we run it explicitly.
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
'mailboxes'.
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.
I agree that it irritating. If you set 'expandtab' then they are spaces
and not true tab characters, but is is still irritating.
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
added
:colorscheme elflord
My point is that /etc/vimrc appears to be read before ~/.vimrc, not
just when ~/.vimrc is absent.
Right. At least my understanding is that /etc/vimrc is always read if
it is present.
Looking at the options for vim:
-u <vimrc> Use <vimrc> instead of any .vimrc
help says: "vim -u NORC" can be used to skip these initializations
without reading a file.
I'll note that the vim reference manual sections 4 and 5 (Initialization
and $VIM and $VIMRUNTIME) are quite long and complex.
-- Bruce
--
http://lists.linuxfromscratch.org/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page