Writing Emails In Helix

This article is all about writing emails in Helix. Obviously, Helix isn’t an email client – and it’s lacking in a plugin system, so you can’t really turn it into one, either. And that’s okay! You might be wondering, then, what exactly do I mean by “writing emails in Helix”?

An email client needs to do a whole lot more than write text! It needs to connect to your mail servers, show your messages, display and allow you to interact with flags/labels, be able to send your email, etc. Only an insane person would try to hamfist this functionality into a text editor (I’m looking at you, Neovim plugin developers!).

Helix is really good at its one job, and that’s editing text. It is a text editor, after all. As it turns out, writing emails is, well, text editing, which is Helix’s forte. So why not take Helix’s amazing writing experience, and apply it to email? If you’re willing to take the plunge, you may be pleasantly surprised at how joyful writing email can actually be!

There are a few different ways to approach composing emails in Helix. This post covers what worked best for me. That is, using Helix as a composer for the aerc email client. It wasn’t straightforward to figure out at first, but all-in-all, the configuration isn’t actually that complicated, so you should be able to set it up in no time.

Email Client Integration

At the end of the day, an email is just a text file. An .eml file, to be exact. So, you could just open up a fresh buffer, manually type in your headers, and go to town. When you’re done, you can figure out some way to actually send that file (perhaps dragging and dropping it into your mail client).

However, that’s not really ideal. For starters, emails have a lot of headers, and if you mess any of them up, your message might not get delivered. You probably want to be able to, at the very least, reply to an email and have its headers be auto-filled.

Therefore, some level of integration with an actual email client is desirable. Let the client handle every other aspect of reading and sending email, and relegate writing to Helix. This is the approach I’ll be covering.

Roadmap

I’ll describe the best way to get Helix integrated with aerc, which is a TUI email client, and the method I’m currently using for all my email. I won’t be talking too much about aerc itself. Configuring that program is a whole separate, beautiful, painful, complex ordeal, worthy of its own article.

Since it’s out of scope for this post, I’ll assume that you’re comfortable installing aerc, connecting it to your mail server, and reading/writing an email. I’ll be dropping another article taking a deep dive into advanced Aerc configuration.

Instead, I focus here on the specifics of configuring Helix not just to write emails in aerc (which it can basically do OOTB), but to be amazing at writing emails. That means Markdown syntax highlighting, auto-line-wrapping that doesn’t conflict with your normal Markdown configuration, and spellcheck. All the bells and whistles you’d want from a real email composer.

To be continued…