set attach_format="%u%D%I %t%4n %T%.120d%> [%.7m/%.10M, %.6e%?C?, %C?, %s] "
set text_flowed=yes
set sig_on_top
set sig_dashes = no
set move = no
set delete
unset confirmappend
set smart_wrap
#set pager = /usr/bin/less
set quit
unset mark_old
unset resolve # don't advance to next message after operation
unset markers # don't insert a '+' on wrapped lines
set wait_key = no
set include
set sort='threads'
set sort_aux='reverse-last-date-received'
set auto_tag = yes
set pipe_decode = yes
ignore "Authentication-Results:"
ignore "DomainKey-Signature:"
ignore "DKIM-Signature:"
#unignore *
hdr_order Date From To Cc
auto_view text/html
auto_view text/calendar application/ics
alternative_order text/html text/plain *
#alternative_order text/plain text/html *
# Google Contacts
set query_command = "goobook reload && goobook query '%s'"
bind editor <Tab> complete-query
bind editor ^T complete
bind editor <space> noop
auto_view text/html
# Google Contacts
#set query_command = "goobook query '%s'"
#bind editor <Tab> complete-query
#bind editor ^T complete
#bind editor <space> noop
set text_flowed=yes
# sidebar patch
#set sidebar_delim = ' │'
#set sidebar_visible = no
#set sidebar_width = 30
#color sidebar_new brightgreen default
# MY keybindings
bind pager j next-line
bind pager <Down> next-line
bind pager k previous-line
bind pager <Up> previous-line
bind pager > next-undeleted
bind pager < previous-undeleted
bind pager / search
bind generic gg first-entry
bind pager gg top
bind generic G last-entry
bind index G last-entry
bind pager G bottom
bind index - collapse-thread
bind index _ collapse-all
#bind index q noop
bind index,pager s noop # unset s for saving, since our archive command below is pretty much all we do
bind index,pager f flag-message
bind index,pager F forward-message
bind index u undelete-message
#macro attach a "<pipe-message>ripmime -i - -d "
macro attach a "<save-entry><bol>"
macro attach T "<tag-pattern>"
macro index,pager a "<pipe-message>goobook add<enter>" "Add the sender address to Google Contacts"
# color settings
#color normal default default
# Gmail-style keyboard shortcuts
#folder-hook "+[Gmail]/All Mail" 'macro index y "<save-message>=Inbox<enter>" "Copy message from archive to Inbox"'
folder-hook . 'macro index,pager x "<change-folder>=Inbox<enter>" "Go to inbox"'
folder-hook . 'macro index,pager A "<group-reply>" "Group reply'
#folder-hook . 'macro index,pager a "<group-reply>" "Group reply'
folder-hook . 'macro index,pager n "<toggle-new>" "Toggle new flag"'
folder-hook +Inbox 'macro index x "<sync-mailbox><exit>" "Sync mailbox and exit"'
#folder-hook +Inbox 'macro index qq "<sync-mailbox><shell-escape>/usr/bin/offlineimap -u basic -q<enter>" "Sync mail with offlineimap (quick form)"'
folder-hook +Inbox 'macro index qq "<sync-mailbox>" "Sync mail with disk"'
#folder-hook +Inbox 'macro index qf "<sync-mailbox><shell-escape>~/bin/offlineimap.sh<enter>" "Sync mail with offlineimap (full form)"'
folder-hook +Inbox 'macro index qf "<sync-mailbox>" "Sync mail with disk"
folder-hook +Inbox 'macro index y "<clear-flag>N<save-message>=archive<enter>" "Gmail archive message"'
folder-hook +Inbox 'macro index Y "<tag-pattern>!~F<enter><tag-prefix><clear-flag>N<save-message>=archive<enter>" "Tag all unstarred messages and archive"'
folder-hook +Inbox 'macro index N "<tag-pattern>~N<enter><tag-prefix><clear-flag>N<untag-pattern>~T<enter>" "Tag all unstarred messages and archive"'
folder-hook +Inbox 'macro pager y "<save-message>=archive<enter><next-undeleted>" "Gmail archive message, move to next message"'
folder-hook +Inbox 'macro index,pager x "<sync-mailbox><exit>" "Sync mailbox to disk and exit"'
folder-hook +archive 'macro index y "<save-message>=Inbox<enter>" "Move message to Inbox"'
folder-hook results$ 'macro index y "<save-message>=Inbox<enter>" "Move message to Inbox"'
folder-hook +archive 'macro pager y "<save-message>=Inbox<enter><exit>" "Gmail archive message"'
folder-hook results$ 'macro pager y "<save-message>=Inbox<enter><exit>" "Gmail archive message"'
#folder-hook +file_transmit 'macro index s "<pipe-message>ripmime -i - -d "
#macro pager u "<pipe-entry>urlview<enter>" "Follow links in urlview"
macro index,pager d "<enter-command>set trash=trash<enter><delete-message>" "Gmail delete message"
macro index,pager gi "<change-folder>=Inbox<enter>" "Go to inbox"
macro index,pager ga "<change-folder>=archive<enter>" "Go to all mail"
macro index,pager gs "<change-folder>=spam<enter>" "Go to spam messages"
macro index,pager gd "<change-folder>=drafts<enter>" "Go to drafts"
macro index,pager gt "<change-folder>=sent<enter>" "Go to drafts"
# Index sorting keys
macro index SS "<shell-escape>~/bin/by-score<enter><enter-command>source ~/.muttrc<enter>" "Sort by score"
macro index ST "<shell-escape>~/bin/by-threads<enter><enter-command>source ~/.muttrc<enter>" "Sort by thread"
macro index SD "<shell-escape>~/bin/by-date<enter><enter-command>source ~/.muttrc<enter>" "Sort by date"
macro index SR "<shell-escape>~/bin/by-reverse<enter><enter-command>source ~/.muttrc<enter>" "Sort aux by date"
macro index SE "<shell-escape>~/bin/by-sent<enter><enter-command>source ~/.muttrc<enter>" "Sort by date sent"
# Search with notmuch
macro index / "<enter-command>unset wait_key<enter><shell-escape>notmuch-mutt --prompt search<enter><change-folder-readonly>~/.cache/notmuch/mutt/results<enter>" "Search messages"
# -*-muttrc-*-
# Star scoring
source ~/.mutt/stars
set my_red_star = 1000
set my_orange_star = 900
set my_purple_question = 800
set my_yellow_bang = 600
set my_blue_star = 500
set my_green_star = 400
set my_magenta_question = 300
set my_green_check = 200
set my_blue_info = 100
set my_del_star = 0
macro index sr "<enter-command>set pipe_decode=no<enter><pipe-entry>~/bin/stars $my_red_star<enter><enter-command>set pipe_decode=yes<enter><enter-command>source ~/.muttrc<enter>" "Mark the current message with RED"
macro index so "<enter-command>set pipe_decode=no<enter><pipe-entry>~/bin/stars $my_orange_star<enter><enter-command>set pipe_decode=yes<enter><enter-command>source ~/.muttrc<enter>" "Mark the current message with ORANGE"
macro index sm "<enter-command>set pipe_decode=no<enter><pipe-entry>~/bin/stars $my_magenta_question<enter><enter-command>set pipe_decode=yes<enter><enter-command>source ~/.muttrc<enter>" "Mark the current message with MAGENTA"
macro index sp "<enter-command>set pipe_decode=no<enter><pipe-entry>~/bin/stars $my_purple_question<enter><enter-command>set pipe_decode=yes<enter><enter-command>source ~/.muttrc<enter>" "Mark the current message with MAGENTA"
macro index sy "<enter-command>set pipe_decode=no<enter><pipe-entry>~/bin/stars $my_yellow_bang<enter><enter-command>set pipe_decode=yes<enter><enter-command>source ~/.muttrc<enter>" "Mark the current message with YELLOW"
macro index sg "<enter-command>set pipe_decode=no<enter><pipe-entry>~/bin/stars $my_green_star<enter><enter-command>set pipe_decode=yes<enter><enter-command>source ~/.muttrc<enter>" "Mark the current message with GREEN"
macro index sc "<enter-command>set pipe_decode=no<enter><pipe-entry>~/bin/stars $my_green_check<enter><enter-command>set pipe_decode=yes<enter><enter-command>source ~/.muttrc<enter>" "Mark the current message with GREEN (check)"
macro index si "<enter-command>set pipe_decode=no<enter><pipe-entry>~/bin/stars $my_blue_info<enter><enter-command>set pipe_decode=yes<enter><enter-command>source ~/.muttrc<enter>" "Mark the current message with BLUE"
macro index sb "<enter-command>set pipe_decode=no<enter><pipe-entry>~/bin/stars $my_blue_star<enter><enter-command>set pipe_decode=yes<enter><enter-command>source ~/.muttrc<enter>" "Mark the current message with BLUE STAR"
macro index sd "<enter-command>set pipe_decode=no<enter><pipe-entry>~/bin/stars $my_del_star<enter><pipe-entry>~/bin/del_stars<enter><enter-command>set pipe_decode=yes<enter><enter-command>source ~/.muttrc<enter><sync-mailbox>" "Remove color marking from the current message"
macro pager sr "<pipe-entry>~/bin/stars $my_red_star<enter><next-undeleted>" "Mark the current message with RED"
macro pager so "<pipe-entry>~/bin/stars $my_orange_star<enter><previous-undeleted><enter-command>source ~/.muttrc<enter>" "Mark the current message with ORANGE"
macro pager sm "<pipe-entry>~/bin/stars $my_magenta_question<enter><next-undeleted>" "Mark the current message with MAGENTA"
macro pager sp "<pipe-entry>~/bin/stars $my_purple_question<enter>" "Mark the current message with MAGENTA"
macro pager sy "<pipe-entry>~/bin/stars $my_yellow_bang<enter><next-undeleted>" "Mark the current message with YELLOW"
macro pager sg "<pipe-entry>~/bin/stars $my_green_star<enter><next-undeleted>" "Mark the current message with GREEN"
macro pager sc "<pipe-entry>~/bin/stars $my_green_check<enter><next-undeleted>" "Mark the current message with GREEN (check)"
macro pager si "<pipe-entry>~/bin/stars $my_blue_info<enter><next-undeleted>" "Mark the current message with BLUE"
macro pager sb "<pipe-entry>~/bin/stars $my_blue_star<enter><next-undeleted>" "Mark the current message with BLUE STAR"
macro pager sd "<pipe-entry>~/bin/stars $my_del_star<enter><pipe-entry>~/bin/del_stars<enter><next-undeleted><sync-mailbox>" "Remove color marking from the current message"
macro index,pager \ci "<pipe-message> less<Enter>" "call less to extract URLs out of a message"