Recently, a much smarter colleague of mine introduced me to the wonderful world of Vim. This text editor is quite amazing and I have been quite pleased with it to date.
Like with any new tool, the more you use it, the more you start to peer into the nooks and crannies, looking for better ways to use the tool. I quickly came across the ‘vimrc’ file, or Vims configuration file and started to customize the editor to my preferences. I then discovered how to enhance Vims abilities with plugins. This of course just made Vim more spectacular but introduced a new hassle, synchronizing my settings and plugins across my two primary development machines.
As always, I wanted the synchronization to be automatic. Here is what I set out to accomplish:
- when I update my vimrc file on either machine, then the other machine will automatically pull the changes.
- when I add/update/remove plugins on either machine, then the other machine will automatically pull the changes.
I’m glad to say I was able to realize my vision using nothing but SkyDrive and some built in Vim features.
On the machine with the Vim configuration you want to synchronize:
- Create a ‘vim’ folder in your SkyDrive directory
- Copy your _vimrc file to the new SkyDrive ‘vim’ directory
- Copy the ‘vimfiles’ directory to the new SkyDrive ‘vim’ directory
- If you so please, you can delete the ‘vimfiles’ directory from the vim installation directory. I did this so I wouldn’t accidentally add new plugins to this directory and wonder why the sync was not working.
- I also added a shortcut named ‘vimfiles@skydrive’ in the vim installation directory that redirects to the ‘vim’ directory in SkyDrive as a convenience.
- Edit your _vimrc file located in the vim installation directory and replace the contents with the following:
- Restart vim or source the modified _vimrc file
set nocompatible " Tells vim where to locate its 'vimfiles' directory set runtimepath=path/to/skydrive/vim/vimfiles,$VIM,$VIMRUNTIME " Load / overwrite the vimrc settings with the following file source path/to/skydrive/vim/_vimrc
On a machine you want to use the now shared configuration:
- Repeat the last two (2) steps
And your done!
Here is a list of resources I found helpful when I was working on this problem: