Sync your sublime text 3 configurations safely and easy

Arsham Shirvani
2 min readJan 7, 2017

--

I used to sync my sublime text’s configurations with help of dropbox, but I often had problems with conflicted copies of files. Although there are ways to remedy this problem, i.e. removing them by running:

$ find . -name "*conflicted copy*" exec rm {}\;

But it is not convinient. There is a better way which is more efficient, and you won’t share sensitive information between your work computer and home, e.g. application tokens etc. Also you don’t need to worry about conflicted copies anymore. Here is how I sync my configurations, head over to my configuration here https://github.com/arsham/sublime-text-3 for inspiration. I’m using GNU/Linux, but principals are the same in other OSs.

Create a repository and clone it (change the repo to what you create):

$ git clone git@github.com:arsham/sublime-text-3.git  ~/.config/sublime-text-3/Packages/User

Basically, the sublime-text-3 becomes User folder, which will include files like Package Control.sublime-settings and Preferences.sublime-settings etc.

You need to have a .gitignore file with the following contents:

* 
!Package Control.sublime-settings
!Default (Linux).sublime-keymap
!Default (Linux).sublime-mousemap
!Preferences.sublime-settings

This says exclude everything but the files I need to sync after the ! sign. This way you don’t accidentally include sensitive information. Everytime you install a plugin, add its user settings to the .gitignore file and push to the repo. Now start your ST3 and start installing stuff.

If you already have an installation, just clone it to the same place, create the .gitignore , commit things and push it to github.

On your other computer, you can clone the repo the same way, and launch ST3. If it is the first time it’s starting with this configuration, first you need to install the Package Control from command pallet by hitting ctrl+shift+p and search for package control installation entry. Wait for a couple of minutes until it install everything for you. Then restart ST3 and you are done.

If you are interested to see what ST3 is doing, launch the console panel with ctrl+` .

CAUTION The very first time you run this on a fresh ST3 installation, DO NOT CLOSE all files and close ST3, it won’t start!

If this happens, remove ~/.config/sublime-text-3/Local/session.sublime_session and start ST3, it should start just fine. If you want to avoid this happening, just leave one file open and restart ST3. From now on it doesn’t matter if close all files and restart ST3, this incident happens the first time.

Now that you have your environment set-up, everytime you install or uninstall a package, commit the changes and push them to the repo, on the other computer, pull and you are all set. There is no need to restart ST3.

Package updates do not need a repository interaction, they happen automatically across computers, so you rarely do these steps.

Enjoy!

--

--