7

I have a few different machines I use throughout the day, and I use git to pull down the most recent code on my projects.

However, my Sublime Text installs are different on each machine, and I can't keep my packages straight. My Sublime Text 3 preferences/packages are stored in ~/Library/Application Support/Sublime Text 3.

Is there a way to store my preferences in Github so I can pull them down on other machines? I'm nervous about doing this and am wondering if anybody else has done this before.

Johnathan Elmore
  • 2,156
  • 1
  • 19
  • 25
  • 2
    See [wbond's documentation here](https://packagecontrol.io/docs/syncing). Many people use such techniques. – ig0774 Aug 02 '16 at 02:46

1 Answers1

6

Store Package Control/User

You only need to add the ~/Library/Application Support/Sublime Text 3/Package Control/User/ (or on Windows: C:\Users\{username}\AppData\Roaming\Sublime Text 3\Packages\User) directory.

From https://packagecontrol.io/docs/syncing

The proper solution is to install Package Control on all machines and then to sync only the Packages/User/ folder. This folder contains the Package Control.sublime-settings file, which includes a list of all installed packages. If this file is copied to another machine, the next time Sublime Text is started, Package Control will install the correct version of any missing packages.

Steps to set it up

Create a new repo on github, name it something like "sublime-prefs", then run these commands:

cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/User
git init
git add Package\ Control.sublime-settings
git commit -am "settings from from <device name>"
git remote add origin https://github.com/<github name>/<repo name>.git
git push -u origin master

Pulling down to other machines...

Quit Sublime Text 3, then run these commands (using answer from How do I clone into a non-empty directory?):

cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/User/
git init
git remote add origin https://github.com/<github name>/<repo name>.git
rm Package\ Control.sublime-settings
git fetch
git checkout -t origin/master
Community
  • 1
  • 1
Johnathan Elmore
  • 2,156
  • 1
  • 19
  • 25
  • This seems incomplete. Maybe you want to make this a community wiki? – Frank Tan Aug 02 '16 at 20:48
  • Yes, it was incomplete without the "Pulling down to other machines..." Using `git checkout -t origin/master` you can add an upstream without needing to use `git clone` – Johnathan Elmore Aug 02 '16 at 22:35