Anti-patterns of vimrc

Alex R. Young
usevim
Published in
1 min readFeb 2, 2015

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
autocmd!
augroup END
" register autocmds to group `vimrc`.
autocmd vimrc FileType cpp setlocal expandtab
autocmd vimrc FileType make setlocal noexpandtab

--

--