eh: a minimalist vi-like editor
eh is a minimalist vi-like editor written in C. It keeps the core vi editing model while adding UTF-8 support, regex search/replace, shell filters, and multi-level undo/redo. An earlier version was a winning entry in the 28th IOCCC (2024), receiving the “Nice accent eh-ward.” Comments
The eh editor is a minimalist, vi-like text editor. It was created as an example of the Buffer Gap method, which is used in many Emacs style editors. To use eh, create or open a text file containing lines of printable UTF-8 text, tabs, or newline characters. Physical lines can be of any length, delimited by a newline or end of file.
Tab stops are set every eight columns. Non-printable characters' behavior may differ based on the Curses library implementation, stty settings, or terminal emulator. Most commands can be repeated, such as 5w, 123G, 2dw, or 2d3w. Motion commands, which move the cursor without altering the buffer, can be prefixed with a count. Certain edit commands can follow a motion.
The TERM variable indicates the user's terminal type, and if unset or not sufficient, eh will terminate with a non-zero exit status. TERMINFO is the absolute path of a terminfo database. Displaying long lines that exceed the terminal screen can be undefined, so it's considered limited. Unrecognized control characters are shown as highlighted alphabetic characters.
The u and U commands now support multi undo and redo, differing from historical vi. CRLF newlines (DOS, Windows) should be converted to LF newlines. The default stty insert literal prefix key is ^V. Cygwin builds might have bugs with wcwidth(), as wchar_t reflects UTF-16 to match Windows and there's no equivalent c32width() or means to determine cell width of surrogate pairs, like emojis.
Craig A. Finseth authored the Craft Of Text Editing in 1991 and 1999, while Webb Miller's A Software Tools Sampler discusses vi(1) in chapter 5. The Single Unix Specification's Base Specification 2018 and vi(1) standards are available online.
Written by urgent.news from Lobsters's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.