Project Specific Vim Configuration
Sep 23 2016
Sometimes I come across a setting that I need, but only in a specific context. Perhaps the context is the language, or a particular type of buffer.
It is super easy to handle these types of configurations. Vim has autocommands for this. But what about when we need settings specific to our project?
There are plugins out there the solve this for us, like EditorConfig, but it turns out there is a mechanism built-in to Vim that can handle this for us.
:set exrc
With this settings enabled, Vim will look for a .vimrc
(.nvimrc
for Neovimmers) or .exrc
in the current directory.This file can contain anything that you might see in $MYVIMRC
. This file is loaded just after $MYVIMRC
during Vim initialization, so it can also be used to override settings inside of you vimrc
.
Perhaps you have one project that uses tabs instead of spaces, or maybe there is another project where you would like to have a particular mapping to run your tests. Both scenarios can be satisfied with exrc
.
This setting is disabled by default. There is a risk involved in enabling it. See this post for more information.
Resources
:h exrc
Recent Articles
- Apprenticeship Retro Oct 14 2016
- What the hell is CORS Oct 13 2016
- Cross-site Tracing Oct 11 2016
- Learning Testing Tools First Oct 7 2016