MacOS – How to create a symlink to MacVim configuration files


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:


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/


ln -nfs ~/Programming/Personal/gvimrc /Applications/

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:

  • 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