Well, I’m sure it’s something well known, but I just discovered it, so here I am.
Ok, let’s assume you work on projects that would require you to have this in your
set autoindent set cindent set shiftwidth=4 set expandtab
But also on other projects that would require this:
set autoindent set cindent set shiftwidth=8 set noexpandtab
How to deal with that? Local configuration ViM script to the rescue. Basically, it is enough to:
- copy the content of (or source) this file in your actual
- create a file called
.lvimrcin the root directories of your projects.
Of course, you can have one different
.lvimrc for each project, and thus put the first group of lines above in the
.lvimrc residing in the source tree of the projects that like spaces, and the second group of lines in the
.lvimrc residing in the source tree of the projects that like tabs.
Oh, of course, I’m also assuming that you use ViM, and that you do that for writing code (in C!), and you use auto-indentation... I might better have said this before, but come on, who doesn’t do that these days!