Anti-patterns of vimrc

Most of us collect fragments in our vimrc files without ever considering best practices. Anti-pattern of vimrc by rbtnn lists some common mistakes with the fixed alternatives.

The author suggests that it's better to use strict options instead of mixing in abbreviations. Also, you should always use the right scope instead of leaking global variables.

Another interesting point is using groups to define auto-commands to avoid reevaluating them:

" define a group `vimrc` and initialize.
augroup vimrc
augroup END

" register autocmds to group `vimrc`.
autocmd vimrc FileType cpp setlocal expandtab
autocmd vimrc FileType make setlocal noexpandtab
blog comments powered by Disqus