Skip to content

Instantly share code, notes, and snippets.

@guiniol
Last active October 27, 2024 09:44
Show Gist options
  • Save guiniol/5109c5bd953af950e0530b720507d704 to your computer and use it in GitHub Desktop.
Save guiniol/5109c5bd953af950e0530b720507d704 to your computer and use it in GitHub Desktop.
neomutt configuration with notmuch
#!/bin/bash
mbsync -Va
notmuch new
notmuch tag +neomutt-devel folder:neomutt and tag:tofilter and to:neomutt-devel
notmuch tag +neomutt-users folder:neomutt and tag:tofilter and to:neomutt-users
notmuch tag +github-issues folder:neomutt and tag:tofilter and from:github.com
notmuch tag -tofilter tag:tofilter and from:[email protected]
COUNT=$(notmuch count tag:tofilter and tag:unread)
notmuch tag -tofilter tag:tofilter
if [ ${COUNT} != 0 ]; then
notify-send -h string:bgcolor:#3579a8 -h string:fgcolor:#d0d0d0 "MAIL MOTHERFUCKER !!" "${COUNT} new messages"
fi
set sidebar_visible = no
function chgdir(dir, crypt)
mutt.set("folder", dir)
mutt.set("spoolfile", dir)
mutt.set("record", dir)
mutt.set("crypt_autosign", crypt)
end
text/html; w3m -I %{charset} -T text/html; copiousoutput;
text/calendar; printics.sh %s; copiousoutput; print=khal import --batch -a [email protected] %s
application/ics; printics.sh %s; copiousoutput; print=khal import --batch -a [email protected] %s
image/*; imv %s
application/pgp-keys; pgp -f < %s ; copiousoutput
application/*; background-xdg-open.sh %s
# color setup
#
# ======================================================================
# INDEX OBJECT PATTERN? pattern description
# index pattern default highlighting of the entire index line
# index_date the date field
# index_flags pattern %S %Z the message flags
# index_number %C the message number
# index_collapsed %M the number of messages in a collapsed thread
# index_author pattern %AaFLn the author name
# index_subject pattern %s the subject line
# index_size %c %l the message size
# index_label %y %Y the message label
# index_tags %g the transformed message tags
# index_tag pattern/tag %G an individual message tag
# ======================================================================
color normal default default
color index_number brightblack default
color index_date magenta default
color index_flags yellow default .
color index_collapsed cyan default
color index green default ~N
color index green default ~v~(~N)
color index red default ~F
color index cyan default ~T
color index blue default ~D
color index_label brightred default
color index_tags red default
color index_tag brightmagenta default "encrypted"
color index_tag brightgreen default "signed"
color index_tag yellow default "attachment"
color body brightwhite default ([a-zA-Z\+]+)://[\-\.,/%~_:?&=\#a-zA-Z0-9]+ # urls
color body green default [\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+ # mail addresses
color attachment yellow default
color signature green default
color search brightred black
color indicator cyan brightblack
color error brightred default
color status brightcyan brightblack
color tree brightcyan default
color tilde cyan default
color progress white red
color sidebar_indicator brightred default
color sidebar_highlight cyan brightblack
color sidebar_divider red default
color sidebar_flagged red default
color sidebar_new green default
color hdrdefault color81 default
color header green default "^Subject: .*"
color header yellow default "^Date: .*"
color header red default "^Tags: .*"
color quoted color60 default
color quoted1 yellow default
color body brightgreen default "Good signature from.*"
color body green default "Fingerprint:( [A-Z0-9]{4}){5} ( [A-Z0-9]{4}){5}"
color body brightred default "Bad signature from.*"
color body brightred default "Note: This key has expired!"
color body brightmagenta default "Problem signature from.*"
color body brightmagenta default "WARNING: .*"
color compose header color81 default
color compose security_both brightgreen default
color compose security_sign brightmagenta default
color compose security_encrypt brightyellow default
color compose security_none brightred default
set realname = "your name"
set from = "[email protected]"
set use_from = yes
set user_agent = yes
set sendmail = "/usr/bin/msmtp"
set editor = "nvim +/^$/+1 +':noh'"
set charset = "utf-8"
set send_charset = "utf-8"
set assumed_charset = "utf-8"
set history_remove_dups = yes
set alias_file = ~/.config/mutt/aliases.muttrc
source ~/.config/mutt/aliases.muttrc
source /usr/share/doc/mutt/vim-keys/vim-keys.rc
source ~/.config/mutt/molokai.muttrc
set header_cache_backend = "gdbm"
set mbox_type = Maildir
set folder = ~/.maildirs/somewhere/neomutt
set header_cache = ~/.cache/mutt
set message_cachedir = $header_cache
set spoolfile = +/
set record = +/
set postponed = +/../draftbox
set sort = 'threads'
set sort_aux = 'last-date-received'
set index_format = " %Z %<[y?%<[m?%<[d?%[ %H:%M]&%[ %a %d]>&%[ %b %d]>&%[%d/%m/%Y]> %-30.30F %<M?(%2M)& > %?GS?%GS& ?%?GE?%GE& ?%?GA?%GA& ? %g %s"
set attach_format = "%u%D%I %t%4n %T%.100d%> [%.15m/%.15M, %.6e%?C?, %C?, %s] "
unset help
ignore *
unignore from date subject to cc bcc
set collapse_unread = yes
set uncollapse_jump = yes
folder-hook . "exec collapse-all"
set wait_key = no
set markers = no
set smart_wrap
set menu_context = 5
set menu_move_off = no
set menu_scroll = yes
set pager_context = 5
set pager_index_lines = 10
set fast_reply = yes
set include = yes
set timeout = 30
set edit_headers = yes
set forward_format = "Fwd: %s"
timeout-hook 'exec sync-mailbox'
shutdown-hook 'exec sync-mailbox'
set crypt_use_gpgme = yes
set pgp_sign_as = YOURKEY
set pgp_self_encrypt_as = YOURKEY
set pgp_self_encrypt = yes
set crypt_verify_sig = yes
set crypt_autosign = yes
set crypt_opportunistic_encrypt = yes
message-hook '!~g !~G ~b "^-----BEGIN PGP (SIGNED )?MESSAGE"' 'exec check-traditional-pgp'
set query_command = "notmuch address %s"
set query_format = "%5c %t %a %n %?e?(%e)?"
set mailcap_path = ~/.config/mutt/mailcap
alternative_order multipart/mixed text/plain text/calendar application/ics text/html
auto_view text/html
auto_view text/calendar
auto_view application/ics
set show_multipart_alternative = "info"
set nm_default_uri = "notmuch:///home/YOU/.maildirs/somewhere"
set virtual_spoolfile=yes
set nm_hidden_tags = "inbox,unread,draft,flagged,passed,replied,signed,encrypted,attachment"
virtual-mailboxes "neomutt" "notmuch://?query=folder:neomutt and NOT tag:archive"
virtual-mailboxes "notmuch" "notmuch://?query=folder:notmuch and NOT tag:archive"
virtual-mailboxes "vfio" "notmuch://?query=folder:vfio and NOT tag:archive"
macro index \\ "<vfolder-from-query>"
macro index,pager A "<modify-labels>+archive -unread -inbox\\n"
bind index,pager + entire-thread
bind index,pager y modify-labels
bind index,pager X change-vfolder
tag-transforms "attachment" "@" \
"encrypted" "" \
"signed" "✎" \
"neomutt-users" "users" \
"neomutt-devel" "devel" \
"github-issues" "gh"
tag-formats "attachment" "GA" \
"encrypted" "GE" \
"signed" "GS"
subscribe [email protected]
subscribe [email protected]
lua-source '~/.config/mutt/folder-hook.lua'
folder-hook neomutt 'lua chgdir("~/.maildirs/somewhere/neomutt", true)'
folder-hook notmuch 'lua chgdir("~/.maildirs/somewhere/notmuch", false)'
folder-hook vfio 'lua chgdir("~/.maildirs/somewhere/vfio", true)'
set mail_check_stats = yes
set sidebar_visible = yes
set sidebar_width = 20
set sidebar_new_mail_only = no
set sidebar_sort_method = 'unsorted'
set sidebar_format = "%B%* %?N?(%N)? %S"
bind index,pager \CJ sidebar-next
bind index,pager \CK sidebar-prev
bind index,pager \CL sidebar-open
bind index <Return> display-message
bind index,pager R group-reply
bind index,pager @ compose-to-sender
bind index u toggle-new
bind index,pager U undelete-message
macro attach s <save-entry><kill-line>/home/YOU/downloads/<enter>y "Save entry"
macro index P '<shell-escape>check-mail.sh >/dev/null 2>&1 &<enter>' "Check for new mails"
macro compose E 'qy<shell-escape>termite -e "zsh -c \"/usr/bin/mutt -F <(cat ~/.config/mutt/muttrc ~/.config/mutt/external-editor.muttrc) -p\"" >/dev/null 2>&1 &<enter>' "Edit in new window"
bind compose R rename-attachment
bind compose \CO rename-file
#!/bin/bash
khal printics --format "
+----------------+
| Calendar Event |
+----------------+
Event........{repeat-symbol}{title}
Location.....{location}
Start........{start-date-long} {start-time-full}
End..........{end-date-long} {end-time-full}
Status.......{status}
Description:
{description}
" ${1} | awk '{if (NR>2) print}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment