Skip to content

Tag Archives: utiltiies

Google contacts in mutt and vim

I’m a long-time fan of the mutt email client. I’ve probably been using it for ten years. It’s quick, text-based, and does precisely what I want. I’ve been using the vim text editor for even longer than that.

In using mutt and vim, though, I surrender some of the convenience of a mail client like Thunderbird, Mail.app or Outlook, which are fully integrated with contacts and calendars. Fortunately, mutt and vim make it easy to solve my own problem.

Finding Contacts

First, install goobook. It’s a python script that lets you easily query Google Contacts. Goobook returns results in abook format, which is great if you’re using that companion utility for mutt to provide email addresses to mutt before you draft your email. I prefer to just hit compose and get a blank email and fill in the To:, Cc:, etc. myself.

So what I want is to hit a key while I’m editing a message, have vim read the word that I’m on, and autocomplete that word based on my Google Contacts. First order of business is fixing the output of Goobook to something useful, which I do with this little script:

#!/bin/sh