The Charming Allure of ed(1)
I’m writing this post using a text editor from 1969. It’s called ed(1) (pronounced “Ee Dee”, not that I do). This program is in some ways literally prehistoric. It’s twice my age!
As you’d expect, it is difficult to use. I am unable to see the exact contents of the file I’m editing. In order to actually read back what I’ve written, I need to issue a specific command to the editor. The program is text-based, executing in what is known as “line mode”. You type out a full line, press the “ENTER” key, and some kind of change is made. If you need to jump to a specific part of the file, you have to type a command for it. Move some text around, that’s a command. Make a specific edit in many places at once? That’s a command.
Of course, any moderately experienced programmer would be familiar with text editors such as vim or emacs, which are well-known to empower users to rapidly make changes all over a file. Unlike ed(1), those programs also display the text of a file to the user as it’s being edited, so what exactly is the advantage to ed(1)?
To me, there are two serious advantages to using ed(1). First, line mode is incredibly elegant. If I need to see what I just did, I just scroll the text back to see what I was doing. Second, ed(1) has few features. I learned the majority of its commands in a half hour. There aren’t even any keyboard shortcuts. No Ctrl+C or Ctrl+V. You can copy-paste text using other programs. I read the manual, started using it, and mere hours later I was already very familiar with the details of how it functions.
One of my favourite sources of examples for how ed(1) can outperform even the programmer powerhouses like vim and emacs is the Twitter account for “ed(1) Conference”, @ed1conf. Many of the tweets there demonstrate how you can perform the same tasks in ed(1) as in vim, yet usually with fewer keystrokes. It’s ridiculous.
Few pieces of software could hope to match the actual ease-of-learning you see with ed(1). Most also cannot match the conceptual simplicity in how the user interacts with it. It’s just text. The user types text. The program outputs text. The program operates on text files. There is no complicated screeen display. Dependencies are minimal. It barely does anything, yet it does everything a text editor needs to do. When using it, I rarely find myself wanting in features. No, I have not used it professionally. I suspect it would be much more difficult to use ed(1) to add features to a codebase that wasn’t formatted with it in mind. But for something like this? A post on a personal website? It is far more than enough.
.
wq