mail: Switch aerc for neomutt, simplify maildir

Made mail dir synchronization simpler - only a couple of important
directories will ever get synchronized to the local file system, but
still containing basically all important incoming mails.

Removed aerc and switched it for neomutt. aerc is very nice and needs
little to no configuration but neomutt is, as of this moment, just more
stable and mature. It opens quickly, never crashes, has a nice indexing
and quick e-mail handling behavior and is incredibly customizable.
Basically, once you put in some configuration effort, it is everything
aerc isn't --- and that is good, both have their reasons for existing.
It's just that mutt currently works better for me and will thus be the
e-mail reader of choice from now on.
This commit is contained in:
Marty Oehme 2021-10-10 23:00:16 +02:00
parent aa472ac358
commit f4c3944519
Signed by: Marty
GPG key ID: B7538B8F50A1C800
9 changed files with 190 additions and 329 deletions

View file

@ -1,7 +1,6 @@
# zsh plugins
acpid
activitywatch-bin
aerc
afew
alacritty
alias-tips-git
@ -106,6 +105,7 @@ mpv
mpv-mpris
nano
needrestart
neomutt
neovim
neovim-nightly
nerd-fonts-fira-code

View file

@ -1,9 +0,0 @@
[Personal]
source = notmuch://~/documents/mail
outgoing = smtp+plain://marty.oehme%40gmail.com@smtp.gmail.com:587
outgoing-cred-cmd = pass 'misc/aerc-gmail-app-password' | head -1
default = Inbox
smtp-starttls = yes
from = Marty Oehme <marty.oehme@gmail.com>
copy-to = Sent
query-map = ~/.config/aerc/notmuch-querymap

View file

@ -1,191 +0,0 @@
#
# aerc main configuration
[ui]
#
# Describes the format for each row in a mailbox view. This field is compatible
# with mutt's printf-like syntax.
#
# Default: %D %-17.17n %Z %s
index-format=%D %-30.30n %Z %s
#
# See time.Time#Format at https://godoc.org/time#Time.Format
#
# Default: 2006-01-02 03:04 PM (ISO 8601 + 12 hour time)
# timestamp-format=2006-01-02 03:04 PM
timestamp-format=06 Mon Jan 02 15:04
#
# Width of the sidebar, including the border.
#
# Default: 20
sidebar-width=20
#
# Message to display when viewing an empty folder.
#
# Default: (no messages)
empty-message=(no messages)
# Message to display when no folders exists or are all filtered
#
# Default: (no folders)
empty-dirlist=(no folders)
# Enable mouse events in the ui, e.g. clicking and scrolling with the mousewheel
#
# Default: false
mouse-enabled=true
#
# Ring the bell when new messages are received
#
# Default: true
new-message-bell=true
# Marker to show before a pinned tab's name.
#
# Default: `
pinned-tab-marker='`'
# Describes the format string to use for the directory list
#
# Default: %n %>r
dirlist-format=%n %>r
# List of space-separated criteria to sort the messages by, see *sort*
# command in *aerc*(1) for reference. Prefixing a criterion with "-r "
# reverses that criterion.
#
# Example: "from -r date"
#
# Default: ""
sort=-r date
# Moves to next message when the current message is deleted
#
# Default: true
next-message-on-delete=true
[viewer]
#
# Specifies the pager to use when displaying emails. Note that some filters
# may add ANSI codes to add color to rendered emails, so you may want to use a
# pager which supports ANSI codes.
#
# Default: less -R
pager=less -R
#
# If an email offers several versions (multipart), you can configure which
# mimetype to prefer. For example, this can be used to prefer plaintext over
# html emails.
#
# Default: text/plain,text/html
alternatives=text/plain,text/html
#
# Default setting to determine whether to show full headers or only parsed
# ones in message viewer.
#
# Default: false
show-headers=false
#
# Layout of headers when viewing a message. To display multiple headers in the
# same row, separate them with a pipe, e.g. "From|To". Rows will be hidden if
# none of their specified headers are present in the message.
#
# Default: From|To,Cc|Bcc,Date,Subject
header-layout=From|To,Cc|Bcc,Date,Subject
# Whether to always show the mimetype of an email, even when it is just a single part
#
# Default: false
always-show-mime=false
# How long to wait after the last input before auto-completion is triggered.
#
# Default: 250ms
completion-delay=0ms
#
# Global switch for completion popovers
#
# Default: true
completion-popovers=true
[compose]
#
# Specifies the command to run the editor with. It will be shown in an embedded
# terminal, though it may also launch a graphical window if the environment
# supports it. Defaults to $EDITOR, or vi.
editor=
#
# Default header fields to display when composing a message. To display
# multiple headers in the same row, separate them with a pipe, e.g. "To|From".
#
# Default: To|From,Subject
header-layout=To|From,Subject,Cc|Bcc
#
# Specifies the command to be used to tab-complete email addresses. Any
# occurrence of "%s" in the address-book-cmd will be replaced with what the
# user has typed so far.
#
# The command must output the completions to standard output, one completion
# per line. Each line must be tab-delimited, with an email address occurring as
# the first field. Only the email address field is required. The second field,
# if present, will be treated as the contact name. Additional fields are
# ignored.
address-book-cmd=mail-searchcontacts %s
[filters]
#
# Filters allow you to pipe an email body through a shell command to render
# certain emails differently, e.g. highlighting them with ANSI escape codes.
#
# The first filter which matches the email's mimetype will be used, so order
# them from most to least specific.
#
# You can also match on non-mimetypes, by prefixing with the header to match
# against (non-case-sensitive) and a comma, e.g. subject,text will match a
# subject which contains "text". Use header,~regex to match against a regex.
subject,~^\[PATCH=awk -f /usr/share/aerc/filters/hldiff
text/html=/usr/share/aerc/filters/html
text/*=awk -f /usr/share/aerc/filters/plaintext
image/*=feh -
application/pdf=zathura -
[triggers]
#
# Triggers specify commands to execute when certain events occur.
#
# Example:
# new-email=exec notify-send "New email from %n" "%s"
#
# Executed when a new email arrives in the selected folder
new-email=
[templates]
# Templates are used to populate email bodies automatically.
#
# The directories where the templates are stored. It takes a colon-separated
# list of directories.
#
# default: /usr/share/aerc/templates/
template-dirs=/usr/share/aerc/templates/
# The template to be used for quoted replies.
#
# default: quoted_reply
quoted-reply=quoted_reply
# The template to be used for forward as body.
#
# default: forward_as_body
forwards=forward_as_body

View file

@ -1,115 +0,0 @@
# Binds are of the form <key sequence> = <command to run>
# To use '=' in a key sequence, substitute it with "Eq": "<Ctrl+Eq>"
# If you wish to bind #, you can wrap the key sequence in quotes: "#" = quit
gT = :prev-tab<Enter>
gt = :next-tab<Enter>
<C-t> = :term<Enter>
gR = :exec mail-check<Enter>
[messages]
q = :quit<Enter>
j = :next<Enter>
<Down> = :next<Enter>
<C-d> = :next 50%<Enter>
<C-f> = :next 100%<Enter>
<PgDn> = :next -s 100%<Enter>
k = :prev<Enter>
<Up> = :prev<Enter>
<C-u> = :prev 50%<Enter>
<C-b> = :prev 100%<Enter>
<PgUp> = :prev -s 100%<Enter>
gg = :select 0<Enter>
G = :select -1<Enter>
c = :cf<space>
<C-n> = :next-folder<Enter>
<C-p> = :prev-folder<Enter>
'' = :cf Inbox<Enter>
'i = :cf Important<Enter>
'a = :cf Archive<Enter>
'A = :cf All<Enter>
's = :cf Sent<Enter>
't = :cf Trash<Enter>
v = :mark -t<Enter>
V = :mark -v<Enter>
<Enter> = :view<Enter>
l = :view<Enter>
D = :prompt 'Really delete this message?' 'delete-message'<Enter>
mi = :modify-labels +inbox -dump -deleted<Enter>
mm = :modify-labels +flagged<Enter>
mM = :modify-labels -flagged<Enter>
dd = :modify-labels +deleted -inbox -dump<Enter>
ma = :modify-labels -inbox -deleted -dump<Enter>
md = :modify-labels +dump -inbox<Enter>
C = :compose<Enter>
rr = :reply -a<Enter>
rq = :reply -aq<Enter>
Rr = :reply<Enter>
Rq = :reply -q<Enter>
$ = :term<space>
! = :term<space>
| = :pipe<space>
/ = :search<space>
\ = :filter<space>
n = :next-result<Enter>
N = :prev-result<Enter>
[view]
q = :close<Enter>
| = :pipe<space>
D = :delete<Enter>
S = :save<space>
A = :archive flat<Enter>
f = :forward<Enter>
rr = :reply -a<Enter>
rq = :reply -aq<Enter>
Rr = :reply<Enter>
Rq = :reply -q<Enter>
H = :toggle-headers<Enter>
<C-p> = :prev-part<Enter>
<C-n> = :next-part<Enter>
J = :next<Enter>
K = :prev<Enter>
[compose]
# Keybindings used when the embedded terminal is not selected in the compose
# view
$ex = <C-x>
<C-k> = :prev-field<Enter>
<C-j> = :next-field<Enter>
<tab> = :next-field<Enter>
[compose::editor]
# Keybindings used when the embedded terminal is selected in the compose view
$noinherit = true
$ex = <C-x>
<C-k> = :prev-field<Enter>
<C-j> = :next-field<Enter>
<C-p> = :prev-tab<Enter>
<C-n> = :next-tab<Enter>
[compose::review]
# Keybindings used when reviewing a message to be sent
y = :send<Enter>
n = :abort<Enter>
p = :postpone<Enter>
q = :abort<Enter>
e = :edit<Enter>
a = :attach<space>
[terminal]
$noinherit = true
$ex = <C-x>
<C-p> = :prev-tab<Enter>
<C-n> = :next-tab<Enter>

View file

@ -1,7 +0,0 @@
All=*
Inbox=tag:inbox and not tag:dump
Archive=not tag:inbox and not tag:deleted and not tag:dump
Dump=tag:dump
Trash=tag:deleted
Important=tag:flagged
Sent=from:marty.oehme@gmail.com or from:marty.oehme@googlemail.com or from:moehme@ruc.dk or from:mo82rimu@studserv.uni-leipzig.de

View file

@ -25,13 +25,44 @@ Inbox ~/documents/mail/Inbox
# define generous maximum size to store locally
MaxSize 50M
Channel gmail
Far :gmail-remote:
Near :mail-local:
Channel gmail-inbox
Far :gmail-remote:INBOX
Near :mail-local:inbox
# Exclude everything under the internal [Gmail] folder, except the interesting folders
Patterns * ![Gmail]* "[Gmail]/Sent Mail" "[Gmail]/Starred" "[Gmail]/All Mail" "[Gmail]/Trash"
#Patterns *
# Automatically create missing mailboxes, both locally and on the server
Create Both
Create Near
# Save the synchronization state files in the relevant directory
SyncState *
Channel gmail-sent
Far :gmail-remote:"[Google Mail]/Sent Mail"
Near :mail-local:sent
Create Near
Channel gmail-trash
Far :gmail-remote:"[Google Mail]/Trash"
Near :mail-local:trash
Create Near
Channel gmail-important
Far :gmail-remote:"[Google Mail]/Starred"
Near :mail-local:important
Create Near
Channel gmail-drafts
Far :gmail-remote:"[Google Mail]/Drafts"
Near :mail-local:drafts
Create Near
Channel gmail-all
Far :gmail-remote:"[Google Mail]/All Mail"
Near :mail-local:archive
Create Near
# Put all the channels into one group
Group googlemail
Channel gmail-inbox
Channel gmail-important
Channel gmail-sent
Channel gmail-trash
Channel gmail-all

View file

@ -0,0 +1,8 @@
text/html; $BROWSER %s
text/html; w3m -I %{charset} -T text/html -dump; copiousoutput;
video/*; setsid umpv --quiet %s &; copiousoutput
audio/*; mpv %s ;
application/*; mkdir -p /tmp/mutt \; cp %s /tmp/mutt \; xdg-open /tmp/mutt/$(basename %s) &
text/plain; $EDITOR %s ;
application/pgp-encrypted; gpg -d '%s'; copiousoutput;
application/pgp-keys; gpg --import '%s'; copiousoutput;

View file

@ -0,0 +1,140 @@
# Identity
#
set realname = "Marty Oehme"
set from = "marty.oehme@gmail.com"
# # If you have another address:
# alternates "^neomutt@example\.com$"
# # Or, if you use the entire domain:
# alternates "@example\.com$"
# set reverse_name
# Account settings
# local maildir settings
set mbox_type = Maildir
set folder = ~/documents/mail # This has the shortcut '+' or '='
set spoolfile = "+inbox" # This has the shortcut '!'
set postponed = "+drafts"
set trash = "+trash"
# Disable saving outgoing mail since Gmail saves them by default.
unset record
mailboxes ! \
"+important" \
"+sent" \
"+drafts" \
"+trash" \
"+archive"
set mail_check = 60
set mail_check_stats
# Basic settings
set quit # at least for rapid prototyping
unset mark_old # things should only be new/unread or I actually looked at them
set pipe_decode # get rid of headers when passing messages along
set wait_key = no # don't wait for user input after shell cmds, auto-view, piping, etc
# set
set sort_re # thread based on regex below
# set reply_regex = "^(([Rr][Ee]?(\[[0-9]+\])?: *)?(\[[^]]+\] *)?)*"
# display
set sort = threads
set sort_aux = reverse-last-date-received
set date_format = "%z/%m/%d %I:%M%p"
# set date_format = "%m/%d"
set index_format = "%4C [%Z] %{%y/%b %d} %-20.20F %s"
# sidebar view options
set sidebar_visible = yes
set sidebar_width = 18
set sidebar_format = "%B%?F? [%F]?%* %?N?%N/?%S"
color sidebar_new color221 color233
# statusbar view options
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 )?───"
# pager view options
set pager_index_lines = 5
set pager_context = 3
set pager_stop # do not go to next msg if at bottom of pager
set menu_scroll = yes
set tilde # show tildes for blank lines
unset markers # no + markers for wrapped stuff
# hide headers except for those explicitly unignored
ignore *
unignore From To Cc Bcc Date Subject Message-ID
unhdr_order *
unignore From To Cc Bcc Date Subject Message-ID
# index navigation
bind index,pager g noop # don't send group-replies with g
bind index gg first-entry
bind index G last-entry
bind index <space> collapse-thread
# mailbox navigation
macro index,pager gi "<change-folder>=inbox<enter>" "go to inbox"
macro index,pager gm "<change-folder>=important<enter>" "go to important"
macro index,pager gs "<change-folder>=sent<enter>" "go to sent"
macro index,pager gd "<change-folder>=drafts<enter>" "go to drafts"
macro index,pager gt "<change-folder>=trash<enter>" "go to trash"
# sidebar navigation
bind index,pager <down> sidebar-next
bind index,pager <up> sidebar-prev
bind index,pager <right> sidebar-open
# bind index,pager \CO sidebar-open
# pager navigation
bind pager k previous-line
bind pager j next-line
bind pager gg top
bind pager G bottom
# since we unbound the original g
bind index,pager R group-reply
# mark all read
macro index \CN "T~U<enter><tag-prefix><clear-flag>N<untag-pattern>.<enter>" "mark all messages as read"
# open urls found in the e-mail
macro pager \CU "|urlview<enter>" "call urlview to open links"
# Sync email
macro index O "<sync-mailbox><shell-escape>mbsync -c $XDG_CONFIG_HOME/isync/mbsyncrc -a<enter><sync-mailbox>" "refresh all e-mail"
macro index o "<sync-mailbox><shell-escape>mbsync -c $XDG_CONFIG_HOME/isync/mbsyncrc gmail-inbox<enter><sync-mailbox>" "refresh inbox e-mail"
# 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 settings
# filetypes and mailcap
set mailcap_path = "~/.config/neomutt/mailcap:~/.mailcap:/usr/share/neomutt/mailcap:/etc/mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap"
# Prefer plain text to html.
# However, for brain dead clients that bundle attachments inside a
# multipart/alternative, prefer that alternative.
alternative_order multipart/mixed multipart/related text/plain
alternative_order text/plain text/enriched text/html
# Consult mime.types for determining types of these attachments
mime_lookup application/octet-stream
# This requires a ~/.mailcap entry with the copiousoutput flag, such as:
# text/html; lynx -dump -width ${COLUMNS:-80} %s; nametemplate=%s.html; copiousoutput
auto_view text/html
# Remember to `mkdir -p ~/.neomutt/hcache` first:
set header_cache= "~/.neomutt/hcache"
###############
# Message composition settings
#
set edit_headers
# set editor = "emacsclient -a emacs -t"
# set editor = "vim"
set mime_type_query_command = "xdg-mime query filetype"
# msmtp is a solid SMTP client.
# neomutt also has built-in SMTP, or you can use an MTA like exim4 or postfix.
set sendmail = "/usr/bin/msmtp"
# lbdb is a versatile contact query tool.
# Invoke via ctrl-t in an address prompt
set query_command = "/usr/bin/lbdbq"

View file

@ -0,0 +1,4 @@
#!/usr/bin/env sh
# Ensure the neomutt cache directories exist
[ -d "${XDG_CACHE_HOME:-~/.cache}/neomutt" ] || mkdir -p "${XDG_CACHE_HOME:-~/.cache}/neomutt/hcache"