Add neomutt config. Supports arbitrary amount of accounts

This commit is contained in:
lhark 2019-04-15 23:31:31 -04:00
parent d41f489ea6
commit f9e25c49db
9 changed files with 323 additions and 0 deletions

2
config/neomutt/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*.mail
*.pw.gpg

View file

@ -0,0 +1,15 @@
set my_account = "accountname"
set realname = "Rey"
set from = "rey@millenium.falcon"
alternates "^rey.*@millenium\\.falcon$"
set hostname = "millenium.falcon"
source 'account.rc'
set crypt_autosign
set crypt_opportunistic_encrypt
set pgp_default_key = 7F45D6BB6FEA857F9EA371D4FAB91C843694BBB8
color status blue default
# vim: syntax=neomuttrc

View file

@ -0,0 +1,10 @@
set sendmail = "/usr/bin/msmtp -a $my_account"
set spoolfile = "+$my_account/Inbox"
set record = "+$my_account/Sent"
set postponed = "+$my_account/Draft"
set trash = "+$my_account/Trash"
macro index,pager gs "<shell-escape>mbsync $my_account<enter>"
# vim: syntax=neomuttrc

92
config/neomutt/colors.rc Normal file
View file

@ -0,0 +1,92 @@
# color OBJECT FOREGROUND BACKGROUND
#########
# INDEX #
#########
color index brightcyan default ~N
color index brightyellow default ~F
color index black green ~T
color index brightred default ~D
mono index bold ~N
mono index bold ~F
mono index bold ~T
mono index bold ~D
##############
# HIGHLIGHTS #
##############
color body brightgreen default "(http|ftp|news|telnet|finger)://[^ \"\t\r\n]*"
color body brightgreen default "mailto:[-a-z_0-9.]+@[-a-z_0-9.]+"
color body brightgreen default "[-a-z_0-9.%$]+@[-a-z_0-9.]+\\.[-a-z][-a-z]+"
mono body bold "(http|ftp|news|telnet|finger)://[^ \"\t\r\n]*"
mono body bold "mailto:[-a-z_0-9.]+@[-a-z_0-9.]+"
mono body bold "[-a-z_0-9.%$]+@[-a-z_0-9.]+\\.[-a-z][-a-z]+"
###########
# HEADERS #
###########
color header green default "^from:"
color header green default "^to:"
color header green default "^cc:"
color header green default "^date:"
color header yellow default "^newsgroups:"
color header yellow default "^reply-to:"
color header brightcyan default "^subject:"
color header red default "^x-spam-rule:"
color header yellow default "^message-id:"
color header yellow default "^Organization:"
color header yellow default "^Organisation:"
color header yellow default "^User-Agent:"
color header yellow default "^x-mailer:"
color header yellow default "^message-id: .*pine"
color header yellow default "^X-Fnord:"
color header yellow default "^X-WebTV-Stationery:"
color header yellow default "^X-Message-Flag:"
color header yellow default "^X-Spam-Status:"
color header yellow default "^X-SpamProbe:"
color header red default "^X-SpamProbe: SPAM"
##########
# QUOTES #
##########
color quoted cyan default
color quoted1 yellow default
color quoted2 red default
color quoted3 green default
color quoted4 cyan default
color quoted5 yellow default
color quoted6 red default
color quoted7 green default
###########
# SIDEBAR #
###########
color sidebar_highlight black green # Highlighted, not open
color sidebar_divider default default # divider bar
color sidebar_flagged red default # mailboxes containing flagged mail
color sidebar_new green default # mailboxes containing new mail
color sidebar_ordinary color245 default # normal mailboxes
# Default color definitions
#color hdrdefault white green
color signature brightmagenta default
color indicator black cyan
color attachment black green
color error red default
color message white default
color search brightwhite magenta
color status brightyellow blue
color tree brightblue default
color normal white default
color tilde green default
color bold brightyellow default
#color underline magenta default
color markers brightcyan default
# Colour definitions when on a mono screen
mono bold bold
mono underline underline
mono indicator reverse
# vim: syntax=neomuttrc

10
config/neomutt/folder-hooks.sh Executable file
View file

@ -0,0 +1,10 @@
#!/bin/sh
# Select default account
find ~/.config/neomutt/accounts/ -name "*.mail" -printf "source '%p'\n" -quit
# Setup folder hooks for all the accounts
for f in ~/.config/neomutt/accounts/*.mail; do
account="$(basename -s '.mail' "$f")"
printf 'folder-hook =%s '\''source %s'\''\n' "$account" "$f"
done

13
config/neomutt/gpg.rc Normal file
View file

@ -0,0 +1,13 @@
# Use GPGME
set crypt_use_gpgme
set crypt_replysign
set crypt_replyencrypt
set crypt_replysignencrypted
set crypt_verify_sig
set crypt_opportunistic_encrypt
set pgp_self_encrypt
set smime_self_encrypt
# vim: syntax=neomuttrc

71
config/neomutt/keys.rc Normal file
View file

@ -0,0 +1,71 @@
###########
# GENERAL #
###########
bind index,pager N search-opposite
bind index,pager \Cu half-up
bind index,pager \Cd half-down
bind index,pager g noop # required to define multikeys binds
###########
# SIDEBAR #
###########
bind index,pager \Cj sidebar-next # Highlight next
bind index,pager \Ck sidebar-prev # Highlight previous
bind index,pager \Cl sidebar-open # Open highlighted
# For non vim users, up/down/right also work
bind index,pager B sidebar-toggle-visible # Toggle sidebar
# See also <sidebar-{page-up,page-down,next-new,prev-new}>
#########
# INDEX #
#########
bind index gg first-entry
bind index G last-entry
bind index h noop # display-toggle-weed is rubbish in index view
bind index l display-message
bind index p recall-message
bind index R group-reply
bind index <tab> sync-mailbox
bind index <space> collapse-thread
macro index \Cr "T~U<enter><tag-prefix><clear-flag>N<untag-pattern>.<enter>" "mark all messages as read"
# 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 h exit
bind pager K previous-undeleted
bind pager J next-undeleted
bind pager k previous-line
bind pager j next-line
bind pager gg top
bind pager G bottom
bind pager R group-reply
bind pager gh display-toggle-weed
bind pager ge extract-keys
##########
# ATTACH #
##########
# http://stevelosh.com/blog/2012/10/the-homely-mutt/
bind attach l view-mailcap
###########
# NOTMUCH #
###########
# https://a3nm.net/git/myconfig/file/mutt/muttrc.html
bind index,pager \Cf vfolder-from-query
bind index,pager z entire-thread
# Addresses autocompetion using notmuch
# https://github.com/neomutt/neomutt/issues/629
set query_command = "notmuch address from:%s"
bind editor <Tab> complete-query
bind editor ^T complete
set query_format="%4c %t %-70.70a %-70.70n %?e?(%e)?"
# vim: syntax=neomuttrc

91
config/neomutt/neomuttrc Normal file
View file

@ -0,0 +1,91 @@
# Maildir setup
set mbox_type = Maildir
set copy # See also $record (f*ckin recursion)
set folder = "~/mail"
unmailboxes *
mailboxes = `find ~/mail -mindepth 1 -type d ! -name cur ! -name tmp ! -name new -printf '"%p"\0' | xargs -0`
# Load external configs
source sidebar.rc
source colors.rc
source gpg.rc
source keys.rc
# Accounts
source '~/.config/neomutt/folder-hooks.sh|'
# Basic options
unset wait_key # Only wait if command exited != 0
set mail_check = 0 # minimum time between scans
set delete # delete messages for real
unset confirmappend # don't ask when adding to a mailbox
set quit #default; <quit> exits neomutt
unset move #default; don't move read messages
unset mark_old # don't mark unread mail as old when exiting mailbox
set beep_new # Hope your term bell is set to something sensible :P
set pipe_decode # decode and weed headers before <pipe-message>
set thorough_search #default; decode mail before searching ~b and ~h
set sleep_time = 0 # Speed up folder opening
# Status bar
set status_chars = " *%A" # mailbox unchanged/changed/RO/attach-msg mode
set status_format = "───[ Folder: %f ]───[%r%m messages%?n? (%n new)?%?d? (%d to delete)?%?t? (%t tagged)? ]───%>─%?p?( %p postponed )?───"
#########
# Index #
#########
set date_format = "%d/%m/%y %H:%M"
set index_format = "[%Z] %D - %-20.20F %s"
set sort = threads
set sort_aux = last-date-received
set uncollapse_jump # Jump to unread when unfolding
set sort_re #default; useful for mailbox sort in sidebar
#########
# Pager #
#########
set pager_index_lines = 10 # lines aboves the pager
set pager_context = 3 # lines of context around selected msg in index
set pager_stop # don't jump to next msg when scrolling past the end
set menu_scroll # don't skip to next page when reaching bottom
set tilde # pad blank lines with '~'
unset markers # remove '+' on wrapped lines
set smart_wrap #default; wrap at word boundaries
set quote_regex = "^( {0,4}[>|:#%]| {0,4}[a-z0-9]+[>|]+)+"
# Prefer plaintext and process html through mailcap
alternative_order text/plain text/enriched text/html
auto_view text/html
# Prune headers
ignore *
unignore From To Reply-To Cc Bcc Subject Date
unignore Organization X-Label X-Mailer User-Agent
###########
# Compose #
###########
set use_from # set a From: header
set use_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
set send_charset = utf-8
set sendmail_wait = 0 # wait for msmtp to finish sending
set abort_noattach = ask-yes # warn for missing attachment
set abort_noattach_regex = "\\<(attach(|ed|ments?)|(attaché|attachés|attache|attachons|joint|jointe|joints|jointes|joins|joignons))\\>"
set editor = "vim -c 'set tw=70 et wrap' '+/^$' "
###########
# Browser #
###########
set mask = ".*" # Which files to match

19
config/neomutt/sidebar.rc Normal file
View file

@ -0,0 +1,19 @@
set sidebar_visible
set mail_check_stats # update unread/flagged/total counts
set sidebar_format = '%B%?F? [%!]?%* %?N?%N/?%?S?%S?'
set sidebar_width = 32 # Note: some chars take two columns (chinese)
set sidebar_short_path # Keep only end of mailbox path
set sidebar_component_depth = 0 # nb of parent subdirs to hide
set sidebar_delim_chars = '/.' # mailbox path sep, '.' is used with IMAP
set sidebar_divider_char = '|' # UI separator bar char
set sidebar_folder_indent # indent according to path tree
set sidebar_indent_string = ' '
set sidebar_new_mail_only # Only display mailbox with new/flagged mail
unset sidebar_next_new_wrap # wrap <sidebar-{next,prev}-new> to beginning
unset sidebar_on_right # keep bar on the left
set sidebar_sort_method = 'path' # sort by mailbox path alphabetically
# Override sidebar_new_mail_only
sidebar_whitelist `find ~/mail -mindepth 1 -maxdepth 1 -type d ! -name cur ! -name tmp ! -name new ! -name .notmuch -printf '"%p"\0' | xargs -0`
sidebar_whitelist `find ~/mail -mindepth 1 -type d -iname inbox -printf '"%p"\0' | xargs -0`
# vim: syntax=neomuttrc