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).
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.
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.
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.
Infos
- Atom: https://atom.io
- Sublime Text: http://www.sublimetext.com
- Electron: http://electron.atom.io
- NodeSource distribution of Node.js: https://github.com/nodesource/distributions
- Grunt: http://gruntjs.com
- Atom Flight Manual: https://atom.io/docs/latest/
- Writing specs for Atom: https://atom.io/docs/latest/hacking-atom-writing-specs
- Jasmine: http://jasmine.github.io
« Previous 1 2
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
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.
News
-
Linux Servers Targeted by Akira Ransomware
A group of bad actors who have already extorted $42 million have their sights set on the Linux platform.
-
TUXEDO Computers Unveils Linux Laptop Featuring AMD Ryzen CPU
This latest release is the first laptop to include the new CPU from Ryzen and Linux preinstalled.
-
XZ Gets the All-Clear
The back door xz vulnerability has been officially reverted for Fedora 40 and versions 38 and 39 were never affected.
-
Canonical Collaborates with Qualcomm on New Venture
This new joint effort is geared toward bringing Ubuntu and Ubuntu Core to Qualcomm-powered devices.
-
Kodi 21.0 Open-Source Entertainment Hub Released
After a year of development, the award-winning Kodi cross-platform, media center software is now available with many new additions and improvements.
-
Linux Usage Increases in Two Key Areas
If market share is your thing, you'll be happy to know that Linux is on the rise in two areas that, if they keep climbing, could have serious meaning for Linux's future.
-
Vulnerability Discovered in xz Libraries
An urgent alert for Fedora 40 has been posted and users should pay attention.
-
Canonical Bumps LTS Support to 12 years
If you're worried that your Ubuntu LTS release won't be supported long enough to last, Canonical has a surprise for you in the form of 12 years of security coverage.
-
Fedora 40 Beta Released Soon
With the official release of Fedora 40 coming in April, it's almost time to download the beta and see what's new.
-
New Pentesting Distribution to Compete with Kali Linux
SnoopGod is now available for your testing needs