mg

I’m recently becoming a fan of the text editor mg(1). It is exactly what the man page advertises it to be: a small, fast, and portable Emacs clone.

The basic Emacs keyboard shortcuts (C-a, C-e, C-k, C-t, etc) are kind of hardwired into my brain. They’re also ubiquitious: you will find software like bash, zsh, macOS, Gtk, and many others supporting them either by default, or as a preset/option.

I was pretty excited to find out that people who originally made Mac OS X have been hardcore Emacs users, and they’ve baked in some of the basic Emacs editing shortcuts into the core of the system. Things like C-t to transpose two adjacent letters, or C-k to kill (delete) text until the end of the line, work in every app, and they work very consistently. Being friendly both to casual- and to power-users is a value I wish more software embraced.

However the experience of using the “real” Emacs for everyday coding work is becoming increasingly frustrating. The editor gives you plenty of power out of the box, but between the lacking modern features (such as smart autocomplete, jump to definition, etc), antiquated defaults, and reliance on third-party extensions to fill many of the gaps, a minimal usable config clocks at a few hundred lines of ELisp, and tends to become a project in itself. Emacs as an IDE is also complete overkill for simple text editing.

I’m still shopping for an IDE replacement, but I feel that mg fills the gap for almost all my other text editing needs. It’s packaged for almost every OS/distribution I’ve used in the past decade. It offers enough out of the box to not leave you frustrated about a missing feature, and because it changes so little, there’s very few inconsistencies if you randomly find yourself using a different operating system or environment.

I’ve only changed a few defaults:

backup-to-home-directory on
global-set-key "\^x\^c" kill-buffer
global-set-key "\^x." save-buffers-kill-emacs

My only gripe with mg is that it’s terminal-only. I think it’s more important for a good, universal editor to support a terminal frontend than any particular graphical frontend, but having a graphical frontend would be nicer for almost anything except editing files over an SSH session. But I also think any kind of a graphical frontend would not fit this project’s role and goals. (But maybe building one would be an interesting side project?)

Nowadays I keep coming back to Emacs for one thing, and one thing only: Magit. I really wish it was a standalone program; for everything that’s frustrating about Emacs - the sum of all that frustration is still outshined by Magit’s magically powerful and intuitive interface. (If you’re interested in how Magit gained its powers, you should also check out transient commands.)