Search code examples
vim

Can you view the default Vim settings?


I’m starting to learn about creating my own .vimrc file and I keep noticing features that are missing with my custom version that were present in the default setup.

I was wondering if it is possible to view the default settings, so I can compare them to my own and look up all the standard inclusions I don't know to learn more about them.

I searched and couldn’t find an answer online, and if the reason why there isn’t one is that the answer to this question is glaringly obvious, I’m really sorry; I’m still a bit of a noob :p


Solution

  • No worries, it’s a perfectly valid question. Unfortunately, the answer is a bit complicated. First of all, Vim has certain defaults that are documented in the built-in help system.

    Some of them are only used when Vi compatibility mode is disabled, and that’s the first customisation most people make:

    :set nocompatible
    

    On top of that, many distributions provide their own custom config, for example Debian/Ubuntu comes with /etc/vim/vimrc. To makes things even more confusing, Vim 8 comes with a sane configuration (called default.vim) that only gets applied when ~/.vimrc is not found. Not to mention that NeoVim comes with its own set of defaults.

    In practice, I suggest to explicitly set any options you care about to make sure your config is portable between systems and versions of Vim. To see the current value of a given option, use a question mark:

    :set showcmd?
    

    To learn more about a given option (including the default value), use Vim’s comprehensive help system:

    :help showcmd
    

    Finally, you might want to check my annotated .vimrc for some inspiration, and there is also the vim-sensible plugin that provides some sane defaults most people would agree to.