#  ▓▓▓▓▓▓▓▓▓▓
# ░▓ Author ▓ Abdullah Khabir <https://abdullah.today/>
# ░▓▓▓▓▓▓▓▓▓▓                 <https://abdullah.solutions>
# ░░░░░░░░░░                  <abdullah@abdullah.today>
#


# source important files

source $HOME/.config/mutt/colorrc
source $HOME/.config/mutt/gpgforak.rc
source $HOME/.config/mutt/aliases


set header_cache = ~/.cache/mutt
set message_cachedir = ~/.cache/mutt
set mbox_type = Maildir
set sidebar_visible = yes
set sidebar_width = 20
set sidebar_folder_indent = yes
set sidebar_short_path = yes
set sidebar_delim_chars = "/."
set sidebar_divider_char = " | "
set sidebar_format = "%B%* %?N?%N:?%S"
color sidebar_new color33 color233
set folder = "~/.local/share/email/x1c"
set spoolfile = "~/.local/share/email/x1c/INBOX"
mailboxes $HOME/.local/share/email/x1c/INBOX $HOME/.local/share/email/x1c/Archive $HOME/.local/share/email/x1c/Sent $HOME/.local/share/email/x1c/Drafts $HOME/.local/share/email/x1c/Spam

unset record # gmail saves Sent mail
set from                         = `age -i ~/.ssh/id_ed25519 -d ~/cfg/secrets/google_user.age`
set realname                     = "Muhammad Abdullah Khabir"
set use_from                     = yes
set envelope_from                = yes
set sendmail                     = msmtp
set abort_noattach               = "no"
set abort_noattach_regexp        = "attach"
set abort_nosubject              = "ask-yes"
set alias_file                   = "~/.config/mutt/aliases" #source it
set alias_format                 = "%4n %2f %t %-10a   %r"
set allow_8bit                   = "yes"
set allow_ansi                   = "no"
set arrow_cursor                 = "yes"
set ascii_chars                  = "no"
set askbcc                       = "no"
set askcc                        = "no"
set assumed_charset              =
set attach_charset               =
set attach_format                = "%u%D%I %t%4n %T%.40d%> [%.7m/%.10M, %.6e%?C?, %C?, %s] "
set attach_sep                   = "\n"
set attach_split                 = "yes"
set query_command                = "goobook query %s"
set attribution                  = "On %d, %n wrote:"
set attribution_locale           =
set auto_tag                     = "no"
set autoedit                     = "yes"
set beep                         = "yes"
set beep_new                     = "yes"
set bounce                       = "ask-yes"
set bounce_delivered             = "no"
set braille_friendly             = "no"
set browser_abbreviate_mailboxes = "yes"
set certificate_file             = "~/.config/mutt/certs"
# set crypt_autosign               = yes
# set crypt_replyencrypt           = yes
set date_format                  = "%d/%m"
set editor                       = "$EDITOR +':set textwidth=0'"
set fast_reply                   = yes
set imap_keepalive               = 300
set include                      = yes
set mail_check                   = 60
set mail_check_stats             = yes
set mailcap_path                 = ~/.config/mutt/mailcap
set message_cachedir             = ~/.cache/mutt/messages
set pager                        = $EDITOR
set pager_context                = 3
set pager_index_lines            = 8
# set pgp_autosign                 = no
# set pgp_replysign                = no
# set pgp_replysignencrypted       = no
# set pgp_sign_as                  = 0x5CBC7BC7
# set pgp_timeout                  = 3600
# set pgp_use_gpg_agent            = yes
# set postpone_encrypt             = yes
# set postpone_encrypt_as          = 0xE6E81782
set prompt_after                 = no
set quote_regexp                 = "^( {0,4}[>|:#%]| {0,4}[a-z0-9]+[>|]+)+"
set reply_regexp                 = "^(([Rr][Ee]?(\[[0-9]+\])?: *)?(\[[^]]+\] *)?)*"
set rfc2047_parameters           = yes
set send_charset                 = utf-8
set sidebar_format               = "%B%?F? [%F]?%* %?N?%N/?%S"
set sidebar_short_path = yes
set sidebar_visible              = yes
set thorough_search
set status_chars                 = " *%A"
set sig_dashes                   = no
set signature                    = ~/.config/mutt/signature
set sort                         = threads
set sort_aux                     = reverse-last-date-received
set ssl_force_tls                = yes
set ssl_starttls                 = yes
set timeout                      = 3
set quit
set visual                       = $EDITOR
set wait_key                     = no
set status_format                = "───[ Folder: %f ]───[%r%m messages%?n? (%n new)?%?d? (%d to delete)?%?t? (%t tagged)? ]───%>─%?p?( %p postponed )?───"
set sort_re
set edit_headers
unset confirmappend
unset imap_passive
unset mark_old
set smart_wrap
unset markers
set pipe_decode
set text_flowed
set pager_stop
auto_view application/pgp-encrypted
set menu_scroll
set uncollapse_jump
set delete
set tilde
set imap_check_subscribed

# HTML

auto_view text/html
alternative_order text/enriched text/plain text/html
alternative_order text/plain text/enriched text/html
alternative_order text/plain text/html

# Keybindings

bind attach <return> view-mailcap
bind editor <Tab> complete-query
bind attach,index G last-entry
bind attach,index g first-entry
bind attach,index,pager \CD next-page
bind attach,index,pager \CU previous-page
bind browser $ check-new
bind index   \t   next-unread
bind index  ,\t previous-unread
bind index <space>  collapse-thread
bind index <tab>    sync-mailbox
bind index G        last-entry
bind index R        group-reply
bind index,pager J   sidebar-next
bind index,pager K     sidebar-prev
bind index,pager O  sidebar-open
bind pager G bottom
bind pager R  group-reply
bind pager g noop
bind pager gg top
bind pager j  next-line
bind pager k  previous-line

# colors

color header blue default "^(Subject)"
color index red white "~v~(~F)!~N"
color sidebar_new yellow default

# macros

macro index,pager a "<pipe-message>goobook add<return>" "add the sender address to Google contacts"
macro index C "<copy-message>?<toggle-mailboxes>" 
# macro index q "<sync-mailbox><shell-escape>/usr/bin/offlineimap -o >/dev/null 2>&1<enter><quit>"
macro index M "<save-message>?<toggle-mailboxes>"
#macro index O "<shell-escape>mbsync -Va<enter>" 
macro index \Cr "T~U<enter><tag-prefix><clear-flag>N<untag-pattern>.<enter>" 
macro index,pager U "<enter-command>set pipe_decode  = yes<enter><pipe-message>urlview<enter><enter-command>set pipe_decode = no<enter>""view URLs"

# headers

my_hdr User-Agent: Eat your heart out, Windows Lusers
hdr_order from: to: cc: date: subject:
unhdr_order *

# vim:ft=muttrc
