Sublime Text 2 User Settings and version control
I’ve recently begun dipping my toe in the world of Sublime Text 2, after a couple of years of solid Vim usage (before that, TextMate). One pattern I’ve grown quite accustomed to is keeping all of my dotfiles in a git repository. It is very easy for me to start up a fresh machine with everything I need to be productive.
With Sublime, user preferences are stored in a different manner and is not as immediately conducive to storage and retrieval in version control. But I’ve come up with a little workflow that makes it easy to store my Sublime Text 2 packages and settings alongside my Vim settings.
Sublime Text 2 user preferences are stored (on OS X) in ~/Library/Application Support/Sublime Text 2/Packages/User. I’ve moved this directory into my dotfiles repo. I have a clone of this repository running in Dropbox. I then symlink the aforementioned path to this directory in my Dropbox. Now my user settings travel with me everywhere I go. But there’s one snag to this: what about my installed Packages (in TextMate parlance: “Bundles”)?
The nifty Sublime Package Controller, somewhat analogous to Pathogen for Vim, is built to install remote Sublime Packages. One awesome thing it does is write its managed Packages to a .sublime-settings file in your User space. Save this file in Version Control. On a fresh installation of Sublime Text 2, the first thing you should install is Package Controller. Then, as soon as you link your Packages/User directory to the one in version control, Package Controller will find this setting, see that it does not have the declared packages, and fetch them in the background (you can observe it working in your Sublime console).
I’ve only begun to explore Sublime Text 2, and finding out how to share my setup between computers using the method I am already accustomed to is a huge boon.