# NeoMutt shared base — sourced by neomuttrc (clearnet) and neomuttrc.tor
# Contiene UI, GPG, sidebar, HTML, sort, cache, colors. NESSUN account qui.

# =====================================================
# Impostazioni Generali
# =====================================================

set realname = "Gabriel1"
set use_from = yes
set envelope_from = yes

set editor = "vim"
set edit_headers = yes
set autoedit = yes

my_hdr References:
my_hdr Reply-To:
my_hdr X-Newsgroups:

set date_format = "%d/%m/%Y %H:%M"
set index_format = "%4C %Z %d %-20.20L %s"

set my_account_info = "[Account]"
set status_format = "$my_account_info │ %f %?M?(%M hidden)? %?n?(%n new)?%?d? (%d to delete)?%?t? (%t tagged)? %>─%?p?(%p postponed)?─"

# Sidebar
set sidebar_visible = yes
set sidebar_width = 30
set sidebar_format = "%B%?F? [%F]?%* %?N?%N/?%S"
set mail_check_stats

# =====================================================
# Sicurezza
# =====================================================

set ssl_force_tls = yes
set ssl_starttls = yes

# =====================================================
# GPG/PGP
# =====================================================

set crypt_use_gpgme = yes
set crypt_autopgp = yes
set pgp_auto_decode = yes
set crypt_verify_sig = yes
set crypt_replysign = yes
set crypt_replyencrypt = yes
set crypt_replysignencrypted = yes

set pgp_sign_as = "0xC8F007F03A6657D8"
set pgp_default_key = "0xC8F007F03A6657D8"
set pgp_use_gpg_agent = yes

set crypt_opportunistic_encrypt = no

macro index,pager \Ce "<check-traditional-pgp>" "Verifica PGP inline"
macro index,pager \Cv "<view-attachments><search>application/pgp<enter><view-mailcap><exit>" "Visualizza firma/chiave PGP"

# =====================================================
# HTML
# =====================================================

set mailcap_path = "~/.config/neomutt/mailcap"
auto_view text/html
alternative_order text/html text/plain
set implicit_autoview = yes

macro index,pager \cv "<view-attachments><search>html<enter><view-mailcap><exit>" "Apri HTML in Firefox"

# =====================================================
# Ordinamento
# =====================================================

set sort = threads
set sort_aux = reverse-last-date-received

# =====================================================
# Cache
# =====================================================

set header_cache = "~/.cache/neomutt/headers"
set message_cachedir = "~/.cache/neomutt/bodies"

# =====================================================
# Theme
# =====================================================

source ~/.config/neomutt/colors.mutt

# =====================================================
# Scorciatoie utili (UI generale)
# =====================================================

bind index,pager B sidebar-toggle-visible
bind index,pager \Cp sidebar-prev
bind index,pager \Cn sidebar-next
bind index,pager \Co sidebar-open

# Vim-like
bind pager j next-line
bind pager k previous-line
bind index j next-entry
bind index k previous-entry
bind index G last-entry
bind index g noop
bind index gg first-entry

bind index,pager r reply
bind index,pager R group-reply
bind index,pager f forward-message

macro compose H "F pandoc -s -f markdown -t html<enter>y^T^Utext/html<enter>" "Converti in HTML"

# Disable drafts/postponed (avoid IMAP errors)
set postponed = ""
set record = ""
