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:
:scriptnames /etc/vimrc /usr/share/vim/vimfiles/archlinux.vim ~/.vimrc /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?
EDIT:
My intended content of ~/.vimrc:
set expandtab set shiftwidth=2 set softtabstop=2
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
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.
Method 2
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.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0