neomutt: Add display and bind changes

This commit is contained in:
Marty Oehme 2025-09-17 16:48:43 +02:00
parent b52d58dd58
commit 87bc21ef19
Signed by: Marty
GPG key ID: 4E535BC19C61886E
4 changed files with 109 additions and 62 deletions

View file

@ -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%<F? [%F]>%* %<Z?%Z/>%S'
set sidebar_format = '%D%<F? [%F]>%* %<Z?%Z/>%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' " "

View file

@ -42,27 +42,31 @@ macro index K ":set resolve=no<enter><tag-thread><previous-undeleted>:set resolv
macro index t ":set resolve=no<enter><tag-thread>:set resolve=yes<enter>" "tag current thread"
macro index T ":set resolve=no<enter><tag-entry>:set resolve=yes<enter>" "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~U<enter><tag-prefix><clear-flag>N<untag-pattern>.<enter>" "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~U<enter><tag-prefix><clear-flag>N<untag-pattern>.<enter>" "mark all messages as read"
# bind index,pager ,fl edit-label # set X-Label Header
# # Saner copy/move dialogs
# macro index,pager ,c "<copy-message>?<toggle-mailboxes>" "copy a message to a mailbox"
# macro index,pager ,m "<tag-thread><tag-prefix><save-message>?<toggle-mailboxes>" "move thread to a mailbox"
# macro index,pager ,M "<save-message>?<toggle-mailboxes>" "move a message to a mailbox"
# sorting
bind index <space>s sort-mailbox
bind index <space>S sort-reverse
# threads
bind index l display-message
bind index <return> display-message
macro index l "<display-message><skip-headers>" "display message"
macro index <return> "<display-message><skip-headers>" "display message"
bind index h collapse-thread
bind index <space><space> 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<enter><clear-flag>!<save-message>=Archive<enter><enter><sync-mailbox><enter><enter-command>echo 'Message deleted'<enter>:set resolve=yes<enter>" "Quick Delete"
macro index A ";:set resolve=no<enter><clear-flag>!<save-message>=Archive<enter><enter><sync-mailbox><enter><enter-command>echo 'Message archived'<enter>:set resolve=yes<enter>" "Quick Archive"
# Saner copy/move dialogs
macro index,pager ,c "<copy-message>?<toggle-mailboxes>" "copy a message to a mailbox"
macro index,pager ,m "<tag-thread><tag-prefix><save-message>?<toggle-mailboxes>" "move thread to a mailbox"
macro index,pager ,M "<save-message>?<toggle-mailboxes>" "move a message to a mailbox"
# macro index D ";:set resolve=no<enter><clear-flag>!<save-message>=Archive<enter><enter><sync-mailbox><enter><enter-command>echo 'Message deleted'<enter>:set resolve=yes<enter>" "Quick Delete"
# macro index A ";:set resolve=no<enter><clear-flag>!<save-message>=Archive<enter><enter><sync-mailbox><enter><enter-command>echo 'Message archived'<enter>:set resolve=yes<enter>" "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 '<enter-command>source "neomutt-filer saveto ~/downloads"|<enter>' "Save attachment to dir"
bind attach <return> view-mailcap
bind attach l view-mailcap
# questions
# https://github.com/ceuk/mutt_dotfiles/blob/master/.config/mutt/keys/binds.muttrc
# macro index \# "<edit-label>\n" "Mark as Complete"
# macro index <return> "<display-message>\n<skip-headers>\n"
# macro index x "<limit>all\n" "show all messages (undo limit)"
# macro index \ci "<limit>~F\n" "Limit by flagged"
# mailbox navigation
macro index,pager gi "<change-vfolder>Inbox<enter>" "go to inbox"
macro index,pager gs "<change-vfolder>Sent<enter>" "go to sent"
macro index,pager gd "<change-vfolder>Drafts<enter>" "go to drafts"
macro index,pager gt "<change-vfolder>Trash<enter>" "go to trash"
macro index,pager ga "<change-vfolder>Archive<enter>" "go to archive"
macro index,pager gr "<change-vfolder>Receipts<enter>" "go to receipts"
macro index,pager gj "<change-vfolder>Jobs<enter>" "go to jobs"
#### Misc functions and macros
# Refresh far imap email
macro index,pager O "<sync-mailbox><shell-escape>export MBSYNC_PRE=true; neomutt-syncmail<enter>" "refresh all e-mail"
# Send mail to taskwarrior
macro index,pager ,t "<pipe-message>neomutt-2task -c -d -t<enter>" "add mail to taskwarrior"
macro index,pager ,T "<pipe-message>neomutt-2task -c<enter>" "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 \
<tag-entry><previous-entry><tag-entry><group-alternatives>" \
"Convert markdown to HTML5 and plaintext alternative content types"
#
#
# # mailbox navigation
macro index,pager gi "<change-folder>=Inbox<enter>" "go to inbox"
# 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"
# macro index,pager ga "<change-folder>=Archive<enter>" "go to archive"
# macro index,pager gj "<change-folder>=Junk<enter>" "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 "<enter-command> unset pipe_decode<enter><pipe-message>extract_url | fzf | clip<enter>" "get URLs"
#
# # Refresh far imap email
# macro index O "<sync-mailbox><shell-escape>export MBSYNC_PRE=true; neomutt-syncmail<enter>" "refresh all e-mail"
#
# # Send mail to taskwarrior
# macro index,pager ,T "<pipe-message>neomutt-2task -c -d -t<enter>" "add mail as task to taskwarrior with custom description and tags"
# macro index,pager ,t "<pipe-message>neomutt-2task -c<enter>" "add mail as task to taskwarrior"

View file

@ -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) &

View file

@ -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 '<shell-escape>notmuch new >/dev/null<enter>'"
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 '<change-vfolder>Inbox<enter>'
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 "<modify-labels>+flagged" "Toggle flagged tag"
#
# macro index,pager ,ff "<modify-labels>!flagged<enter><sync-mailbox><shell-escape>notmuch new<enter>" "toggle flag"
macro index,pager ,ff "<modify-labels>!flagged<enter>" "toggle flag"
macro index,pager ,fi "<modify-labels>+inbox<enter><sync-mailbox>" "send to inbox"
macro index,pager R "<push> '<modify-labels>+trash<enter><shell-escape>notmuch new<enter>'" "send to trash"
bind index,pager w modify-labels
# macro index A "<modify-labels>+archive -unread -inbox<enter>"
# macro index I "<modify-labels>-inbox -unread<enter>"
# macro index S "<modify-labels>"
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