0

On my system vim has a "defaults.vim" file that is getting sourced. For example, if I do vim --version, I see the following:

   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"

The problem is that the defaults file has a bunch of annoying settings in it. How can I disable it? I had read elsewhere that as long as I had a ~/.vimrc file that the defaults file would not be loaded, but this is not true. I have a blank ~/.vimrc and defaults is still getting loaded. How can I prevent this?

  • Why do you have a blank .vimrc, and not one with your preferred settings? – Herb Wolfe Jan 8 '18 at 22:59
  • @HerbWolfe Because I am just using this server for 15 minutes. I do not want invest an afternoon in it. I just want the default settings OFF NOW. – Tyler Durden Jan 8 '18 at 23:08
  • Are you certain the defaults aren't off? :version reports those files regardless of anything, it does not necessarily mean they're being loaded. – Mass Jan 9 '18 at 1:27
3

From :h defaults.vim:

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

Perhaps an empty vimrc is the same as no vimrc...? Anyways, try this...

Near the start of $VIMRUNTIME/defaults.vim you'll see:

if exists('skip_defaults_vim')
  finish
endif

So put something like this near the start of your system vimrc and that should suppress it:

let skip_defaults_vim=1

Use of this variable in the system vimrc is documented: :h skip_defaults_vim

  • 1
    On my machines, I use let g:skip_defaults_vim = 1 in /etc/vim/vimrc.local and can confirm that it does work. – Dave Sherohman Jan 9 '18 at 9:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.