Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Gmail on Mutt
alias nick Nicholas Levandoski <>
alias tim Timothy Pitt <>
alias steven Steven Jackson <>
alias kaleb Kaleb Hornsby <>
alias alug-admin nick, tim, steven
# Change the next 7 lines appropriately.
set imap_user =
set imap_pass = secret
set smtp_url = smtp://
set smtp_pass = secret
set from =
set realname = "Kaleb Hornsby"
set editor = 'vim -c "set spell spelllang=en_us"'
# Don't let your firewall kill your idle connection.
set imap_keepalive = 900
# Do not copy sent mail. Gmail smtp already does this.
set copy = no
set folder = imaps://
set spoolfile = +INBOX #or +[Gmail]/Important
set postponed = +[Gmail]/Drafts
# This is using the 'trash' patch.
set trash = +[Gmail]/Trash
# Cache
set header_cache = ~/.mutt/cache/headers
set message_cachedir = ~/.mutt/cache/bodies
set certificate_file = ~/.mutt/certificates
# Gmail style keybindings
bind editor <space> noop
bind index,pager c mail #Compose
macro index,pager e "<save-message>=[Gmail]/All Mail<enter><enter>" "Archive conversation"
bind generic x tag-entry #Select Conversation
bind index x tag-thread #Select Conversation
bind pager x tag-message #Select Conversation
bind index,pager s flag-message #Star a message
macro index,pager + <save-message>=[Gmail]/Important<enter><enter> "Mark as important"
macro index,pager ! <save-message>=[Gmail]/Spam<enter><enter> "Report spam"
bind index,pager a group-reply #Reply all
bind index,pager \# delete-thread #Delete
bind index,pager l copy-message #Label
bind index,pager v save-message #Move to
macro index,pager I <set-flag>O "Mark as read"
macro index,pager U <clear-flag>O "Mark as unread"
macro index,pager ga "<change-folder>=[Gmail]/All Mail<enter>" "Go to all mail"
macro index,pager gs <change-folder>=[Gmail]/Starred<enter> "Go to 'Starred'"
macro index,pager gd <change-folder>=[Gmail]/Drafts<enter> "Go to 'Drafts'"
macro index,pager gl <change-folder>? "Go to 'Label'"
macro index,pager gi <change-folder>=INBOX<enter> "Go to inbox"
macro index,pager gt "<change-folder>=[Gmail]/Sent Mail<enter>" "Go to 'Sent Mail'"
folder-hook +INBOX 'macro index,pager y "<save-message>=[Gmail]/All Mail<enter><enter>" "Archive conversation"'
folder-hook +[Gmail]/Trash macro index,pager y <save-message>=INBOX<enter><enter> "Move to inbox"
folder-hook +[Gmail]/Starred bind index,pager y flag-message #"Toggle star"
# This should be ' »›-‹L' to match Gmail, but $to_chars breaks on unicode.
set to_chars = ' +>-<L'
# Don't move read mail.
set move = no
# Sort by newest conversation first.
set sort = reverse-threads
set sort_aux = last-date-received
# Contact aliases, could also use `goobook`.
set alias_file = ~/.mutt/aliases
set sort_alias = alias
set reverse_alias = yes
set reverse_name = yes
source $alias_file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.