Using Dropbox to sync Sublime Text across devices
Disclaimer
There are many good tutorials available out there. This is my own tutorial based on my own experience. If there are mistakes please do comment below and let me know.
Problem statement
Sublime Text 3 had been my favourite text editor since my cousin introduced it to me and for all those who uses Sublime for quite a while now would know the existence of Package Control for Sublime where you can install plugins, themes and such to enchance Sublime Text.
Now, the annoying part of this is when you have multiple devices that you use for coding. For every devices using Sublime Text you need to install the same plugins over and over again. Wouldn’t it be nice if you could just install at 1 device and then every other devices will get the same update? I will show you how I do it (with reference from online of course).
Important notes
To avoid disaster, you should exit Sublime Text before proceeding.
Remember, other than Sublime Text 3, you need 2 more things to make this work.
- Symbolic Link (your OS most likely have it)
- Dropbox (or something similar but I’ve only tried it with Dropbox so far)
Also, you will need to first understand where the packages are located for Sublime Text 3.
In sublime, go to Preferences -> Browse Packages… and it will lead you to where your packages are located. Since I’m using Linux, mine is at
~/.config/sublime-text-3/
and the 2 folders that we are going to sync are Installed Packages
and Packages
located there.
Also you need to decide where are you going to sync the packages in Dropbox. Mine I placed it in
Dropbox/ST3/
It’s entirely up to you to create a directory in Dropbox to sync those packages.
Let’s get started
It’s basically just a few simple steps.
- Create a directory in Dropbox for where you’re going to sync the packages.
- Move your
Installed Packages
andPackages
folders to the Dropbox directory. - Create a symbolic link from your Sublime Text packages directory to link to the new directory in Dropbox.
- ??
- Profit.
Now everytime you install or remove a package it will all happen in Dropbox, thus synced.
Now in other devices, to sync with dropbox, delete your Installed Packages
folder and Packages
folder and repeat step 3. Viola !
Below are the commands to run to make all this magic happen on my PC.
# Create a soft link that points to Dropbox at sublime text 3 folder
ln -s ~/Dropbox/ST3/Installed\ Packages ~/.config/sublime-text-3/
ln -s ~/Dropbox/ST3/Packages ~/.config/sublime-text-3/
If you’re in Windows…
# Change directory to sublime's packages directory
cd "C:\path\to\sublime text packages"
# Creates a soft link named Packages and point it to Dropbox
mklink /D "Packages" "C:\path\to\Dropbox\ST3\Packages"
# Creates a soft link named Installed Packages and point it to Dropbox
mklink /D "Installed Packages" "C:\path\to\Dropbox\ST3\Installed Packages"
If you now check your sublime text directory you will see the 2 folders Installed Packages
and Packages
there and when you access it, it will be in your Dropbox folder! It’s like a shortcut but better. A magical shortcut!
I hope this helps open your mind to the possibilities of symlinking. I did a few hacks myself with it.
References
For more similar tutorials, here’s a few links: