#
# System configuration file for NeoMutt
#

# Default list of header fields to weed when displaying.
# Ignore all lines by default...
ignore *

# ... then allow these through.
unignore from: subject to cc date x-mailer x-url user-agent

# Display the fields in this order
hdr_order date from to cc subject

# emacs-like bindings
bind editor    "\e<delete>"    kill-word
bind editor    "\e<backspace>" kill-word

# map delete-char to a sane value
bind editor     <delete>  delete-char

# some people actually like these settings
#set pager_stop
#bind pager <up> previous-line
#bind pager <down> next-line

# Enable the use of threads
set use_threads=threads

# The behavior of this option on the Debian mutt package is
# not the original one because exim4, the default SMTP on Debian
# does not strip bcc headers so this can cause privacy problems;
# see man muttrc for more info
#unset write_bcc
# Postfix and qmail use Delivered-To for detecting loops
unset bounce_delivered

# System-wide CA file managed by the ca-certificates package
set ssl_ca_certificates_file="/etc/ssl/certs/ca-certificates.crt"

# imitate the old search-body function
macro index \eb "<search>~b " "search in message bodies"

# simulate the old url menu
macro index,pager,attach,compose \cb "\
<enter-command> set my_pipe_decode=\$pipe_decode pipe_decode<Enter>\
<pipe-message> urlview<Enter>\
<enter-command> set pipe_decode=\$my_pipe_decode; unset my_pipe_decode<Enter>" \
"call urlview to extract URLs out of a message"

# Show documentation when pressing F1
macro generic,pager <F1> "<shell-escape> zcat /usr/share/doc/neomutt/manual.txt.gz | sensible-pager<Enter>" "show NeoMutt documentation"
# and also F2, as some terminals use F1
macro generic,pager <F2> "<shell-escape> zcat /usr/share/doc/neomutt/manual.txt.gz | sensible-pager<Enter>" "show NeoMutt documentation"

# show the incoming mailboxes list (just like "neomutt -y") and back when pressing "y"
macro index y "<change-folder>?" "show incoming mailboxes list"
macro pager y "<exit><change-folder>?" "show incoming mailboxes list"
bind browser y exit

# Handler for gzip compressed mailboxes
# open-hook   '\.gz$' "gzip --stdout --decompress '%f' >  '%t'"
# close-hook  '\.gz$' "gzip --stdout              '%t' >  '%f'"
# append-hook '\.gz$' "gzip --stdout              '%t' >> '%f'"

bind editor <delete> delete-char

# If NeoMutt is unable to determine your site's domain name correctly, you can
# set the default here. (better: fix /etc/mailname)
#
# set hostname=cs.hmc.edu

# If your sendmail supports the -B8BITMIME flag, enable the following
#
# set use_8bit_mime

# Use mime.types to look up handlers for application/octet-stream. Can
# be undone with unmime_lookup.
mime_lookup application/octet-stream

# Upgrade the progress counter every 250ms, good for mutt over SSH
# see http://bugs.debian.org/537746
set time_inc=250

# Please see the manual (section "attachments")  for detailed
# documentation of the "attachments" command.
#
# Removing a pattern from a list removes that pattern literally. It
# does not remove any type matching the pattern.
#
#  attachments   +A */.*
#  attachments   +A image/jpeg
#  unattachments +A */.*
#
# This leaves "attached" image/jpeg files on the allowed attachments
# list. It does not remove all items, as you might expect, because the
# second */.* is not a matching expression at this time.
#
# Remember: "unattachments" only undoes what "attachments" has done!
# It does not trigger any matching on actual messages.

# Qualify any MIME part with an "attachment" disposition, EXCEPT for
# text/vcard, text/x-vcard, application/pgp.*, application/pkcs7-.* and
# application/x-pkcs7-.* parts. (PGP and S/MIME parts are already known
# to NeoMutt, and can be searched for with ~g, ~G, and ~k.)
attachments   +A */.*
attachments   -A text/vcard text/x-vcard
attachments   -A application/pgp.*
attachments   -A application/pkcs7-.* application/x-pkcs7-.*

# Discount all MIME parts with an "inline" disposition, unless they're
# text/plain. (Why inline a text/plain part unless it's external to the
# message flow?)
attachments   +I text/plain

# These two lines make NeoMutt qualify MIME containers.  (So, for example,
# a message/rfc822 forward will count as an attachment.)  The first
# line is unnecessary if you already have "attach-allow */.*", of
# course.  These are off by default!  The MIME elements contained
# within a message/* or multipart/* are still examined, even if the
# containers themselves don't qualify.
# Recursion into multipart/alternatives containers is controlled by the
# $count_alternatives setting.
#attachments  +A message/.* multipart/.*
#attachments  +I message/.* multipart/.*

# You probably don't really care to know about deleted attachments.
attachments   -A message/external-body
attachments   -I message/external-body

##
source /usr/libexec/neomutt/source-neomuttrc.d|
