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
-
Gnome 47.1 Released with a Few Fixes
The latest release of the Gnome desktop is all about fixing a few nagging issues and not about bringing new features into the mix.
-
System76 Unveils an Ampere-Powered Thelio Desktop
If you're looking for a new desktop system for developing autonomous driving and software-defined vehicle solutions. System76 has you covered.
-
VirtualBox 7.1.4 Includes Initial Support for Linux kernel 6.12
The latest version of VirtualBox has arrived and it not only adds initial support for kernel 6.12 but another feature that will make using the virtual machine tool much easier.
-
New Slimbook EVO with Raw AMD Ryzen Power
If you're looking for serious power in a 14" ultrabook that is powered by Linux, Slimbook has just the thing for you.
-
The Gnome Foundation Struggling to Stay Afloat
The foundation behind the Gnome desktop environment is having to go through some serious belt-tightening due to continued financial problems.
-
Thousands of Linux Servers Infected with Stealth Malware Since 2021
Perfctl is capable of remaining undetected, which makes it dangerous and hard to mitigate.
-
Halcyon Creates Anti-Ransomware Protection for Linux
As more Linux systems are targeted by ransomware, Halcyon is stepping up its protection.
-
Valve and Arch Linux Announce Collaboration
Valve and Arch have come together for two projects that will have a serious impact on the Linux distribution.
-
Hacker Successfully Runs Linux on a CPU from the Early ‘70s
From the office of "Look what I can do," Dmitry Grinberg was able to get Linux running on a processor that was created in 1971.
-
OSI and LPI Form Strategic Alliance
With a goal of strengthening Linux and open source communities, this new alliance aims to nurture the growth of more highly skilled professionals.