empty .vimrc causing some scripts to not load?

178 views Asked by At

Without having ~/.vimrc, I get the following list when I run:scriptnames in vim

  1: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/defaults.vim
  2: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/syntax/syntax.vim
  3: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/syntax/synload.vim
  4: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/syntax/syncolor.vim
  5: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/filetype.vim
  6: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/ftplugin.vim
  7: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/indent.vim
  8: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/getscriptPlugin.vim
  9: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/gzip.vim
 10: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/logiPat.vim
 11: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/manpager.vim
 12: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/matchparen.vim
 13: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/netrwPlugin.vim
 14: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/rrhelper.vim
 15: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/spellfile.vim
 16: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/tarPlugin.vim
 17: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/tohtml.vim
 18: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/vimballPlugin.vim
 19: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/zipPlugin.vim

However, if I simply do touch ~/.vimrc my :scriptnames becomes this

  1: ~/.vimrc
  2: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/getscriptPlugin.vim
  3: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/gzip.vim
  4: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/logiPat.vim
  5: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/manpager.vim
  6: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/matchparen.vim
  7: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/netrwPlugin.vim
  8: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/rrhelper.vim
  9: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/spellfile.vim
 10: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/tarPlugin.vim
 11: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/tohtml.vim
 12: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/vimballPlugin.vim
 13: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/plugin/zipPlugin.vim

What's causing vim to skip the default plugins? I really like the defaults, Any way I can keep change settings in vimrc file without overriding defaults?

1

There are 1 answers

1
Martin Tournoij On BEST ANSWER

Without a vimrc Vim will load /usr/share/vim/vim80/defaults.vim. You can see that the first line:

1: /usr/local/Cellar/vim/8.0.0134/share/vim/vim80/defaults.vim

Is missing from your second :scriptnames output.

From :help defaults.vim:

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

[...]

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

Note that this applies only to Vim 8. Vim 7.4 and earlier didn't ship with the defaults.vim file.