Created
September 30, 2009 18:42
-
-
Save bps/198337 to your computer and use it in GitHub Desktop.
A vim function that will load a per-git-project 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
vim () | |
{ | |
local vimrc="vimrc" # Name you want to use for your vimrc in .git/ | |
local v="$(which vim)" # Or whatever vim you want | |
local g="$(__gitdir)" # This comes from the git bash completion script | |
if [ -z "${g-}" ]; then | |
"${v}" "$@" | |
else | |
local vrc="${g}/${vimrc}" | |
if [ -r "${vrc}" ]; then | |
"${v}" -S "${vrc}" "$@" | |
else | |
"${v}" "$@" | |
fi | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment