Last Updated: February 25, 2016
·
2.964K
· godfoca

Per project .vimrc files

Adding this to your .vimrc:

" Per-directory .vimrc files
set exrc
set secure

Now vim will also load a ./.vimrc after $MYVIMRC (~/.vimrc, generally) has loaded. We use this for a few things:

  • Setting project wide agreed configurations, like indentation.
  • Adding Rails.vim macros that are specific to this project.
  • Adding snippets and expansions that are specific to this project.

For example, this is the ./.vimrc file of one project I'm working on: https://gist.github.com/3316523

1 Response
Add your response

Be aware that secure doesn't really offer a great deal of protection in the things that someone could do by slipping in a malicious .vimrc into a directory you might pull from the wide world. There is a plugin that prompts you to confirm local rc files the first time and caches a hash of the file so it will prompt again if it is changed by someone else. There's some discussion/alternatives on Stack Overflow also.

over 1 year ago ·