GitHub's configurable editor

Weaknesses and Strengths

Atom still has a couple of issues, the most noticeable being that Atom cannot handle files greater than 2MB; the developers are working on a solution. They are also looking for a way to speed up the editor's slowish launch behavior and GUI reaction speed. The response was a tad too slow in our lab, but that might have been the result of using a virtual machine.

One feature that really works (surprise, surprise) is integrated version management with Git and GitHub. For example, using Ctrl+Alt+Z restores the last good version of a file and is equivalent to:

git checkout HEAD -- /<path>
git reset HEAD -- /<path>

If you want to know which of your files is not being tracked, you can press Ctrl+Shift+B (i.e., git status). With the help of the language-git package, you can highlight Commit, Merge, and Rebase messages for Git. The git-diff package allows the editor to highlight modified lines.

If you're looking for information about a file that you are currently editing on GitHub, a number of keyboard shortcuts (Table 1) can help.

Table 1

GitHub Keyboard Shortcuts for Atom

Shortcut

Action

Alt+G+O

Open a file on GitHub

Alt+G+B

GitHub info relating to the last changes of a file

Alt+G+H

View GitHub history of a file

Alt+G+C

Copy the GitHub URL of the current file

Alt+G+R

Branch comparison with GitHub

Hackable to the Core

Another of Atom's benefits is the ability to customize the software. A Package Generator creates a skeleton for the package; in our lab, I used the classic hello-world as its title. This package does nothing but display window with a Hello World! message (Figure 2).

Figure 2: The hello-world package conjures up an unspectacular window with the standard message on the screen.

Pressing Ctrl+Shift+P then starts the command search and calls Package Generator: Generate Package. The boilerplate code created by this ends up in the github/<Projectname> directory; the project name in this example is hello-world. At the same time, the directory tree generated by this process is shown in the tree view on the left; Figure 3 shows the skeleton of the hello-world package.

Figure 3: In the tree view on the left is the structure of the automatically generated package. On the right is the code that handles the program logic.

The second to last file in the treeview is package.json, which contains a variety of metadata for the package (Figure 4), including domain, the version number, the potential GitHub repository, as well as the path to the executable files in the lib subdirectory.

Figure 4: The package.json that resides in the root directory of the package contains metadata, such as the path to the executable file and the version number.

The lib subdirectory contains two files: hello-world.coffee and hello-world-view.coffee, which organizes the graphical user interface (Listing 1). Figure 3 shows the code with the package logic. The methods activate, deactivate, serialize, and toggle have been folded to show the structure; Listing 2 contains the invisible code.

Listing 1

lib/hello-world-view.coffee

 

Listing 2

lib/hello-world.coffee

 

Listing 1 generates the root element (@element) and assigns it as a child of the message element (line 12); then, the code defines how the element responds to getElement() and destroy() calls.

The first three of the four methods in Listing 2 are typically part of a package. The activate method generates a modal UI element (ModalPanel) and pins it to Atom's workspace (line 4). The subscriptions method assigns the menu entry defined in Listing 3 to the @toggle() method (Listing 2, line 20), which is optional. It ensures that an entry for hello-world is displayed below the Packages menu. If you click on Toggle in this venue, or press Alt+Ctrl+O, you will see the window from Figure 2 either appear or disappear.

Listing 3

menus/hello-world.cson

 

The details in the menu are customizable; Listing 3 shows the simple schema. It lives in the menus folder in the hello-world.cson file and creates an entry for the context menu (line 1) and for the Atom menu (line 8).

Moreover, developers who pay attention to style can change the style in a .less file (below styles), define a keyboard shortcut (keymaps), and create specifications for tests (spec). The specs also lets you perform regression tests [7]; the Atom makers rely on their own Jasmine [8] JavaScript test framework for this.

Conclusions

Given that it is only version 1.0, Atom already gives a robust impression, and it is genuinely easy to configure comprehensively. Users of the Sublime Text editor will probably be familiar with many elements; the developers seem to have borrowed heavily from the proprietary Python software. The developers are probably confident that the tie to GitHub will ensure them a new and sustainable basis for their code platform.

Even Atom has a learning curve. The editor still has some deficits in terms of user interface response time and in the way it handles large files. Additionally, the installation is a bit tricky. However, Atom has a very active user community after just one year and has been downloaded 750,000 times. The 803 developers have added 1,861 packages, so it looks like the editor meets a genuine demand.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Workspace: Atom Editor

    Although Atom is designed for developers and coders alike, writing professionals can also benefit from this powerful text editor.

  • Clojure

    Clojure looks like Lisp and runs wherever Java is installed. Practical tools and sophisticated libraries provide the underpinnings for rapid development of modern web applications.

  • JChemPaint

    Drawings of molecules can be made with a graphics program like Inkscape. But structural formulas turn out even better if you use the JChemPaint professional molecule editor.

  • Custom Keybindings in the Atom Editor
  • JavaScript Alternatives

    JavaScript is the stuff of which many interactive web clients is made, but it comes with a fair amount of historical ballast. The creators of four alternative scripting languages seek to ditch the ballast.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News