Atom 1.6.0 opened to the source of this very post on *The Hornery*.

Atom 1.6.0 opened to the source of this very post on The Hornery.

Atom is a free and open-source1 text editor built on web technologies and developed by GitHub.2 Its development was started by GitHub founder, Chris Wanstrath (@defunkt), in mid 2008, as a side-project. He envisioned a text editor that was extensively hackable, similarly to the existing text editors GNU Emacs and Vim, yet beginner-friendly enough for a primary school3 student to pick it up without a problem.4 Sort of like the love-child of GNU Emacs and Notepad. Its development was put on hold by Wanstrath in favour of focusing on his main project, GitHub, which had only been founded mere months earlier. Later Atom’s development was picked back up, with its first public release being in 2014. Later in June 2015 its first stable release (Atom 1.0) was made.5

Atom is built using Electron,6 a framework formerly known as Atom Shell, that is used to build cross-platform stand-alone applications based on web technologies. Electron’s source code is partly borrowed from Chromium, the open-source web browser, who’s source code is used as a basis for the closed-source Google Chrome web browser. Atom is essentially like a web browser that has been modified to be used as a text editor. You can plainly see the similarities by pressing the keyboard shortcut Ctrl+Shift+I, which will open the developer tools in both Atom and Google Chrome. Atom also uses the Node.js JavaScript runtime engine, this fact is especially important when one tries to build Atom from source code.

Despite being user-friendly, Atom does share quite a few similarities to GNU Emacs, namely that it is extended using packages and themes that are written in at least one of the same computer languages it itself is written in. For GNU Emacs this computer language is Emacs Lisp (or ELisp), while with Atom these languages are web languages including CoffeeScript, CSS, JavaScript and Less. Atom and GNU Emacs also share the common characteristic of being free and open-source, cross-platform and being rather heavy, in terms of their download/installed size, and having a fairly long start-up time, compared with other text editors like gedit or Vim.

Overview

A labelled screenshot of Atom, showing the basic components to it.

A labelled screenshot of Atom, showing the basic components to it.

This section is just a brief overview of Atom, its in-built capabilities, keyboard shortcuts and alike. Much of this information can be found by experimenting with the options in the toolbar. This section is split up by where each of these options can be found in the toolbar. It truly is brief, however, I do not mention all things you can do with these toolbar menus or keyboard shortcuts, rather just some of those that are more useful for programmers and blog writers.

The toolbar has the following top-level menus:

  • File — which contains the basic, usually file-related, functions.
  • Edit — which contains functions related to editing files (e.g., copy is in there) and one’s preferences.
  • View — mostly relates to one’s view of the edit (obviously). You can use it to open up panes, toggle full screen, toggle soft wrap, open up the command pallette, etc.
  • Selection — obviously relates to selections. This menu is not of particular interest to me.
  • Find — tools for finding and replacing characters in a buffer or project.
  • Packages — tools that are from installed packages, including some bundled packages.
  • Help — mostly relates to opening up Atom’s documentation, license, terms of use, issues, etc.

File

To save a file press Ctrl+S, while to save a file under a different file name (that is, “Save As…”) press Ctrl+Shift+S.

Edit

To undo and redo actions press Ctrl+Z and Ctrl+Shift+Z, respectively. To open the Settings buffer go to Edit→Preferences in the toolbar. Ctrl+C copies selected text to one’s clipboard while to copy files in the tree view press Ctrl+Shift+C.

View

To Toggle Full Screen press F11. To reload your current Atom window press Ctrl+Alt+R, this will cause all changes that should happen when you close and reopen Atom. To Toggle Tree View press Ctrl+/ (that is, the file tree shown in the diagram above). To toggle the command palette press Ctrl+Shift+P. To split your current pane upwards press Ctrl+k+. To split your current pane downwards press Ctrl+k+. To split your current pane left-wards press Ctrl+k+. To split your current pane right-wards press Ctrl+k+.

Find

To toggle the find and replace buffer press Ctrl+F. To hide this buffer, to my knowledge there is no keyboard shortcut rather you have to go to Find→Toggle Find in Buffer.

Atom Plugins

As previously mentioned Atom’s capabilities and appearance are usually modified or extended by use of packages and themes, respectively. Henceforth, to save some space, I will refer to packages and themes, collectively, as plugins. Some of Atom’s plugins even come bundled, or pre-installed, with Atom, while the rest are installed using Atom’s own package manager, apm, which is sort of like a modified version of Node’s npm package manager. At the time of updating this post (11 April 2016 18:37:00 UTC+10) there were 3,988 packages and 1,193 themes for Atom available from https://atom.io/packages and https://atom.io/themes, respectively. These plugins are those that have already been built by the community, or by the Atom developers themselves, but everyone is completely free to develop their own plugins for Atom. Unfortunately, some of these plugins available from the aforementioned websites will be for older versions of Atom and may not be compatible with the latest releases.

This is how one checks out the available versions of a package at https://atom.io/packages. Click the “Versions” tab in the red rectangle.

This is how one checks out the available versions of a package at https://atom.io/packages. Click the “Versions” tab in the red rectangle.

Checking Plugin Compatibility

What I do to check whether a package or theme is likely to work with the current version of Atom is I check out when the latest release of the package or theme was published. If it was within the last month it is a fair bet it will be compatible with the current version of Atom, if not, but it was updated within the past six months, then there’s a chance it might work with the latest release of Atom, but I would not hold out too much hope that it will work exactly as it should. If it was last updated prior to the release of Atom 1.0 (25 June 2015) I would not even bother trying it unless I have a burning desire to use its functionalities. Unfortunately, Atom’s packages and themes repositories’ search engine (that is, how you search for the package/theme you want in a web browser of your choosing) is very basic (and yes I have complained about this at the Atom Forums, with no clear intention on the behalf of developers to rectify this), so I cannot exclude plugins that have not been updated within the past six months. Rather I have to look for plugins and then when I find one I think I will like, I have to go to its description page and press on the “Versions” tab to see when the latest release of this plugin was. It is very disappointing to find that a package I would really like has not been updated since the release of Atom 1.0 in June 2015.

Plugins I Know and Love

LEGEND:
  • A green tick () is used to denote plugins that are bundled, by default, with the latest release of Atom.
  • A red cross () is used to denote plugins that need to be installed by running apm install <PACKAGE>, where <PACKAGE> is the package's name

My favourite packages are (in alphabetical order; I also mention how much time it adds to the start time of Atom):

  • atomic-chrome — which allows one to select a text box in the Google Chrome web browser and, with the appropriate Google Chrome extension, press an icon in the browser that will create an Atom buffer that will automatically copy any text typed into it into the text box. atomic-chrome-0.3.0 adds 25ms to the start up time of Atom.
  • file-icons — which assigns files icons based on their file extension / name in the file tree. file-icons-1.7.1 added 19ms to the start time of Atom 1.6.2.
  • git-plus — which allows you to run git commands in Atom without a terminal. This is analogous to the in-built ability of GNU Emacs to perform git commands without a terminal. git-plus-5.13.4 added 5ms to the start time of Atom 1.6.2.
  • git-time-machine — which allows you to look at past revisions of a git-controlled file. git-time-machine-1.4.1 added 2ms to the start time of Atom 1.6.2.
  • markdown-preview — allows you to preview markdown files in Atom. markdown-preview-0.157.2 added 5ms to the start time of Atom 1.6.2.
  • markdown-writer — which allows you to more efficiently write markdown files, including in a static site’s source folder. markdown-writer-2.3.2 added 5ms to the start time of Atom 1.6.2.
  • package-sync — which makes it easier for one to synchronize one’s installed Atom plugins across multiple devices and operating systems. package-sync-1.0.0 added 1ms to the start time of Atom 1.6.2.
  • pigments — which allows you to preview colours described by hexadecimals, RGB combinations and alike in Less or CSS style sheets. pigments-0.26.0 added 127ms to the start time of Atom 1.6.2.
  • project-manager — which makes it easier to access and switch between project folders. project-manager-2.9.7 added 10ms to the start time of Atom 1.6.2.
  • script — which allows one to execute scripts, including those written in Python. script-3.6.3 added 2ms to the start time of Atom 1.6.2.
  • terminal-plus — which inserts an embedded terminal into Atom. I use this plugin on a daily basis. terminal-plus-0.14.5 added 25ms to the start time of Atom 1.6.2.

Those I have limited experience with, but on paper seem interesting and potentially useful to me at least, depending on the specifics of the programming you do, include:

  • build — which allows one to compile source code in the editor. build-0.59.0 added 59ms to the start time of Atom 1.6.2.
  • nuclide — a plugin created by Facebook to turn Atom into an IDE for Hack/PHP. nuclide-0.129.0 added 7,950ms to the start-up time of Atom 1.6.2.
  • platformio-ide — a plugin created by PlatformIO that also turns Atom into an IDE, specifically for C/C++. platformio-ide-1.1.1 added 126ms to the start-up time of Atom 1.6.2.
  • platformio-ide-terminal — a plugin created by PlatformIO that adds an embedded terminal to Atom. platformio-terminal-2.0.3 added 17ms to the start-up time of Atom 1.6.2.

Customization

Atom can be further customized by editing files in one’s ~/.atom directory. This is the example top-level structure of this directory:

~/.atom
├── blob-store
├── compile-cache
├── config.cson
├── electron
├── keymap.cson
├── LICENSE.md
├── nohup.out
├── packages
├── packages.cson
├── projects.cson
├── storage
└── style.less

config.cson contains your personal modification to Atom’s behaviour. For example, my config.cson presently looks like this:

most of these lines pertain to my customization of the behaviour of my installed packages. I am not really well-versed to the formatting of CSON files, so I am afraid I probably will not be too helpful in explaining how to write your own custom config.cson. keymap.cson, as you can probably guess, contains your own custom keyboard shortcuts, while style.less is your personal stylesheet (I know even less about its format than the CSON format, case in my point, my style.less file does not even exist). The packages.cson is a file that pertains to the package-sync package. It is a list of packages that the package-sync package can read and install, if missing. I personally keep all these files (so that I can more easily sync them across my PCs and operating systems) in my own GitHub repository — https://github.com/fusion809/atom.

Installing Atom

Atom is nowhere near as straight-forward to install as GNU Emacs, Vim or any other major free and open-source text editors. The reasons are several fold. Firstly, the vast majority of Linux distributions so far do not have an Atom package in their official software repositories. This leaves users to either have to build an Atom package themselves or compile Atom from source code, that is, if unofficial software repositories or other sources cannot provide a binary package for Atom. Secondly, building Atom from source code is an error-prone process that requires Internet access (and I do not mean to just retrieve Atom’s source code, rather the build itself, requires Internet access). Thirdly, building Atom requires a recent version of Node.js and npm to be installed on one’s system. The Atom GitHub repository has a mechanism for automatically building 64-bit Deb and RPM packages for each new Atom release, which allows Atom to be easily installed on platforms capable of installing these packages. The main problems with this method are that:

  • Firstly, not all distributions can work with Deb/RPM packages.
  • Secondly, these binaries are available for only 64-bit systems.
  • Third, even 64-bit systems that are capable of installing these packages do not get automatic updates when new releases of Atom become available. Rather the user will have to manually download the new Atom package for their respective distribution and upgrade Atom using said package.

On some distributions Atom can be installed from official or unofficial package repositories, if your distribution supports this I would strongly recommend you install Atom via this method. This way, when new releases of Atom come out, your Atom installation should be automatically updated when you run your package manager.

On a side note, anyone interested in making Atom easier to install on Linux I would recommend check out my new atom-installer GitHub repository. It is my aim to get this repository capable of automating the installation process of Atom on at least the following distributions:

  • Arch Linux
  • CentOS
  • Debian
  • Fedora
  • Gentoo Linux
  • Linux Mint
  • Mageia
  • openSUSE
  • Sabayon Linux
  • Ubuntu

pull request, bug reports, improvement suggestions, etc. will be welcome.

Official Binaries

Quite often installing Atom from official binary releases (that is, the Deb/RPM releases previously mentioned) is the simplest method for those on distributions that use said package formats. So this section will guide one through this process.

Deb

If your specific distribution is capable of working with 64-bit Deb packages (e.g., 64-bit Debian, Linux Mint and Ubuntu should be able to work with these packages), presumably using the dpkg package manager, then the following should download the latest Atom release and install it, provided the presently-enabled repositories are capable of satisfying its dependencies:

root #  curl https://atom.io/download/deb > atom-amd64.deb
root #  dpkg -i atom-amd64.deb
root #  apt-get -f install

RPM

On 64-bit RPM distributions several different commands maybe better suited to install Atom, depending on the specific distribution being used. For CentOS / Fedora ≤21 / Oracle Linux / Red Hat Enterprise Linux / Scientific Linux and other distributions still using the yum package manager, running the following should install Atom from the latest official RPM binary:

root #  curl https://atom.io/download/rpm > atom.x86_64.rpm
root #  yum install -y atom.x86_64.rpm

while Fedora ≥22, Korora ≥22 and other distributions that are now using the DNF package manager run:

root #  curl https://atom.io/download/rpm > atom.x86_64.rpm
root #  dnf install -y atom.x86_64.rpm

While on Mageia and other distributions using the urpmi package manager one would run:

root #  urpme apm # Mageia has a package called apm that is non-essential but conflicts with Atom
root #  curl https://atom.io/download/rpm > atom.x86_64.rpm
root #  urpmi atom.x86_64.rpm

On openSUSE and other distributions using the ZYpp package manager, to install Atom, one would run:

root #  curl https://atom.io/download/rpm > atom.x86_64.rpm
root #  zypper in -y atom.x86_64.rpm

Package Managers

The following distribution(s) have Atom in their official software repositories:

  • Gentoo Linux Logo Gentoo Linux. Atom (app-editors/atom-1.6.2 to be precise) was added to Gentoo’s official repository, that is, the Portage Tree, on the 6th of April 2016. Hence it can now be installed by running: root #  emerge app-editors/atom , assuming one’s local copy of the Portage Tree is up-to-date. A package conflict that will occur with a newly-installed Gentoo system is that app-editors/atom depends on net-libs/nodejs, which in turn depends on dev-libs/openssl[-bindist] (that is, this package without the bindist USE flag enabled), while net-misc/openssh requires this USE flag be enabled. The best solution is to re-emerge net-misc/openssh with the bindest flag disabled.
  • Sabayon Logo Sabayon. To install Atom on Sabayon, run: root #  equo i app-editors/atom.

the following distributions have an Atom package available from unofficial repositories:

  • Arch Linux Logo Arch Linux. Atom (package name is atom-editor) is available from the Arch User Repository (AUR). The AUR provides PKGBUILDs with which users can build Atom from source code. To install Atom from the AUR one must run user $  yaourt -S atom-editor –noconfirm (provided Yaourt is installed) or:

    user $  git clone https://aur.archlinux.org/atom-editor.git
    user $  cd atom-editor
    user $  makepkg -si --noconfirm

    this takes at least 20 minutes to build Atom, for me, at least. Alternatively you can install Atom from my PKGBUILDs GitHub Repository:

    user $  git clone https://github.com/fusion809/PKGBUILDs
    user $  cd PKGBUILDs/atom-editor
    user $  makepkg -si --noconfirm

    this will take the same amount of time, though, but it is less likely to fail on you due to momentary Internet glitches. Alternatively, if these PKGBUILDs are not fast enough to install Atom for you, then provided you are using 64-bit Arch Linux you can install Atom from the atom-editor-bin PKGBUILD in the AUR. It creates an Atom Arch Linux package by taking its installed files from the Atom Debian package provided by the Atom GitHub repository. Cuts the install time to less than five minutes, usually. To install atom-editor-bin using Yaourt run user $  yaourt -S atom-editor-bin –noconfirm . While to install the atom-editor-bin package manually run:

    user $  git clone https://aur.archlinux.org/atom-editor-bin.git
    user $  cd atom-editor-bin
    user $  makepkg -si --noconfirm
  • CentOS Logo CentOS 7. Atom is available from the Mosquito Copr and can be installed via running:

    root #  yum copr enable mosquito/atom
    root #  yum install -y atom
  • Fedora Logo Fedora. Atom is available from the Mosquito Copr and can be installed via running:

    root #  dnf copr enable mosquito/atom
    root #  dnf install -y atom
  • Ubuntu Logo Ubuntu. Atom (package name: atom) is available from the Webupd8team Personal Package Archive (PPA). To install Atom from it run:

    root #  add-apt-repository ppa:webupd8team/atom
    root #  apt-get update
    root #  apt-get install -y atom

Building from Source

Dependencies

The minimum requirements for building Atom on Linux, according to the official Atom build instructions for Linux platforms, include:

  • 32-bit / 64-bit computer architecture. 64-bit is preferable.
  • C/C++ build tools — the GNU Compiler Collection (GCC; must also have C++ support, C++ support is usually provided by a separate package called g++ or gcc-c++, depending on one’s distribution), the GNU C Library (glibc), including its development headers (sometimes provided by a separate package called glibc-devel) and GNU Make (usually called make) are usually used to satisfy this requirement on Linux platforms.
  • Git. Usually this package is called git on the distribution, in question.
  • Node.js (officially 0.10.x or above is supported, but Fedora has 0.10.x in their repositories and I have never managed to build Atom using their version of Node.js, so I would recommend using the 0.12.x or later series Node.js). The development headers are required, for some distributions this is provided by a package called nodejs-devel.
  • npm (officially v1.4.x or above is supported). On most distributions this is provided by a package called npm. This requires Python 2.6 / 2.7, usually provided by a python2 or python package.
  • Development headers for the GNOME keyring. This package is usually called libgnome-keyring / libgnome-keyring-dev / libgnome-keyring-devel.

All these requirements can, for most distributions (in fact all of them that I have experience with), be satisfied quite easily by installing packages from official repositories, except for the Node.js / npm requirement.

Node.js / npm

The vast majority of Linux distributions have Node.js and npm in their software repositories, the problem is that the version in their software repositories is seldom ever sufficiently recent for it to be suitable for building Atom with. Popular distributions without a sufficiently recent version of Node.js / npm to build Atom with in their official software repositories, include:

those with a sufficiently recent version of Node.js / npm in their official repositories include:

Distributions marked with an asterisk (*) can be installed using the distribution’s respective package manager, using the distribution’s respective NodeSource repository. This method can also be used by older versions of Fedora (namely ≤21). For details see here. Fedora >21 users could install a sufficiently recent version of Node.js via another method using their package manager. It involves finding a Copr repository containing a sufficiently recent version of Node.js, for example the nibbler/nodejs Copr. To add this particular Copr and install Node.js and npm from it, run:

root #  dnf copr enable nibbler/nodejs
root #  dnf install -y nodejs-devel npm

On other platforms, one has two main options for installing Node.js and npm: building and installing Node.js from source code (which should automatically also build npm along with it) and installing these packages using the generalized Node.js Linux binary tarballs (GNLBT) officially released by the Node.js project. The latest release of Node.js can be found here (and this link should remain valid indefinitely, even with the release of more recent releases of Node.js). The tarballs relevant to Linux users are (where x.y.z refers to the latest version of Node.js, presently at the time of writing this post this is 5.10.1):

  • node-vx.y.z-linux-x86.tar.gz
  • node-vx.y.z-linux-x86.tar.xz
  • node-vx.y.z-linux-x64.tar.gz
  • node-vx.y.z-linux-x64.tar.xz
  • node-vx.y.z.tar.gz
  • node-vx.y.z.tar.xz

The first two are the generalized Linux binary tarballs for 32-bit systems, the second two are the generalized Linux binary tarballs for 64-bit systems and the final two are the source code tarballs. I personally recommend installing Node.js using the generalized Linux binary tarballs, as the source code method is more tedious and failure-prone. To install Node.js 5.10.1 from the GNLBT on a 32-bit system, for example, one would run:

user $  curl http://nodejs.org/dist/v5.10.1/node-v5.10.1-linux-x86.tar.xz | tar -xJ
user $  cd node-v5.10.1-linux-x86
user $  sudo cp -a {bin,include,lib,share} /usr/

Before you do this, ensure that an older Node.js package is not already installed on your system via your package manager, as otherwise you will end up overwriting files belonging to this package and this could lead to problems down-the-track. To install Node.js 5.10.1 from the GNLBT for a 64-bit system one would run:

user $  curl http://nodejs.org/dist/v5.10.1/node-v5.10.1-linux-x64.tar.xz | tar -xJ
user $  cd node-v5.10.1-linux-x64
user $  sudo cp -a {bin,include,lib,share} /usr/

While to build and install Node.js from source code, assuming you have all the required dependencies already installed (including clang and GCC, both with C++ support, Python 2.6 or 2.7 and GNU Make), one would run:

user $  curl http://nodejs.org/dist/v5.10.1/node-v5.10.1.tar.xz | tar -xJ
user $  cd node-v5.10.1
user $  ./configure --prefix=/usr
user $  make
user $  sudo make install

Summary

On CentOS Logo CentOS / Oracle Linux / Red Hat Enterprise Linux running:

root #  curl --silent --location https://rpm.nodesource.com/setup_5.x | bash -
root #  yum install -y python nodejs-devel npm gcc gcc-c++ make glibc-devel git-core

should install all of Atom’s build and runtime dependencies.

On Debian Logo Debian / Ubuntu Logo Ubuntu, running:

root #  curl -sL https://deb.nodesource.com/setup_5.x | bash -
root #  apt-get install -y nodejs npm build-essential git libgnome-keyring-dev fakeroot

should install all of Atom’s build and runtime dependencies.

On Fedora Logo Fedora running:

root #  dnf copr enable nibbler/nodejs
root #  dnf install -y nodejs-devel npm glibc-devel python gcc gcc-c++ make git-core libgnome-keyring-devel

should install all of Atom’s build and runtime dependencies.

On openSUSE Logo openSUSE running:

root #  zypper in -y npm make gcc gcc-c++ glibc-devel git-core libgnome-keyring-devel

should install all of Atom’s build and runtime dependencies.

Building Atom

Building Atom from source code involves of the same basic steps on every distribution. After installing the required build and runtime dependencies, they are:

  1. Getting the source code. There are several different ways to do this, including via git cloning Atom’s GitHub repository and via downloading the source code tarball of the latest Atom release. Source code tarballs are far smaller downloads (<10 MB) than Atom’s GitHub repository (>250 MB), so usually I would recommend building Atom from source code tarballs. To get the source code tarball of version $ver of Atom with cURL, extract its contents, and change directory into it, run:

    user $  curl https://github.com/atom/atom/archive/v$ver.tar.gz | tar -xz
    user $  cd atom-v$ver
  2. Compiling the source, which is done by running:

    user $  script/build
  3. Installing Atom to one’s live file system, specifically to /usr (as opposed to the default location of /usr/local/) which is done by running:

    user $  sudo script/grunt install --install-dir /usr

    Alternatively, you can install Atom to a local directory instead of to one’s root file system. This can be helpful, as it is easier to undo (that is, to uninstall Atom). To do this run:

    user $  mkdir install
    user $  script/grunt install --install-dir install

Footnotes

  1. Licensed under the permissive MIT License.

  2. Garen Torikian (29 October 2015). “Why Atom?”. Flight Manual: Atom Community. Retrieved 25 March 2016.

  3. This level of schooling is also known as “elementary school” in North America.

  4. In contrast with both GNU Emacs and Vim, which have a steep learning curve and usually take even seasoned programmers at least weeks to pick up.

  5. Ben Ogle (25 June 2015). “Atom 1.0”. Atom Blog: Atom Community. Retrieved 25 March 2016.

  6. Also licensed under the permissive MIT License.

Comments