I suggest you take a look at sup (http://supmua.org/). Its goal is to transpose the gmail experience on your terminal.
I've been working with the maildirroot branch [0] which mimics the IMAP installation of GMail, so you can use a standard OfflineIMAP to sync between your computer and GMail, and still use all the power of tagging/archiving/searching on your computer.
Oh and it has a few niceties, the most important one to me being native support of gpg.
Once you've looked at sup, take a look at Notmuch (http://notmuchmail.org/), which separates the search/indexing of incoming messages from the mail composition from sending/receiving. As a spiritual sup successor, it has a few nice clients for the command line (bower?) and various editors (Emacs, maybe a vim client too)
I've been working with the maildirroot branch [0] which mimics the IMAP installation of GMail, so you can use a standard OfflineIMAP to sync between your computer and GMail, and still use all the power of tagging/archiving/searching on your computer.
Oh and it has a few niceties, the most important one to me being native support of gpg.
Disclaimer: I'm one of the maintainers.
[0] https://github.com/sup-heliotrope/sup/tree/maildir-root