October 23, 2017

Change vim 8.0 .vimrc behaviour back to sanity

When a user doesn’t have a /.vimrc file in vim 8.0 (and possibly later) vim loads the default configuration file after the systemwide vimrc file created by the system administrator. This overides any settings the system administrator made. This is of course totally unexpected and frustrating especially when you upgrade from earlier versions. Some may even call it insane and it is definitely not expected behaviour. Anyway below is a way to prevent that from happening.

Add the following line to the systemwide vimrc file. In FreeBSD this is /usr/local/etc/vim\vimrc

let g:skip_defaults_vim = 1

If you still want to load the defaults but make your systemwide settings still effective add the following at the start of your systemwide vimrc.

source /usr/local/share/vim/vim80/defaults.vim let g:skip_defaults_vim = 1

Add your settings after these lines. The system administrator settings will now be active even if the user does not have a ~/.vimrc file.

© Arnold Greyling 2023