I want to store my configuration files in source control and symlink them so they will be used by MacVim. Looking at :scriptnames
I see vimrc and gvimrc being used in:
/Applications/MacVim.app/Contents/Resources/vim/vimrc
My source controlled vim files are located in:
~/Programming/Personal
(both gvim and vimrc are here)
How do I setup the symlink? Is
ln -nfs ~/Programming/Personal/vimrc /Applications/MacVim.app/Contents/Resources/vim
and
ln -nfs ~/Programming/Personal/gvimrc /Applications/MacVim.app/Contents/Resources/vim
the right way to do it?
Best Answer
You are misunderstanding the way (Mac)Vim processes its configuration. Simplifying slightly, there are three layers to it on OS X:
vimrc
andgvirmc
files in$VIMRUNTIME
are the runtime defaults for the Vim install. For MacVim, this is set to point inside the application bundle – the files you found. These will be overwritten each time you update MacVim.vimrc
andgvimrc
files in$VIM
are the system wide settings. This is meant to provide a system administrator with a way to set defaults. When not expressly set,$VIM
is equal to$VIMRUNTIME
.~/.vimrc
and~/.gvirmc
files are your personal configuration. These are the files you, as the individual Vim user, are meant to customise.These configuration files are sourced in the above order, from top to bottom. To use your personal configuration from another directory (e.g. for version control), just symlink their location to the canonical personal configuration files, i.e.