645d25efa6ef85b5cdd3a8fbde6cf57ac8993f9b — Kiril Vladimirov 1 year, 4 months ago bb833f1
mail: rm -rf

mutt is great and I really wanted to keep reading mails from the
terminal. However, the rest of the world does not agree. Most of the
emails I receive are with rich content and lacking or incomplete plain
version, and I'm not taking part of a project where receiving pull
requests over email is a thing, anyways.

KMail is what I use nowadays, but the configuration there involves
akonadi and storing stuff in relational database.
7 files changed, 1 insertions(+), 217 deletions(-)

M Makefile
D mail/msmtprc
D mail/mutt/bindings
D mail/mutt/gpg.rc
D mail/mutt/mailcap
D mail/mutt/mutt
D mail/mutt/muttrc
M Makefile => Makefile +1 -9
@@ 1,4 1,4 @@
ALL := bash tmux git mercurial vim ipython zsh systemd mutt konsole
ALL := bash tmux git mercurial vim ipython zsh systemd konsole

dotfiles = `pwd`

@@ 39,14 39,6 @@ install-mercurial:
	mkdir -p ~/.config/systemd/user/
	cp $(dotfiles)/systemd/user/* ~/.config/systemd/user/
	sed -i "/Environment\=/c\Environment\=\"DOTFILES\=$(dotfiles)\"" ~/.config/systemd/user/offlineimap.service

	ln -fs $(dotfiles)/mail/mutt/ ~/.mutt
	ln -fs $(dotfiles)/mail/offlineimaprc ~/.offlineimaprc
	ln -fs $(dotfiles)/mail/msmtprc ~/.msmtprc
	mkdir -p ~/.cache/mutt/{headers,bodies,tmp}
	mkdir -p ~/.cache/mutt/{headers,bodies}

	mkdir -p ~/.local/share/konsole/

D mail/msmtprc => mail/msmtprc +0 -12
@@ 1,12 0,0 @@
account personal
host smtp.gmail.com
port 587
protocol smtp
auth on
from kiril@vladimiroff.org
user kiril@vladimiroff.org
passwordeval $HOME/dotfiles/bin/offlineimap.py kdewallet Passwords gmail-personal
tls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt

account default : personal

D mail/mutt/bindings => mail/mutt/bindings +0 -43
@@ 1,43 0,0 @@
# --- Index ---
bind index g       noop
bind index gg      first-entry
bind index G       last-entry
bind index r       group-reply
bind index R       reply
bind index <tab>   sync-mailbox
bind index p       recall-message

macro index <space> "<collapse-thread><refresh>"
macro index \cr "T~U<enter><tag-prefix><clear-flag>N<untag-pattern>.<enter>" "mark all messages as read"

# Sync email
macro index O "<shell-escape>offlineimap<enter>"           "sync all mail"
macro index o "<shell-escape>offlineimap -qf INBOX<enter>" "sync inbox"

# Saner copy/move dialogs
macro index C "<copy-message>?<toggle-mailboxes>" "copy a message to a mailbox"
macro index M "<save-message>?<toggle-mailboxes>" "move a message to a mailbox"

# --- Pager ---
bind pager K  previous-line
bind pager J  next-line
bind pager g  noop
bind pager gg top
bind pager G  bottom
bind pager r  group-reply
bind pager R  reply
bind attach <return> view-mailcap # View attachments properly

macro pager \cb <pipe-entry>'w3m'<enter> 'Follow links in w3m'

# --- Sidebar Navigation ---
bind index,pager \cn sidebar-next
bind index,pager \cp sidebar-prev
bind index,pager \co sidebar-open

# --- Refresh ---
macro index,pager \cl "<refresh><redraw-screen>"

# vim: ft=muttrc

D mail/mutt/gpg.rc => mail/mutt/gpg.rc +0 -44
@@ 1,44 0,0 @@
# decode application/pgp
set pgp_decode_command="gpg --status-fd=2 %?p?--passphrase-fd 0? --no-verbose --quiet --batch --output - %f"

# verify a pgp/mime signature
set pgp_verify_command="gpg --status-fd=2 --no-verbose --quiet --batch --output - --verify %s %f"

# decrypt a pgp/mime attachment
set pgp_decrypt_command="gpg --status-fd=2 %?p?--passphrase-fd 0? --no-verbose --quiet --batch --output - %f"

# create a pgp/mime signed attachment
# set pgp_sign_command="gpg-2comp --comment '' --no-verbose --batch --output - %?p?--passphrase-fd 0? --armor --detach-sign --textmode %?a?-u %a? %f"
set pgp_sign_command="gpg --no-verbose --batch --quiet --output - %?p?--passphrase-fd 0? --armor --detach-sign --textmode %?a?-u %a? %f"

# create a application/pgp signed (old-style) message
# set pgp_clearsign_command="gpg-2comp --comment '' --no-verbose --batch --output - %?p?--passphrase-fd 0? --armor --textmode --clearsign %?a?-u %a? %f"
set pgp_clearsign_command="gpg --no-verbose --batch --quiet --output - %?p?--passphrase-fd 0? --armor --textmode --clearsign %?a?-u %a? %f"

# create a pgp/mime encrypted attachment
# set pgp_encrypt_only_command="pgpewrap gpg-2comp -v --batch --output - --encrypt --textmode --armor --always-trust -- -r %r -- %f"
set pgp_encrypt_only_command="pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --always-trust -- -r %r -- %f"

# create a pgp/mime encrypted and signed attachment
# set pgp_encrypt_sign_command="pgpewrap gpg-2comp %?p?--passphrase-fd 0? -v --batch --output - --encrypt --sign %?a?-u %a? --armor --always-trust -- -r %r -- %f"
set pgp_encrypt_sign_command="pgpewrap gpg %?p?--passphrase-fd 0? --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust -- -r %r -- %f"

# import a key into the public key ring
set pgp_import_command="gpg --no-verbose --import %f"

# export a key from the public key ring
set pgp_export_command="gpg --no-verbose --export --armor %r"

# verify a key
set pgp_verify_key_command="gpg --verbose --batch --fingerprint --check-sigs %r"

# read in the public key ring
set pgp_list_pubring_command="gpg --no-verbose --batch --quiet --with-colons --list-keys %r"

# read in the secret key ring
set pgp_list_secring_command="gpg --no-verbose --batch --quiet --with-colons --list-secret-keys %r"

# This version uses --status-fd messages
set pgp_good_sign="^\\[GNUPG:\\] GOODSIG"

# vim: ft=muttrc

D mail/mutt/mailcap => mail/mutt/mailcap +0 -6
@@ 1,6 0,0 @@
text/html; firefox '%s'; nametemplate=%s.html; copiousoutput
text/*; $EDITOR %s
application/*; xdg-open %s
audio/*; xdg-open %s
image/*; xdg-open %s
video/*; xdg-open %s

D mail/mutt/mutt => mail/mutt/mutt +0 -1
@@ 1,1 0,0 @@
\ No newline at end of file

D mail/mutt/muttrc => mail/mutt/muttrc +0 -102
@@ 1,102 0,0 @@
# --- Paths ---
set folder           = ~/mail
set alias_file       = ~/.mutt/alias
set header_cache     = ~/.cache/mutt/headers
set message_cachedir = ~/.cache/mutt/bodies
set certificate_file = ~/.mutt/certificates
set mailcap_path     = ~/.mutt/mailcap
set tmpdir           = ~/.cache/mutt/tmp

# Default inbox.
set spoolfile = "+personal/INBOX"

# Mailboxes to show in the sidebar.
mailboxes +personal/INBOX \
          +personal/archive \
          +personal/sent \

# --- Basic ---
set wait_key = no
set mbox_type = Maildir
set timeout = 3
unset move

# Don't ask for confirmations
set delete
unset confirmappend
set quit

# Bell on new mails
set beep_new

# Strip headers and eval mimes
set pipe_decode
set thorough_search

# --- Status Bar ---
set status_chars  = " *%A"
set status_format = "───[ Folder: %f ]───[%r%m messages%?n? (%n new)?%?d? (%d to delete)?%?t? (%t tagged)? ]───%>─%?p?( %p postponed )?───"

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

# --- Header ---
ignore *
unhdr_order *
unignore from: to: cc: date: subject:
hdr_order from: to: cc: date: subject:

# --- Index View ---
set date_format = "%Y-%m-%d %I:%M"
set index_format = "[%Z]  %D  %-20.20F  %s"
set sort = threads
set sort_aux = reverse-last-date-received
set sort_re
set reply_regexp = "^(([Rr][Ee]?(\[[0-9]+\])?: *)?(\[[^]]+\] *)?)*"

# --- Pager View ---
set pager_index_lines = 10 # number of index lines to show
set pager_context = 3      # number of context lines to show
set pager_stop             # don't go to next message automatically
set menu_scroll            # scroll in menus
set tilde                  # show tildes like in vim
unset markers              # no ugly plus signs

set quote_regexp = "^( {0,4}[>|:#%]| {0,4}[a-z0-9]+[>|]+)+"
alternative_order text/plain text/enriched text/html

# --- Compose View ---
set realname = "Kiril Vladimiroff"   # who am i?
set envelope_from                    # which from?
set sig_dashes                       # dashes before sig
set edit_headers                     # show headers when composing
set fast_reply                       # skip to compose when replying
set askcc                            # ask for CC:
set fcc_attach                       # save attachments with the body
unset mime_forward                   # forward attachments as part of body
set forward_format = "Fwd: %s"       # format of subject when forwarding
set forward_decode                   # decode when forwarding
set attribution = "On %d, %n wrote:" # format of quoting header
set reply_to                         # reply to Reply to: field
set reverse_name                     # reply as whomever it was to
set include                          # include message in replies
set forward_quote                    # include message in forwards

# --- Send ---
set from     = "kiril@vladimiroff.org"
set sendmail = "/usr/bin/msmtp -a personal"
set sendmail_wait = 0
unset record

# --- GPG ---
source ~/.mutt/gpg.rc
set pgp_use_gpg_agent = yes
set pgp_sign_as = 9B24A670
set pgp_timeout = 3600
set crypt_autosign = yes
set crypt_replyencrypt = yes

source ~/.mutt/bindings