I've been using the default configuration of vim for a while and want to make a few changes. However, if I edit ~/.vimrc it seems to overwrite all other configuration settings of /etc/vimrc and such, e.g. now there is no syntax highlighting. Here is what vim loads:

/usr/share/vim/vim80/plugin/... <there are a few>

In other words I want to keep whatever there is configured in vim, but simply make minor adjustments for my shell user.

What do I need to do to somehow weave ~/.vimrc into the existing configuration or what do I need to put into ~/.vimrc so it loads the default configuration?

My intended content of ~/.vimrc:

set expandtab
set shiftwidth=2
set softtabstop=2
  • In my experience, this is not usually the way it works...
    – Kusalananda
    Feb 10, 2018 at 23:12
  • @Kusalananda Awesome. So how does it work then?
    – sjngm
    Feb 10, 2018 at 23:22
  • how did ~/.vimrc get to be in the middle of the pack?
    – thrig
    Feb 10, 2018 at 23:48
  • @thrig I really don't know.
    – sjngm
    Feb 10, 2018 at 23:50
  • What exactly did you put in vimrc? @thrig not unusual, if you have filetype on, it will load files from $VIMRUNTIME based on file types, and that will be after vimrc
    – muru
    Feb 11, 2018 at 0:10

2 Answers 2


You can source the global Vim configuration file into your local ~/.vimrc:

unlet! skip_defaults_vim
source $VIMRUNTIME/defaults.vim

set mouse-=a

See :help defaults.vim and :help defaults.vim-explained for details.

  • 1
    Awesome!!! It's a good thing that questions don't die around here... :)
    – sjngm
    Jul 12, 2018 at 16:28

What I found out is that the default config (default.vim) is not loaded if you create a ~/.vimrc file, so what I did was to put the contents of the default config into vimrc and to add the modifications at the end.

I am assuming you have vim8 and are using default configurations (i.e. you don't have a ~/.vimrc file)

Copy default config to your user vimrc file:

cp /usr/share/vim/vim80/defaults.vim ~/.vimrc

Then open your ~/.vimrc file and add your configs at the end of it.

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.