Syncing Sublime Text 3 Settings Across Multiple Devices
Sublime Text remains for me the very height of text editor awesomeness. And for good reason! It’s blazing fast, has the best plugin ecosystem around and works anywhere you would want to use it. Visual Studio Code and Atom are making headway but for my money (or the $70 donation to the author I’ve been meaning to make for the last three years…) Sublime Text still rules.
If you use Sublime on more than one device like I do you’re probably tired of setting up the same environment over and over again. You could just carry around a zip file with your Sublime preferences in it, or use symlinks and OneDrive or Dropbox to keep everything consistent if you’re Windows-only. I think it’s more fun and a bit more controlled to use git to do it.
Setup
If you’ve never used git before, I recommend a bit of light reading before continuing. I’d also recommend you set up an account at GitLab if you’d like to keep your repositories private for free or GitHub if you don’t care.
I recommend using Cygwin for git functionality. You basically get the same thing with Git for Windows, but Cygwin allows you to add extra packages to it like whois
and openssh
which I find are essential tools for the IT Wizard. Get Cygwin installed, find yourself the git package and select it for installation and you’re good to go.
At this point I’ll assume that you’ve got Package Control installed and Sublime Text configured how you like it. First, locate your user preferences folder.
|
|
I like to make a symlink to the preferences folder so I can find it later without typing a novelsworth of path into the console.
|
|
This directory contains the Preferences.sublime-settings
and Package Control.sublime-settings
files that you’ll need as a minimum for setting up a good sync. It’ll also contains package-specific settings, so we’ll be pretty generous in our .gitignore
file.
Set up your .gitignore
like so:
|
|
Initialize the repository, add the files and commit:
|
|
At this point you should create the repository over on GitHub or GitLab and push it.
|
|
Since we set the upstream repository using -u
in the command above we can issue a simple git push
after we commit new changes in the future.
Initializing new devices
To get this working on your other devices first get Package Control installed and restart Sublime. Find your user preferences folder as above and then do the following. Be warned: this will overwrite whatever settings you might have already.
|
|
You may see some theme artifacting or weird stuff happen as Package Control installs any missing packages. If things get strange you can try to restart Sublime and see what happens.
Making changes
Now when you’ve added a new package or changed some settings you can commit those changes to your repository:
|
|
Keeping things up to date
After you’ve made some changes you can update the repository like so:
|
|
Final thoughts
I recommend the awesome Skins package to keep your theme and color scheme settings consistent. It’s compatible with a good variety of different Sublime themes like Boxy, Ayu and Agila. If you find a particular combination of color scheme and theme you like you can also save it as a custom skin and reuse it later.
That’s it! It can be fun to watch your tastes and plugins evolve over time as you work on different projects or at different jobs. And now that your settings are safely hosted on Git(Hub|Lab) you’ll always have access to them when and where you need them.
Here’s a copy of my Sublime settings. It’s not my everyday use repository because that one contains sensitive info and I’m too lazy to go through and ammend the commits to remove it.