Per project .vimrc
My natural C indentation style is basically kernel-like and my
Modelines are evil.
To solve that terrible issue,
~/.vimrc
reflects that. Unfortunately I have to hack on GNUish-style projects and I really don't want to edit my ~/.vimrc
every single time I switch between different indentation styles.Modelines are evil.
To solve that terrible issue,
vim
can use per directory configuration files. To enable that neat feature only two little lines are needed in your ~/.vimrc
:set exrc " enable per-directory .vimrc filesThen it's just a matter of writing a per project
set secure " disable unsafe commands in local .vimrc files
.vimrc
like this one:set tabstop=8You can find help with the wonderful
set softtabstop=2
set shiftwidth=2
set expandtab
set cinoptions=>4,n-2,{2,^-2,:0,=2,g0,h2,t0,+2,(0,u0,w1,m1
cinoptions
variable in the Vim documentation. As sane persons open files from the project's root directory, this works like a charm. As for the Makefiles, they are special anyway, you really should add an autocmd in your ~/.vimrc
." add list lcs=tab:>-,trail:x for tab/trailing space visuals
autocmd BufEnter ?akefile* set noet ts=8 sw=8 nocindent