A Lovely Harmless Monster

Someone finally made a good linux terminal editor. It was Microsoft

Hat tip to Andrew T @ mathstodon for bringing this to my attention: Microsoft Edit.

Andrew wrote up a nice little blog post enumerating all the issues with the state of terminal-based text editing. I haven't seen it before the other day, but it's quite a good read, I recommend it. I agree with everything he says. He laments, as I have in the past, that the last good terminal-based text editor was the one that served as the IDE for Microsoft Quickbasic (and was eventually spun off into its own executable, edit.com.)

Like Andrew, I use graphical text editors whenever practical, but there are workflows where it makes more sense to use an editor on the command line. Any time I need to make small changes to a lot of text files, a keyboard-based workflow makes the most sense. For example, a recent side-project I've embarked on is a mirror of every episode of the Midnight Snacks music podcast on archive.org. I'm doing this by hand, gradually over time, because I want to be respectful and not hammer his server with 120+GB of transfers in a few hours. It's slow, but I'm not in a rush. Just spending 10m a day archiving a couple months of shows, I should be done within the year.

I'm saving the track lists as .tsv, which is the uncommon but still useful tab-separated value format. The reason is because when I copy the track list and paste it into a text document, the artist column is already separated from the title column by a tab.2 When you view this as plain text, it doesn't line up neatly, because the artist names take up varying tab widths of space:

(image deleted, fuck imgur)

But a .tsv file can be opened in your spreadsheet app of choice and gives you a cleanly separated artist/track view:

(image deleted, fuck imgur)

Your better spreadsheet apps (Gnumeric, Spread323) automatically know what to do with a .tsv file, but excel, libreoffice etc work fine with the default import settings.

Anyway, doing this by hand through the graphical file browser was a hassle. I have to make sure I'm in the right folder, right-click, "create new file", type in 0031.tsv (or whatever) and press enter, right-click and open in Mousepad, paste the text, ctrl-S, click the X, etc.

Doing this in the terminal is much faster, because I can just micro 0031.tsv, ctrl-shift-V, ctrl-S, ctrl-Q, done. When I'm done with the tracklists for October, I can just type cd ../11 to navigate to the new folder for November which I already created when I downloaded the next episode. I still have to use my mouse, and alt-tab between the terminal and Firefox, but it's much less cumbersome than using a graphical file manager in this case.

I had been using Micro as my terminal editor, which was the only game in town for a long time. It was the only terminal editor I could find with something even remotely resembling a normal UI. It's heavily based on nano, which was the only game in town prior to the creation of micro, and its UI was only normal compared to the inscrutable terminal editors from the 70s which inexplicably people still talk about.

Micro is an improvement over nano, but only by degrees. It changes the hotkeys to ones that make sense, like ctrl-S to save instead of ctrl-O to "write out". But it can still be frustratingly opaque. For example, every time I install micro I need to press ctrl-G (for ghelp, obviously) and pore over the documentation to try to figure out how to turn word wrap on.

I have never not wanted word wrap in any text editor, ever, ever. It does me absolutely no good to have lines longer than the width of the window disappear off the edge of the window. I would like to be able to see all of it. Neither nano nor micro makes this straightforward. Nano is much worse, because you have to make sure you remember to use "soft wrap" or it'll place a bunch of unwanted line breaks in your document, and you have to use the confusing atblanks option if you want it to do actual word wrap instead of breaking words at the end of a line in half.1

Anyway, Microsoft's edit is a fully usable terminal editor. It has menus for all the options you need. The menu items have clearly labeled and logical shortcuts, so you don't have to use a mouse, but you can if you want to. To enable word wrap, you press alt-V for the View menu and then press W. It also shows you an alternate hotkey, alt-Z, so you can change it with a single keystroke if you want. Right now there are no persistent settings, so I have to press alt-Z every time I need to enable it, but a settings page is on the roadmap.

It's not perfect. It doesn't do syntax highlighting, but that's on the roadmap too. There are various UI bugs that are being worked on. It's early days. But I can see this becoming the only text editor I use. It already has everything I need from a GUI while maintaining the power and flexibility of a TUI. It's a self-contained binary <1MB. It uses no RAM. It supports regex find-and-replace. It doesn't need an instruction manual because everything you can do with it is self-explanatory. It teaches you how to use a text editor the same way World 1-1 teaches you how to play Super Mario Bros.

Believe me, it brings me no joy to celebrate Microsoft. They suck, and I still never plan to use Windows at home again. But you have to give them the W. The people working on this project understand what makes a good terminal UI. That it took a team at Microsoft stepping up to fill the void should be a profound embarrassment to the FOSS community. Not that I don't appreciate the work put in by the team that made micro, theirs was the only decent option for a long time, but their approach was still too linuxy.

I was going to say their approach is "stuck in the past", but it's not even that: edit.com has existed since 1991. The qbasic UI from whence it sprang has existed since 1988. It's almost as old as me! Someone could have looked at it and copied its very good design. If you don't need modern features like syntax highlighting, edit.com is still a perfectly cromulent text editor even today. For awhile my "distraction-free writing environment" was a $20 Thinkpad from 2006 with nothing but MS-DOS 5.0 and a copy of edit.com.4 It works great. Why in over 30 years has nobody in FOSS taken inspiration from it?

I guess I should acknowledge it's quite possible there is already a good terminal editor and I'm just not aware of it. That was the case with linux image editors: LazPaint is the only good one, and I had never heard of it until I asked for recommendations off the beaten path. If you know a good terminal editor no one's ever heard of, please drop your suggestion in the comments below. Otherwise, I stand in full support of this one specific microsoft product, and I'll try my best not to be embraced, extended or extinguished.


  1. At one point, the manual page for nano described the option like this: "You can make this soft-wrapping occur at whitespace instead of rudely at the screen's edge, by using also --atblanks." You agree that this is rude. So WHY ISN'T --atblanks THE DEFAULT?! 

  2. My original idea was to find-and-replace every tab character with a comma and save them as .csv because that's more widely compatible, but some of the artist names and track titles contain commas. Tabs are the delimiter that won't show up anywhere else. 

  3. I just double-checked, and I was misremembering, Spread32 can't handle .tsv files at all! How disappointing, I wonder if there are any lightweight spreadsheet apps for windows that will. 

  4. My one issue with edit.com is the searing blue background color, and I either used the FreeDOS port or fiddled with my settings to make everything monochrome in order to make it readable, I forget what my exact setup was. 

Thoughts? Leave a comment