Edit text conveniently in a terminal window with Slap
Leaps and Bounds
The Slap editor supports easy navigation, even through large volumes of data, but the promising software has a couple of hiccups along the way.
The choice of text editors on Linux is seemingly infinite – whether for the terminal or with a sophisticated graphical user interface, you are likely to find the right tool for any application if you look hard enough. Although newcomers tend to choose intuitively usable programs like Nano [1] or Pico [2] if they need to edit text-based files at the command line, more experienced users may prefer versatile veterans like Vim or feature-rich classics like Emacs.
Migrating from one editor to another is not easy, mainly because the many keyboard shortcuts differ, stifling your ability to move between editors. The Slap [3] text editor is gathering a fan community rapidly by positioning itself precisely between the newcomer and professional editor camps. Instead of relying on many hotkeys, it uses mouse support and interacts with the Linux clipboard.
Young and Different
Slap is unusual in many respects. Whereas other programs in this field can look back on a long history and are typically the work of many individuals – or even whole communities – Slap is a one-man project by Dan Kaplun [4]. Unlike Nano, Vim, or Emacs, Slap is based on the JavaScript scripting language, which is more typically used for websites or web applications.
The first traces of Slap go back to April 2014, when Kaplun (a.k.a. beardtree) posted the first commit on GitHub [5]. Since then, the developer has added many features and shortcuts to the editor. Slap has thus become a lean alternative for editors like Vim or Emacs and has so far avoided the bloat associated with them.
Installation
Because of its fairly short development history – and probably also because of its JavaScript underpinnings – Slap lacks packages in the distribution repositories for now. Instead, you install the libraries required for the tool up front and then install the editor itself via the Node.js package management system (NPM).
Listing 1 shows the installation on Ubuntu 12.04 and 14.04. You need to be root to use all of these commands. During tests in our lab, I used the 64-bit variants of Ubuntu. Line 5 uses the less secure HTTP for the download instead of HTTPS, because Curl on Ubuntu fails to identify the SSL certificate correctly that is stored on NPMJS for Slap. The tool is also available for other distributions; you will find details of the installation procedures for these distributions online [6].
Listing 1
Installing Slap
After running the commands shown in Listing 1, you can launch the editor by typing the slap
command in a terminal. Optionally, you can pass a file name into the command if you will be editing an existing text file.
Features
Although Slap runs in a console window, when launched, the program comes up with an interface split into two columns; if needed, you can even use the mouse to control it – this is a little unusual for experienced users, but a pointing device does remove the need to learn a number of new, complex hotkeys.
The left half of the window contains a folder and file tree, and the right side shows open files. As you can see in Figure 1, Slap also supports syntax highlighting for numerous scripting and programming languages.
Besides the ability to highlight code, you will find very few aids for developers – only parenthesis matching and automatic indenting help you when typing. You also will look in vain for features such as auto-completion of existing variables or class names.
You do, however, have the option of searching open files with the help of regular expressions or sharing content via the Linux clipboard. In tests, cutting and pasting with content from a website opened in Firefox worked pretty well. As you would expect of any good application, you can undo or redo the last action.
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
-
Systemd Fixes Bug While Facing New Challenger in GNU Shepherd
The systemd developers have fixed a really nasty bug amid the release of the new GNU Shepherd init system.
-
AlmaLinux 10.0 Beta Released
The AlmaLinux OS Foundation has announced the availability of AlmaLinux 10.0 Beta ("Purple Lion") for all supported devices with significant changes.
-
Gnome 47.2 Now Available
Gnome 47.2 is now available for general use but don't expect much in the way of newness, as this is all about improvements and bug fixes.
-
Latest Cinnamon Desktop Releases with a Bold New Look
Just in time for the holidays, the developer of the Cinnamon desktop has shipped a new release to help spice up your eggnog with new features and a new look.
-
Armbian 24.11 Released with Expanded Hardware Support
If you've been waiting for Armbian to support OrangePi 5 Max and Radxa ROCK 5B+, the wait is over.
-
SUSE Renames Several Products for Better Name Recognition
SUSE has been a very powerful player in the European market, but it knows it must branch out to gain serious traction. Will a name change do the trick?
-
ESET Discovers New Linux Malware
WolfsBane is an all-in-one malware that has hit the Linux operating system and includes a dropper, a launcher, and a backdoor.
-
New Linux Kernel Patch Allows Forcing a CPU Mitigation
Even when CPU mitigations can consume precious CPU cycles, it might not be a bad idea to allow users to enable them, even if your machine isn't vulnerable.
-
Red Hat Enterprise Linux 9.5 Released
Notify your friends, loved ones, and colleagues that the latest version of RHEL is available with plenty of enhancements.
-
Linux Sees Massive Performance Increase from a Single Line of Code
With one line of code, Intel was able to increase the performance of the Linux kernel by 4,000 percent.