Syncing Sublime Text 3 with Git

I use Sublime Text 3 at home and at work. I use it on many computers and platforms. In this kind of setup, maintaining a consistent configuration across multiple installations can be a challenge. It just doesn’t feel right, when you switch to work on a different laptop and suddenly some package is missing here or some setting is different there. You want to simply have the same settings everywhere, without spending too much time on configuration.

To solve this problem, I thought of storing the entire Packages folder of Sublime in a git repository and adding third-party packages as git submodules. You can find my repository here. Next time I sit behind a fresh Sublime Text 3 installation, all I have to do to in order to configure it exactly as I want it is:

  • locate and delete the Packages folder
  • do a git clone (recursive, so that it fetches the submodules as well) of my repo and use it in place of that Packages folder

The packages folder can live in various locations, depending on the platform and whether you’re using a standard or a portable version of Sublime. A little googling around will help you. On Windows, it’s somewhere inside the %APPDATA% folder (%APPDATA%RoamingSublime Text 3Packages).

At this moment, cloning my repo provides me the following:

  • my user settings (e.g. trim whitespace on save, ensure new line at end of file, etc)
  • some code snippets for Javascript
  • several third-party packages:
    • SublimeLinter and a few linters to go along with it (jscs, jshint, scss-lint)
    • sass support
    • some color themes

And if I add more or change anything, I can commit it to my repository and then I can update any installation I have with a simple git pull.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s