Atom Sync Settings for a Consistent Editing Environment

danielle-mustillo

09 June 2016


Hello World!

This is the first post in what will hopefully be a long line of posts. I have been meaning to set this up for a long time now, and given that it is a lazy Sunday and the girlfriend is sick at home, I figure today is a great day to get started. I hope this blog will be useful to people out there in the internet for figuring out how to do things in software. Everything I’ve learnt in the past years has been blood, sweat, hard work and I understand that most of us just want to get things done as fast as possible. So that will be todays goal.

Anyway on to the topic.

Preamble

Over the past year and a half I’ve used most all “hardcore” text editors out there. GNU Emacs, Vim, Spacemacs, I finally found Atom by the guys a GitHub. This has become my primary editor of choice, not because it’s fast or based on NodeJS (although those are both pluses), but because its modern and has many of the things the above editors do well pre-packed in. No mess dealing with conflicting shortcuts (often enough an issue with Spacemacs) or searching for packages to help you do basics like auto complete or syntax-highlighting, it comes out of the box. And a built in package installer which integrates with git repos as well as a command line installation of packages. Great!

One feature I particularily like is a little package called Sync Settings. As per their site, this package “Synchronize[s] settings, keymaps, user styles, init script, snippets and installed packages across Atom instances.” In other words, you can backup installed packages, themes, keyboard shortcuts, etc to GitHub and then access these from another other device with Atom installed. Since GitHub is accessible everywhere you have internet, you can easily keep a consistent development environment across all your devices. You can be back from computer crashes in minutes, sync your work and home development environments with this neat little package. Honestly, I think this is mandatory for anyone serious about developing code.

Installation & Setup

If your using a Unix based operating system (which you should), then you can do the following to install it:

Setup

In order to install and use this package, you need to do some setup. We need to setup our GitHub account for syncing our data to and from. For this package, GitHub serves as the central server where your packages are hosted from. You’ll first need a Gist (basically this is the bundle of text files that gets synced to and from GitHub) and then need a Personal Access Token (this is the “bridge” that connects your Atom instance to GitHub).

  1. First, you need to get GitHub. Create an account here.
  2. Sign in.
  3. Create a Gist here. You don’t need to worry too much about what you put as the Gist Description/Filenames/etc here since it will be overwritten anyway. Just put something random and click “Create secret gist”.
  4. Go to your search bar and copy the last string of numbers/letters after the last /. This is your Gist ID. Save it in a text document!
  5. Now go here to create a Personal Access Token. Give it a name (any name is fine) and select “gist” in the list. Scroll down and click “Generate token”. This will bring you to page that shows you your own token (it looks like a string similar to the Gist ID). Save this string in your text document!

Now that you have your Gist and the Token which links your Gist, your almost ready to go!

Installation

Phew, that took a while! Fortunately, the setup is the hardest part. The rest should be a cake walk.

  1. Download Atom if you haven’t already.
  2. Go to a terminal (Ctrl-Alt-T) and type apm install sync-settings
  3. If you on a Mac or a Unix OS (Xubuntu in my case) and you haven’t done anything weird to your paths or home, in the same terminal, type atom ~/.atom/config.cson
  4. See how Atom is now open and the file config.cson is open.
  5. You will see “sync-settings”, add sub elements to this so it looks like this:

     [...]
     sync-settings":
         gistId: "b3025...88c41c"
         personalAccessToken: "6a10cc207b....7a67e871"
     [...]
    
  6. Replace whats inside the double quotes next to gistId with the results of your first saved string and the personalAccessToken with the second saved string. The quotes should be there.
  7. Save that file

Utilization

Now that you’ve set everything up, you can begin syncing. To sync your settings to the server you do the following:

  1. In Atom, press Ctrl-Alt-P to bring up a command menu
  2. Type Sync Settings and you will see all the things you can do with Sync settings. Selecting the “Backup” option will upload your settings to GitHub. Selecting “Restore” will download the settings from GitHub. For your initial start, select “Backup” and watch as your settings are backed up!
  3. As you download packages and themes, you can continue backing up your settings and everything gets synced to GitHub. Your keyboard shortcuts,

Now to sync with another computer, all you need to do is repeat the Installation steps on that machine. As long as you keep your GistId and PersonalAccessToken somewhere, this works on any number of machines!