commit 4bd64b575a719e977d355195058402590cec9723
parent e04d6c55a2479e5fcf09c829350cda4dc8f254f5
Author: Alex Balgavy <alex@balgavy.eu>
Date: Mon, 5 Jul 2021 12:26:07 +0200
neomutt: some more fixes for integration with notmuch
Diffstat:
5 files changed, 28 insertions(+), 20 deletions(-)
diff --git a/mutt/muttrc b/mutt/muttrc
@@ -34,6 +34,8 @@ auto_view text/*
set abort_noattach = yes
set abort_noattach_regex = "attach|attached|attachments?"
+# For key bindings, do :exec what-key
+
# Sidebar
set sidebar_visible = yes
set sidebar_width = 20
@@ -41,22 +43,20 @@ set sidebar_short_path = yes
set sidebar_next_new_wrap = yes
set mail_check_stats
set sidebar_format = '%D%?F? [%F]?%* %?N?%N/? %?S?%S?'
-bind index,pager \Ck sidebar-prev
-bind index,pager \Cj sidebar-next
+bind index,pager \Cp sidebar-prev
+bind index,pager \Cn sidebar-next
bind index,pager \Cl sidebar-open
-bind index,pager \Cp sidebar-prev-new
-bind index,pager \Cn sidebar-next-new
bind index,pager B sidebar-toggle-visible
bind index t tag-entry
# Switch ; and : keys
-unbind generic :
-unbind generic ;
-bind generic \; enter-command
+unbind generic,pager :
+unbind generic,pager ;
+bind generic,pager \; enter-command
bind generic : tag-prefix
set date_format = "%d/%m"
-set index_format="%2C %Z %?X?A& ? %D %-15.15F %s (%-4.4c)"
+set index_format="%2C %Z %?X?A& ? %D %-15.15F %s (%-4.4c) %> [%g]"
set sort = threads # like gmail
set sort_aux = reverse-last-date-received # like gmail.
# there's an issue with sorting where messages in threads should be sorted by date, top-to-bottom.
@@ -75,6 +75,7 @@ set tilde # show tildes like in vim
unset markers # no ugly plus signs
set quote_regex = "^( {0,4}[>|:#%]| {0,4}[a-z0-9]+[>|]+)+"
alternative_order text/plain text/enriched text/html
+
bind pager k previous-line
bind pager j next-line
bind pager g noop
@@ -105,7 +106,7 @@ bind attach <return> view-mailcap
bind attach l view-mailcap
# General mappings
-macro index,pager S '<sync-mailbox><shell-escape>notmuch new<enter>'
+macro index,pager S '<sync-mailbox><shell-escape>notmuch-hook<enter>'
bind compose p postpone-message
bind compose l view-attach
bind compose h exit
@@ -135,6 +136,8 @@ bind pager,browser gg top-page
bind pager,browser G bottom-page
bind index,pager,browser \Cd half-down
bind index,pager,browser \Cu half-up
+bind pager <space> half-down
+bind pager \C? half-up # backspace key
bind index \031 previous-undeleted # Mouse wheel
bind index \005 next-undeleted # Mouse wheel
bind pager \031 previous-line # Mouse wheel
diff --git a/mutt/personal b/mutt/personal
@@ -45,8 +45,8 @@ set ssl_starttls = yes
account-hook $folder "set imap_user=$my_personal_email imap_pass=$my_personal_pass_cmd"
# Retrieve new email
-macro index O "<shell-escape>mbsync -c ~/.config/mbsync/mbsyncrc $my_personal_email && notmuch new<enter>" "run mbsync to sync $my_personal_email"
-macro index o "<shell-escape>mbsync -c ~/.config/mbsync/mbsyncrc $my_personal_email:INBOX,Sent && notmuch new<enter>" "run mbsync to sync all mail"
+macro index O "<shell-escape>mbsync -c ~/.config/mbsync/mbsyncrc $my_personal_email && notmuch-hook<enter>" "run mbsync to sync $my_personal_email"
+macro index o "<shell-escape>mbsync -c ~/.config/mbsync/mbsyncrc $my_personal_email:INBOX,Sent && notmuch-hook<enter>" "run mbsync to sync all mail"
# Delete
macro index,pager d "\
diff --git a/mutt/school b/mutt/school
@@ -20,9 +20,9 @@ virtual-mailboxes \
"Inbox (S)" "notmuch://?query=folder:$my_school_email/Inbox" \
"Archive (S)" "notmuch://?query=folder:$my_school_email/Archive" \
"Drafts (S)" "notmuch://?query=folder:$my_school_email/Drafts" \
- "Tickets (S)" "notmuch://?query=folder:$my_school_email/Sent Items" \
- "Trash (S)" "notmuch://?query=folder:$my_school_email/Deleted Items" \
- "Spam (S)" "notmuch://?query=folder:$my_school_email/Junk Email"
+ "Sent (S)" "notmuch://?query='folder:\"$my_school_email/Sent Items\"'" \
+ "Trash (S)" "notmuch://?query='folder:\"$my_school_email/Deleted Items\"'" \
+ "Spam (S)" "notmuch://?query='folder:\"$my_school_email/Junk Email\"'"
set spoolfile = "Inbox (S)"
set header_cache = ~/.cache/mutt/$my_school_email/headers
@@ -42,8 +42,8 @@ set ssl_starttls = yes
account-hook $folder "set imap_user=$my_school_email imap_pass=$my_school_pass_cmd"
# Retrieve new email
-macro index O "<shell-escape>mbsync -c ~/.config/mbsync/mbsyncrc $my_school_email && notmuch new<enter>" "run mbsync to sync $my_school_email"
-macro index o "<shell-escape>mbsync -c ~/.config/mbsync/mbsyncrc $my_school_email:INBOX,'Sent Items' && notmuch new<enter>" "run mbsync to sync all mail"
+macro index O "<shell-escape>mbsync -c ~/.config/mbsync/mbsyncrc $my_school_email && notmuch-hook<enter>" "run mbsync to sync $my_school_email"
+macro index o "<shell-escape>mbsync -c ~/.config/mbsync/mbsyncrc $my_school_email:INBOX,'Sent Items' && notmuch-hook<enter>" "run mbsync to sync all mail"
# Delete
macro index,pager d "\
@@ -62,9 +62,9 @@ macro index,pager u "\
macro index,pager gi "<change-vfolder>Inbox (S)<enter>" "go to Inbox"
macro index,pager ga "<change-vfolder>Archive (S)<enter>" "go to Archive"
macro index,pager gd "<change-vfolder>Drafts (S)<enter>" "go to Drafts"
-macro index,pager gj "<change-vfolder>Junk Email (S)<enter>" "go to Junk Email"
-macro index,pager gt "<change-vfolder>Deleted Items (S)<enter>" "go to Deleted Items"
-macro index,pager gs "<change-vfolder>Sent Items (S)<enter>" "go to Sent Items"
+macro index,pager gj "<change-vfolder>Spam (S)<enter>" "go to Spam"
+macro index,pager gt "<change-vfolder>Trash (S)<enter>" "go to Trash"
+macro index,pager gs "<change-vfolder>Sent (S)<enter>" "go to Sent"
# Moving emails
macro index,pager MI "<modify-labels>+inbox -archive -drafts -spam -trash -sent -unread<enter><save-message>=Inbox<enter>" "move mail to Inbox"
diff --git a/scripts/mailsync b/scripts/mailsync
@@ -1,7 +1,7 @@
#!/bin/sh
rbw unlock
mbsync -c /Users/alex/.config/mbsync/mbsyncrc -Va
-notmuch new
+notmuch-hook
notification_str=""
for i in ~/.local/share/mail/*/[Ii][Nn][Bb][Oo][Xx]/new; do
mailbox_name="$(printf "%s" "$i" | sed 's:^.*mail/::; s:/[Ii][Nn][Bb][Oo][Xx]/new.*$::')"
diff --git a/scripts/notmuch-hook b/scripts/notmuch-hook
@@ -0,0 +1,5 @@
+#!/bin/sh
+notmuch new
+notmuch tag --remove-all +sent -- from:alex@balgavy.eu or from:a.balgavy@gmail.com or from:a.balgavy@student.vu.nl
+notmuch tag --remove-all +drafts -- folder:/Drafts/
+notmuch tag -inbox +spam -- folder:/Spam/ or folder:/Junk/