TITLE: Fetching mail with offlineimap within Mutt
DATE: 2019-06-25
AUTHOR: John L. Godlee
====================================================================


I wanted to be able to press a key in mutt which would run
offlineimap in the background to get new messages, then ask Mutt to
put them on screen. This line goes in my .muttrc:

   macro index,pager @ "<enter-command>unset
wait_key<enter><shell-escape>offlineimap -o -u quiet
&<enter><sync-mailbox>" "Run offlineimap"

It defines a macro which can be run in the index or the pager of
mutt by pressing the @ key.

First it stops mutt from asking the user to press any key to
continue once the shell command is finished.

Next it invokes offlineimap in the background (&). Then afterwards
it syncs mutt with its mailboxes (:sync-mailbox).