Created
January 24, 2013 03:10
-
-
Save leif81/4617337 to your computer and use it in GitHub Desktop.
Keep a project specific .vimrc at the root of your git project repo (e.g. ~/workspace/myproject/.vimrc) and have it sourced when you launch vim from anywhere in your project dir tree. This only works with git repos because we rely on git for determining our project root dir. Put the content of this in your ~/.vimrc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Source a vimrc from git project root | |
let project_root = system("git rev-parse --show-toplevel") | |
" System commands seem to have a trailing newline, so lets get rid of that | |
let chomped_project_root = project_root[:-2] | |
let project_vimrc = chomped_project_root."/.vimrc" | |
if filereadable(project_vimrc) | |
execute "source" project_vimrc | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment