Mendhak / Code

edit is a terminal text editor that doesn’t make me think

My terminal-based text editing almost always occurs in short sessions. I’ll usually want to modify something and get out. To me, it makes no sense to have to step on a learning curve for a text editor. A good tool gets out of your way, which is why I don’t tend to favour vim, and only tolerate nano.

Recently, edit was open-sourced, and by chance I spotted that it had a Linux build, so I decided to try it out.

It comes in a zstd file, which was new to me, but installing it wasn’t too difficult:

wget https://github.com/microsoft/edit/releases/download/v1.1.0/edit-1.1.0-x86_64-linux-gnu.tar.zst
tar --zstd -xvf edit-1.1.0-x86_64-linux-gnu.tar.zst
cp edit ~/.local/bin/
exec bash

After that, just edit a file:

edit myfile.txt

edit terminal text editor, with this blog post being written in it
Writing this blog post

Within just a few minutes, I had a pretty good grasp of it, mostly because there wasn’t anything to ‘learn’. It’s like the original gedit or notepad right in the terminal, out of the box.

Another thought that occurred: it’s like someone reimplemented a terminal text editor, while cognizant of the slew of modern rich TUI tools that have emerged such as rich, posting, and textual.

Using edit immediately felt intuitive and natural (minus some vim/nano shortcuts I had to Ctrl+Z from muscle memory).

The shortcuts are intuitive, because they’re what most GUI text editors and IDEs use. Ctrl+S to save (how did it take this long?), and Ctrl+Q to quit, and Alt+Z to word wrap. I can even Ctrl+Z to undo.

The Edit menu in the edit editor
The edit edit menu

The find supports regex!

Using regex in the search feature in edit
Using regex in find!

Clicking somewhere in a document moves the mouse cursor to that position — again, it’s that natural visual way of editing. I believe nano and vim can do this with some configuration settings, but it isn’t a default.

It’s possible to use the mouse as well as usual keyboard shortcuts to highlight text, and copy, paste, cut, delete just as I would elsewhere. Sure, it’s simple, but it’s the simple things.

Overall, they’ve done a pretty decent job of porting the fast click-and-shortcut experience over from UI land.

Ability to select a column
There’s even column select

The menus at the top are clickable, and there’s a file picker too.

File select dialog showing various files in the directory
File picker

Opening multiple files is possible, and I just use the bottom right menu to switch between them.

Switcher dialog showing the current files being edited in this session
Switching between files

While writing this post using edit, it did exactly what I wanted: it got out of my way. I’m now convinced enough to add it to my $PATH and give it a proper shot. Because it’s so approachable with its mouse and keyboard flow support, this could also be a good starting point for people new to the terminal.