diff --git a/office/.config/neomutt/colors b/office/.config/neomutt/colors index bd7d123..9d0fd4c 100644 --- a/office/.config/neomutt/colors +++ b/office/.config/neomutt/colors @@ -48,13 +48,13 @@ color progress black cyan # Formatting ---------------------------------------------------------------------- set date_format = "%a %d %h %H:%M" -set index_format=" %zc %zs %zt | %-35.35L %?X?& ? %M %-30.100s %> %?Y?%Y ? %(!%a %d %h %H:%M) " +set index_format=" %zc %zs %zt | %-20.20L %?X?& ? %M %-30.100s %> %?Y?%Y ? %(!%a %d %h %H:%M) %B" set pager_format="%n %T %s%*  %{!%d %b · %H:%M} %?X? %X?%P" set status_format = " %D %?u? %u ?%?R? %R ?%?d? %d ?%?t? %t ?%?F? %F ?%?p? %p? \n \n" set compose_format="-- NeoMutt: Compose [Approx. msg size: %l Atts: %a]%>-" # set vfolder_format = "%N %?n?%3n& ? %8m  · %f" set attach_format = "%u%D  %T %-75.20d %T  %5s %m/%M" -set sidebar_format = '%B%%* %%S' +set sidebar_format = '%D%%* %%S' index-format-hook attachment_info '=B text/calendar ~X 1' ' ' index-format-hook attachment_info '=B text/calendar' " " index-format-hook attachment_info '~X 1' " " diff --git a/office/.config/neomutt/keys/bind b/office/.config/neomutt/keys/bind index 29f5712..a4ffd65 100644 --- a/office/.config/neomutt/keys/bind +++ b/office/.config/neomutt/keys/bind @@ -42,27 +42,31 @@ macro index K ":set resolve=no:set resolv macro index t ":set resolve=no:set resolve=yes" "tag current thread" macro index T ":set resolve=no:set resolve=yes" "tag current entry" -# flagging -bind index,pager ,F set-flag -bind index,pager ,fc clear-flag -bind index,pager ,\cf clear-flag -bind index,pager ,ff flag-message -bind index ,fs toggle-new # can't toggle new WHILE reading a msg -macro index ,S "T~UN." "mark all messages as read" -bind index,pager ,fl edit-label # set X-Label Header +# # flagging +# bind index,pager ,F modify-labels +# bind index,pager ,fc clear-flag +# bind index,pager ,\cf clear-flag +# bind index,pager ,ff flag-message +# bind index ,fs toggle-new # can't toggle new WHILE reading a msg +# macro index ,S "T~UN." "mark all messages as read" +# bind index,pager ,fl edit-label # set X-Label Header +# # Saner copy/move dialogs +# macro index,pager ,c "?" "copy a message to a mailbox" +# macro index,pager ,m "?" "move thread to a mailbox" +# macro index,pager ,M "?" "move a message to a mailbox" # sorting bind index s sort-mailbox bind index S sort-reverse # threads -bind index l display-message -bind index display-message +macro index l "" "display message" +macro index "" "display message" bind index h collapse-thread bind index collapse-thread # TODO: Remove in favor of learning za? bind pager,index + link-threads bind pager,index - break-thread -bind pager,index gt next-thread +bind pager,index gt next-thread # TODO: overwritten by go to trash bind pager,index gT previous-thread bind pager,index za collapse-thread bind pager,index zA collapse-all @@ -76,13 +80,8 @@ bind index,pager dt delete-subthread bind index,pager u undelete-thread bind index,pager U undelete-message # TODO: Figure out -macro index D ";:set resolve=no!=Archiveecho 'Message deleted':set resolve=yes" "Quick Delete" -macro index A ";:set resolve=no!=Archiveecho 'Message archived':set resolve=yes" "Quick Archive" - -# Saner copy/move dialogs -macro index,pager ,c "?" "copy a message to a mailbox" -macro index,pager ,m "?" "move thread to a mailbox" -macro index,pager ,M "?" "move a message to a mailbox" +# macro index D ";:set resolve=no!=Archiveecho 'Message deleted':set resolve=yes" "Quick Delete" +# macro index A ";:set resolve=no!=Archiveecho 'Message archived':set resolve=yes" "Quick Archive" # search navigation bind generic,index,attach,browser,pager n search-next # next result @@ -176,16 +175,28 @@ bind compose gr group-related bind compose gl group-multilingual bind compose gu ungroup-attachment +# manage attachments macro attach s 'source "neomutt-filer saveto ~/downloads"|' "Save attachment to dir" bind attach view-mailcap bind attach l view-mailcap -# questions -# https://github.com/ceuk/mutt_dotfiles/blob/master/.config/mutt/keys/binds.muttrc -# macro index \# "\n" "Mark as Complete" -# macro index "\n\n" -# macro index x "all\n" "show all messages (undo limit)" -# macro index \ci "~F\n" "Limit by flagged" +# mailbox navigation +macro index,pager gi "Inbox" "go to inbox" +macro index,pager gs "Sent" "go to sent" +macro index,pager gd "Drafts" "go to drafts" +macro index,pager gt "Trash" "go to trash" +macro index,pager ga "Archive" "go to archive" +macro index,pager gr "Receipts" "go to receipts" +macro index,pager gj "Jobs" "go to jobs" + +#### Misc functions and macros + +# Refresh far imap email +macro index,pager O "export MBSYNC_PRE=true; neomutt-syncmail" "refresh all e-mail" + +# Send mail to taskwarrior +macro index,pager ,t "neomutt-2task -c -d -t" "add mail to taskwarrior" +macro index,pager ,T "neomutt-2task -c" "quickadd mail to taskwarrior" # Write (djot-flavored) markdown and instantly transform it into a TXT/HTML result # HTML-enabled email readers display that and others can still enjoy a txt representation @@ -199,38 +210,5 @@ macro compose ,m \ " \ "Convert markdown to HTML5 and plaintext alternative content types" -# -# -# # mailbox navigation -macro index,pager gi "=Inbox" "go to inbox" -# macro index,pager gs "=Sent" "go to sent" -# macro index,pager gd "=Drafts" "go to drafts" -# macro index,pager gt "=Trash" "go to trash" -# macro index,pager ga "=Archive" "go to archive" -# macro index,pager gj "=Junk" "go to junk" -# # pager navigation -# bind pager,attach h exit -# bind pager l view-attachments -# bind pager k previous-line -# bind pager j next-line -# bind pager gg top -# bind pager G bottom -# -# # markdown to html for composition -# # TODO: Check if this is working - F is a spelling mistake no? -# macro compose ,m "F pandoc -s -f markdown -t html \ny^T^Utext/html; charset=UTF-8\n" "Convert from MD to HTML" -# -# -# # since we unbound the original g -# bind index,pager r noop # to avoid accidentally sending replies -# bind index,pager rr group-reply -# bind index,pager ro reply # # open urls found in the e-mail # macro index,pager \CU " unset pipe_decodeextract_url | fzf | clip" "get URLs" -# -# # Refresh far imap email -# macro index O "export MBSYNC_PRE=true; neomutt-syncmail" "refresh all e-mail" -# -# # Send mail to taskwarrior -# macro index,pager ,T "neomutt-2task -c -d -t" "add mail as task to taskwarrior with custom description and tags" -# macro index,pager ,t "neomutt-2task -c" "add mail as task to taskwarrior" diff --git a/office/.config/neomutt/mailcap b/office/.config/neomutt/mailcap index 1f634ff..123dda9 100644 --- a/office/.config/neomutt/mailcap +++ b/office/.config/neomutt/mailcap @@ -19,10 +19,15 @@ video/*; setsid mpv --quiet %s &; copiousoutput # open spreadsheets in sc-im application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; sc-im %s; needsterminal -# open anything else externally -application/pdf; open %s; +# documents +application/pdf; pdftotext -layout %s -; copiousoutput; print=open %s +application/msword; pandoc --from docx --to plain %s; copiousoutput +application/vnd.openxmlformats-officedocument.wordprocessingml.document; pandoc --from odt --to plain %s; copiousoutput +application/rtf; pandoc --from rtf --to plain %s; copiousoutput + -application/*; mkdir -p /tmp/mutt \; cp %s /tmp/mutt \; open /tmp/mutt/$(basename %s) & application/pgp-encrypted; gpg -d '%s'; copiousoutput; application/pgp-keys; gpg --import '%s'; copiousoutput; +# open anything else externally +application/*; mkdir -p /tmp/mutt \; cp %s /tmp/mutt \; open /tmp/mutt/$(basename %s) & diff --git a/office/.config/neomutt/neomuttrc b/office/.config/neomutt/neomuttrc index e768713..202bfc0 100644 --- a/office/.config/neomutt/neomuttrc +++ b/office/.config/neomutt/neomuttrc @@ -5,3 +5,67 @@ source keys/unbind source keys/bind source account + +################## notmuch settings +# index notmuch on start and exit +startup-hook "`command -v notmuch && notmuch new 2>/dev/null`" +shutdown-hook "`command -v notmuch && notmuch new 2>/dev/null`" +# whenever changing directory fetch changes +folder-hook notmuch:// "push 'notmuch new >/dev/null'" + +set nm_query_type = "threads" +set nm_exclude_tags = "spam" +set nm_record = yes +set nm_record_tags = "-inbox,archive" +virtual-mailboxes "Inbox" "notmuch://?query=folder:Inbox" \ + "Unread" "notmuch://?query=tag:unread" \ + "Archive" "notmuch://?query=folder:Archive" \ + "Drafts" "notmuch://?query=folder:Drafts" \ + "Sent" "notmuch://?query=folder:Sent" \ + "Jobs" "notmuch://Jobs?query=folder:Jobs" \ + "Receipts" "notmuch://?query=folder:Receipts" \ + "Junk" "notmuch://?query=folder:Junk" \ + "github" "notmuch://?query=tag:github" \ + "bemoji" "notmuch://?query=tag:bemoji"\ + "All" "notmuch://?query=*"\ + "Trash" "notmuch://?query=folder:Trash" \ + +push 'Inbox' + +virtual-mailboxes "date/" "notmuch://?query=date:today.."\ + " this week" "notmuch://?query=date:week.."\ + " this month" "notmuch://?query=date:month.." + +virtual-mailboxes "attach/" "notmuch://?query=attachment:\.%20not%20attachment:\.pdf"\ + " with PDF" "notmuch://?query=attachment:\.pdf"\ + " with JPG" "notmuch://?query=attachment:\.jpg%20or%20attachment:\.png" + +# bind index,pager S modify-labels # allow +adding -removing !toggling any notmuch tags +# macro index,pager f "+flagged" "Toggle flagged tag" +# +# macro index,pager ,ff "!flaggednotmuch new" "toggle flag" +macro index,pager ,ff "!flagged" "toggle flag" +macro index,pager ,fi "+inbox" "send to inbox" +macro index,pager R " '+trashnotmuch new'" "send to trash" + + +bind index,pager w modify-labels +# macro index A "+archive -unread -inbox" +# macro index I "-inbox -unread" +# macro index S "" + +tag-transforms "unread" "U" +tag-formats "inbox" "GI" \ + "flagged" "GF" \ + "unread" "GU" \ + "test" "Gt" \ + +color index_tags red black +set index_format="%zc %zs %zt | %-20.20L %?X?& ? %M %-30.100s %* %?GF?%GF ? %(!%a %d %h %H:%M)" + +# conditional dates, showing "09:48" for today's msg, "Mon 27 Aug" for this year's msg, +# "22 Dec '24" for previous years +# set index_format="%-30.100s %* %<[y?%<[d?%[%H:%M]&%[%a %d %h]>&%[%d %h \'%y]>" + + +# - [ ] show 'Inbox' etc in index IF we are in query results