Vim on Debian, configuration issues

2018-05-01 12:47:44

I have been working with a stock vim configuration for a long time. I want to modify just a couple of settings. I don't want to lose the rest of the default configuration.

If I create a new .vimrc I lose all the default settings.

If I cp /usr/share/vim/vimrc ~/.vimrc I lose all the default settings.

If I cp /etc/vim/vimrc ~/.vimrc I lose all the default settings.

How can I retain the default system wide settings, while overriding the few particular settings that I want?

/usr/share/vim/vimrc is always sourced regardless of your vimrc (assuming $VIM doesn't point somewhere else - :h system-vimrc). The settings you're probably missing are in defaults.vim, a file that only gets sourced if you don't have a personal vimrc. To get them back add these two lines to your vimrc:

unlet! skip_defaults_vim

source $VIMRUNTIME/defaults.vim

Check the rest of the help on the subject on :h defaults.vim

My information might be wrong however. I'm assuming here you're running vim 8

  • /usr/share/vim/vimrc is always sourced regardless of your vimrc (assuming $VIM doesn't point somewhere else - :h system-vimrc). The settings you're probably missing are in defaults.vim, a file that only gets sourced if you don't have a personal vimrc. To get them back add these two lines to your vimrc:

    unlet! skip_defaults_vim

    source $VIMRUNTIME/defaults.vim

    Check the rest of the help on the subject on :h defaults.vim

    My information might be wrong however. I'm assuming here you're running vim 8, first included in debian 9. Unfortunately the only current debian system I can check is still running debian 8 stable, where vim doesn't have defaults.vim.

    2018-05-01 13:58:42