box.matto.nl
Enjoying Open Source Software

In praise of the convenience and speed of the editor ed

Life in plain text

First some background.

Vi and Vim

I have been using Vi and Vim for more than two decades, for most of the stuff I write.

All in all I guess that I spend at least six hours per day in Vi and in Vim.The Vi and Vim keys are engraved in my muscle memory, and I issue most edit commands automatically, without thinking about it.

ed

In 2018 I discovered ed and decided to invest time in it.

I have learned how to use ed and use it almost daily for many small editing tasks. Currently I am feeling totally comfortable in ed.

Emacs and Micro Emacs

Some time ago I decided that I wanted to learn to use Emacs. My motivation for this started when I discovered that extensions like rec-mode and ledger-mode are much more capable than the plugins for Vim. Also I want to learn more to program in Forth and in Lisp, and for both Emacs can be used as a great REPL.

I decided to go for the vanilla Emacs key bindings and started learning to use those. I have been using vanilla Emacs for a couple of months now.

Putting the adagio "Do or do not. There is no try." into practice, I moved my tasks from Taskwarrior to org mode and use Emacs daily for several editing jobs. Slowly I am getting more fluent in the use of it. I am still not feeling comfortable enough in Emacs, but it gets better every day.

Also I am mixing my use of Emacs with the use of mg. Mg is a Micro Emacs that is part of the default OpenBSD install, is small and fast and feels a bit less intimidating than full blown Emacs.

For fun I also started to fool around in some other Micro Emacs variants, JOVE and uemacs.

Using ed

Yesterday I had to quickly test some installation- and configuration notes for an application on a Raspberry Pi. To make sure these notes are 100% correct, I dd-ed a new, fresh image of Raspberry Pi OS Lite to a micro SD-card, and started from there.

This means editing the config file to get a serial console on the UART, creating a wpa_supplicant.conf and editing the network interfaces file, and so on.

After the Raspberry Pi 3 A+ booted and had a working WiFi connection, I edited the fstab file, did an apt-get update and apt-get upgrade and started installing and configuring the application, set up NGINX as a reverse proxy, et cetera. After that I wrote the configuration scripts, created a file for systemd and so on.

For all this, I only used one editor: ed.

I did this without thinking about it.

This has become my normal reflex.

Maybe I would think twice before writing from scratch a large text file in ed. But for these tasks, creating and editing configuration files. adding small changes to existing files, make some quick adjustments here and there, nothing beats the convenience and speed of ed. It really has become a habit to use ed for these tasks.

rlwrap does make working in ed much more convenient, but most of the time, mostly due to muscle memory, I forget to enter it at the command line.

Love of ed

Of course, Vi, Vim, Emacs and the Micro Emacs are all capable editors. And I do use these editors, certainly for larger tasks like writing an article or a memo.

But in the last few years, I have come to love ed.

I like the elegance of a very small editor.

Ed is old, it goes all the way back to the very first days of Unix.

In the seventies, George Coulouris created em, the "Editor for Mortals", as a reaction to ed. So, ed is apparently not for everybody. But I love it.

Ed may be old, but it is very capable. I am in awe by the power that ed provides, and I really do like using it.

For me, ed gives us a glimpse of the genius of Ken Thompson.

For small editing tasks, make some minor adjustments to text files, but also for creating and editing text files like configuration files, nothing can beat the speed of ed.

Tags:

⇽ Create a persistent macro in JOVE Micro Emacs How I make my Shakshuka ⇾