Edit text conveniently in a terminal window with Slap

Getting Started

Getting started with Slap is not difficult. After launching the program, you can conveniently navigate the file tree with your mouse, including scroll support. However, if you open directories with a large number of files, smooth scrolling suddenly deteriorates into an annoyingly jerky process. The ability to jump to files with names that start with specific letters by pressing the matching keys is something that Slap, in contrast to other applications, currently does not offer.

My tests revealed another weakness when I dumped new files in the background into the directory I was currently viewing in the Slap file view: Slap did not immediately see these files; in fact, I needed to change to a different directory and then back before the files finally appeared.

When you open a file, its content is displayed in the right-hand part of the window. In the lab, opening a file took quite a while in some cases; this was particularly true of files with a large volume of source code, which took Slap a couple of seconds to enable syntax highlighting.

After loading in full, you can start editing directly. Pressing F2 lists the most frequently used hotkeys (Figure 2). Table 1 lists the hotkeys and a couple of other shortcuts as a reference.

Figure 2: Pressing F2 displays a short list of frequently used hotkeys.

Table 1

Hotkeys in Slap




Show help

Ctrl + Q

Quit the editor

Ctrl + O

Jump to the navigation panel and open a file

Ctrl + S

Save file

Ctrl + F

Start search

Ctrl + G

Go to the stated line

Ctrl + Left arrow

Jump one word to the left

Ctrl + Right arrow

Jump one word to the right

Ctrl + Up arrow

Move one line up

Ctrl + Down arrow

Move one line down

Ctrl + A

Go to the start of the line

Ctrl + E

Go to the end of the line

Ctrl + M

Go to the matching bracket

Ctrl + W

Delete the word to the left of the cursor

Ctrl + Del

Delete the word to the right of the cursor

Ctrl + K

Delete the current line

Ctrl + C

Copy selected content

Ctrl + V

Insert the clipboard content at the current position

Ctrl + X

Cut the selected content


Show or hide the navigation pane


Change to edit mode

After opening an existing file, or after completing a fair amount of typing, you can press the left mouse button to navigate through the lines and words. Alternatively, you can use the arrow keys in combination with the Control key. To jump to a specific location in the file, you can either search or specify the line number.

To delete a specific line, use the hotkeys or the mouse to navigate to the line in question and press Ctrl+K to remove it. Alternatively, you can select the whole line with the left mouse button and then press the Delete key twice: The first key press deletes the content, and the second deletes the line itself.

After just a few minutes, you should be familiar with the controls, characterized by a balanced mix of keyboard shortcuts and mouse movements. Editing text is easy enough, but trying to insert long lines of text in the editor can be annoying. Because Slap has no automatic line wrap, you need to move the cursor to the end of the line to see all the content. If you decide to copy and paste content, you will be pleased to see that the familiar keyboard shortcuts Ctrl+C and Ctrl+V take on their normal roles.


In the style of Vim, which may be familiar to you, Slap also has a configuration file with various customization options. If you use the editor frequently, take a quick look at slap.ini (Figure 3), which you will find in /usr/lib/node_modules/slap/. The content of this file defines the hotkeys, the interface colors, and the syntax highlighting.

Figure 3: The Slap configuration file offers users many options for customizing the editor.

Editing this file directly is not a good idea. If you want to modify some of the functions to suit your own needs, the cleaner (and – in case of an update – safer) approach is to edit the .slaprc file that Slap creates in your own home directory when first launched. To do so, open the file with any editor (e.g., Slap) and type the values you want to change. Make sure you break your personal configuration file down into sections as in the slap.ini template. Note that copying the selected content from the system global configuration to ~/.slaprc and then modifying its content is the fastest way to create your own configuration.

Essentially, you can modify any values – including the hotkeys – to suit your needs. The exceptions are the shortcuts stored in the slap.ini file, and anything the terminal would consider to be an escape character. Figure 4 shows an example of what a custom Slap configuration can look like – the modified configuration is already active in the figure.

Figure 4: The editing and navigation windows already reflect the configuration shown here.


The Slap text editor with its JavaScript underpinnings takes an unusual approach but is a welcome change to text editors without mouse support. The mix of familiar hotkeys and mouse support lends itself to efficient and convenient editing.

Navigation is okay for the most part but shows a couple of weaknesses here and there. This fairly young editor still has some potential for improvement. For example, performance drops when you edit larger files.

Although the author claims similarity to Sublime Text [7], I found very few likenesses in the lab. The original is more powerful and mainly targets experienced power users and developers.

Wherever you look, though, Slap impresses with its adaptability, which is why I can unequivocally recommend the editor for newcomers and experienced users alike – at least on your personal workstation. The software is definitely not designed for servers, and you are very likely to get into trouble with the system administrator if you try to install JavaScript just to run a text editor.

The Author

Valentin Höbel works as a Cloud architect for VoIP specialists NFON AG in Munich. In his free time, you will either find him playing table soccer, or checking out the latest open-source technologies.

Buy this article as PDF

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

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • KiCad

    KiCad helps you design printed circuit boards with up to 32 layers, checks for optimal placement, and supplies schematics and assembly diagrams in the popular Gerber format for submission to PCB manufacturers.

  • Master PDF Editor

    Master PDF Editor offers an easy option for correcting small typos and protecting documents against unauthorized access.

  • Perl: Spotty

    The Spotlight utility for the Macintosh has even the most hardened Apple fans scurrying back from the mouse to the keyboard. A short Perl script implements the utility for the Linux desktop.

  • Micro

    Editing text at the command line doesn't have to be daunting. Micro brings the ease and intuitiveness of a graphical editor to the Linux terminal.

  • Sunflower

    Following in the footsteps of Norton Commander and its clones, the Sunflower twin-panel file manager takes a giant leap forward with a switch to Python 3 and GTK3.

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