################# GENERAL ###################
set realname = 'Florian Fischer'

set my_cfgdir = $HOME/.mutt

set mbox_type = Maildir
set folder = ~/.local/share/maildir/

# Store message headers locally to speed things up.
# If hcache is a folder, Mutt will create sub cache folders for each account which may speeds things up even more.
set header_cache = ~/.cache/mutt

################ ACCOUNTS ####################
# default account
set my_account = "MUHQ"
source $my_cfgdir/accounts/$my_account

# when changing into other mailboxes, use different adresses etc.
folder-hook MUHQ/* source $my_cfgdir/accounts/MUHQ
folder-hook SNFMT/* source $my_cfgdir/accounts/SNFMT
folder-hook FISCHER-PAF/* source $my_cfgdir/accounts/FISCHER-PAF
folder-hook VOCOSMA/* source $my_cfgdir/accounts/VOCOSMA
folder-hook HSG/* source $my_cfgdir/accounts/HSG

# Set Reply-To header after change_account hook cleared it
folder-hook VOCOSMA/Schmidt my_hdr Reply-To: ras@vocosma.it
folder-hook VOCOSMA/FFErlangen my_hdr Reply-To: ff-erlangen@vocosma.it

mailboxes `find ~/.local/share/maildir/MUHQ -type d '(' -name 'cur' -o -name 'new' ')' -prune -printf '%h '`
mailboxes `find ~/.local/share/maildir/SNFMT -type d '(' -name 'cur' -o -name 'new' ')' -prune -printf '%h '`
mailboxes `find ~/.local/share/maildir/FISCHER-PAF -type d '(' -name 'cur' -o -name 'new' ')' -prune -printf '%h '`
mailboxes `find ~/.local/share/maildir/VOCOSMA -type d '(' -name 'cur' -o -name 'new' ')' -prune -printf '%h '`
mailboxes `find ~/.local/share/maildir/HSG -type d '(' -name 'cur' -o -name 'new' ')' -prune -printf '"%h" '`

############### GPG ########################

source ~/.mutt/gpg

set pgp_use_gpg_agent = yes

set crypt_autosign = yes
set crypt_replysign = yes
set crypt_replyencrypt = yes
set crypt_replysignencrypted=yes
set crypt_verify_sig=yes

############### MISC #######################

set sort=threads
set sort_aux=last-date-received
set collapse_all
unset collapse_unread
set edit_headers=yes

# forward all parts of a message
set mime_forward

# use khard as external adressbook
set query_command= "khard email --parsable %s"
bind editor <Tab> complete-query
bind editor ^T    complete

# use xdg-mime to determine mime types
set mime_type_query_command = "xdg-mime query filetype"

set mailcap_path = ~/.mutt/mailcap

############## COLOR #######################

# Patch syntax highlighting
# https://www.do-not-panic.com/2014/07/colored-diffs-with-mutt.html
color   normal  white           default
color   body    brightwhite     default         ^[[:space:]].*
color   body    brightwhite     default         ^(diff).*
color   body    white           default         ^[\-\-\-].*
color   body    white           default         ^[\+\+\+].*
color   body    green           default         ^[\+].*
color   body    red             default         ^[\-].*
color   body    brightblue      default         [@@].*
color   body    brightwhite     default         ^(\s).*
color   body    brightwhite     default         ^(Signed-off-by).*
color   body    brightwhite     default         ^(Cc)

source ~/.mutt/theme

############ STATUSBAR #####################

# status bar, date format, finding stuff etc.
set status_format="───%r %D [Msgs:%?M?%M/?%m%?n? New:%n?%?o? Old:%o?%?d? Del:%d?%?F? Flag:%F?%?t? Tag:%t?%?p? Post:%p?%?b? Inc:%b?%?l? %l?]───(%s/%S)─%>─(%P)───"
set compose_format="─── Compose  [Approx. msg size: %l   Atts: %a]%>─"
set date_format = "%d.%m.%Y %H:%M"
set index_format = "[%Z] %?X?A&-? %D  %-20.20F  %s"

############# SIDEBAR ######################

set mail_check_stats # collect stats to show them in the sidebar

set sidebar_visible
set sidebar_folder_indent
set sidebar_width = 35
set sidebar_divider_char = ' | '
set sidebar_indent_string = ' '
set sidebar_format = "%B %* [%?N?%N / ?%S]"
set sidebar_non_empty_mailbox_only
set sidebar_sort_method = 'new'

############# BINDINGS #####################

source $my_cfgdir/bindings

############# MAILING LISTS ################

source $my_cfgdir/mailinglists

############# NOTMUCH ######################

source $my_cfgdir/notmuch
