I’m a pretty avid aerc user. If you’ve been reading this blog for a bit you probably seen how I got my personal email & school emails working in aerc.
Early on into this journey I noticed that I was making quite a few typos and grammatical mistakes when switching over to terminal based email. Where email is the professional communications tool this is simply unacceptable. As a workaround I started writing my emails in markdown to quickly get the amazing grammar checking from Harper, an amazing grammar checker written by a good friend of mine, Elijah Potter. While writing the emails in a markdown file and then copy and pasting them into the aerc composer worked, it was kinda annoying.
My solution for getting world class checking while drafting was quite simple.
- Ensure neovim is my document editor for email
- Ensure Harper is running on
.eml
ormail
type files
Part One: Neovim as a Draft Writer
This part is was probably easiest part. Just slap a bit of $EDITOR
defaults
with neovim, problem solved.
export VISUAL="nvim"
export EDITOR="nvim"
Now whenever aerc opens the drafting interface it simply shells out to $EDITOR
and we have neovim instance running with a draft of our email. I also believe
this should also work for any other email client that has similar composer
behavior like mutt, neomutt, alpine etc.
Part Two: Grammar Checking
Now comes the “harder” part, ensuring email gets checked. First make sure
harper-ls is installed on your system. You can do this by installing via
mason.nvim or installing directly
cargo install --git https://github.com/elijah-potter/harper harper-ls
.
I put in a PR (#93) which allows for checking with email files. Granted the implementation is a bit naïve, but it works well enough. To use the functionality you simply just need to make sure that neovim knows that harper can work with mail filetypes.
lspconfig.harper_ls.setup{
filetypes = {
'mail',
...other languages can go here
},
}
Now just enjoy blazing fast local grammar checking on your email!
PS You can easily test if it works by opening neovim with a .eml
file
(nvim test.eml
) and run :LspInfo
and check if harper-ls is running.