1

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?

2

You are misunderstanding the way (Mac)Vim processes its configuration. Simplifying slightly, there are three layers to it on OS X:

  • the vimrc and gvirmc 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.
  • the vimrc and gvimrc 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.
  • finally, the ~/.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.

ln -s /your/configuration/dir/vimrc ~/.vimrc
ln -s /your/configuration/dir/gvimrc ~/.gvimrc
  • 1
    This is how I do it and works perfectly. Plus my vim configuration is also shared by the command line vim as well MacVim. – Scott Walter Mar 1 '15 at 12:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .