Categories
Uncategorized

mutt completion in zsh

After a little while spent battling with zsh’s completion system today, I have made it complete my aliases file. My setup is slightly non standard (although not that unusual I think) in that the aliases aren’t defined in my ~/.muttrc file. Instead, they’re in ~/.mail_aliases. To get zsh to know about this requires a small function to go in your ~/.zshrc:

_email-mutt() {
    files[$plugin]=~/.mail_aliases
    _email-mail
}

I managed to get that by looking at the source for the _email_addresses completion function. I don’t know how I could have got by without it. The zsh book should turn up in a few days; maybe that will enlighten me more.