dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit 1f6d98d95c092b79ce0ed5523f4c4e5b4746750a
parent 8734af60533610ee27f496da02bbe01d28531729
Author: Alex Balgavy <alex@balgavy.eu>
Date:   Sun,  4 Jul 2021 16:17:14 +0200

neomutt: better integration with notmuch

Before I used just maildirs. Now I use virtual mailboxes and notmuch tags make
more sense.

Diffstat:
Mmutt/muttrc | 14+++++++-------
Mmutt/personal | 73++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------
Mmutt/school | 71++++++++++++++++++++++++++++++++++++++++++++++++-----------------------
3 files changed, 105 insertions(+), 53 deletions(-)

diff --git a/mutt/muttrc b/mutt/muttrc @@ -4,6 +4,9 @@ source `{ [ -f ~/.config/dark-theme ] && printf "colors-dark"; } || printf "colo # Don't ask to press key on shell commands unset wait_key +# Don't move to next message when modifying -- this breaks notmuch macros +set resolve = no + set mbox_type = Maildir set mail_check=0 # minimum time between scans unset mark_old # it's enough to see whats unread @@ -80,7 +83,7 @@ bind pager G bottom bind pager R group-reply bind attach <return> view-mailcap -macro index,pager,attach,compose u "\ +macro index,pager,attach,compose U "\ <enter-command> set my_pipe_decode=\$pipe_decode pipe_decode<Enter>\ <pipe-message> urlview<Enter>\ <enter-command> set pipe_decode=\$my_pipe_decode; unset my_pipe_decode<Enter>" \ @@ -122,8 +125,6 @@ bind index G last-entry bind index gg first-entry bind pager,attach h exit bind pager l view-attachments -bind index D delete-message -bind index U undelete-message bind index L limit bind index h noop bind index l display-message @@ -142,11 +143,10 @@ set query_command = "khard email --parsable %s" bind editor <Tab> complete-query bind editor ^T complete bind index,pager M noop -bind index,pager C noop bind index,pager / search bind index,pager n search-next bind index,pager N search-opposite -macro index a "<limit>all<enter>" +macro index A "<limit>all<enter>" set nm_default_url = "notmuch://`notmuch config get database.path`" bind index,pager + entire-thread @@ -155,8 +155,8 @@ bind index,pager \Cf vfolder-from-query bind index,pager i noop source school folder-hook $folder 'source ~/.config/mutt/school' -macro index,pager is '<sync-mailbox><enter-command>source ~/.config/mutt/school<enter><change-folder>!<enter><check-stats>' "switch to school" +macro index,pager is '<sync-mailbox><enter-command>source ~/.config/mutt/school<enter><change-vfolder>Inbox (S)<enter><check-stats>' "switch to school" source personal folder-hook $folder 'source ~/.config/mutt/personal' -macro index,pager ip '<sync-mailbox><enter-command>source ~/.config/mutt/personal<enter><change-folder>!<enter><check-stats>' "switch to personal" +macro index,pager ip '<sync-mailbox><enter-command>source ~/.config/mutt/personal<enter><change-vfolder>Inbox (P)<enter><check-stats>' "switch to personal" diff --git a/mutt/personal b/mutt/personal @@ -7,10 +7,27 @@ set folder = ~/.local/share/mail/$my_personal_email set postponed = +Drafts set trash = +Trash set record = +Sent -set spoolfile = +Inbox set mbox = +Archive + +# The setup with regular mutt +# set spoolfile = +Inbox +# unmailboxes * +# mailboxes +Inbox +Archive +Drafts +Tickets +Sent +Trash +Spam +# +# But to use notmuch, I need to use virtual mailboxes: +# (it's on the wishlist - https://github.com/neomutt/neomutt/issues/742) unmailboxes * -mailboxes +Inbox +Archive +Drafts +Tickets +Sent +Trash +Spam +unvirtual-mailboxes * +virtual-mailboxes \ + "Inbox (P)" "notmuch://?query=folder:$my_personal_email/Inbox" \ + "Archive (P)" "notmuch://?query=folder:$my_personal_email/Archive" \ + "Drafts (P)" "notmuch://?query=folder:$my_personal_email/Drafts" \ + "Tickets (P)" "notmuch://?query=folder:$my_personal_email/Tickets" \ + "Sent (P)" "notmuch://?query=folder:$my_personal_email/Sent" \ + "Trash (P)" "notmuch://?query=folder:$my_personal_email/Trash" \ + "Spam (P)" "notmuch://?query=folder:$my_personal_email/Spam" +set spoolfile = "Inbox (P)" + set header_cache = '~/.cache/mutt/$my_personal_email/headers' set message_cachedir = '~/.cache/mutt/$my_personal_email/bodies' @@ -27,26 +44,36 @@ set ssl_starttls = yes # Hook -- IMPORTANT! 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,pager A "<save-message>=Archive<enter>" "move mail to Archive" -macro index,pager gi "<change-folder>=Inbox<enter>" "go to Inbox" -macro index,pager ga "<change-folder>=Archive<enter>" "go to Archive" -macro index,pager gd "<change-folder>=Drafts<enter>" "go to Drafts" -macro index,pager gj "<change-folder>=Spam<enter>" "go to Spam" -macro index,pager gt "<change-folder>=Trash<enter>" "go to Trash" -macro index,pager gs "<change-folder>=Sent<enter>" "go to Sent" -macro index,pager MI "<save-message>=Inbox<enter>" "move mail to Inbox" -macro index,pager MA "<save-message>=Archive<enter>" "move mail to Archive" -macro index,pager MD "<save-message>=Drafts<enter>" "move mail to Drafts" -macro index,pager MJ "<save-message>=Spam<enter>" "move mail to Spam" -macro index,pager MT "<save-message>=Trash<enter>" "move mail to Trash" -macro index,pager MS "<save-message>=Sent<enter>" "move mail to Sent" -macro index,pager MM "<save-message>?<toggle-mailboxes>" "move a message to a mailbox" -macro index,pager CI "<copy-message>=Inbox<enter>" "copy mail to Inbox" -macro index,pager CA "<copy-message>=Archive<enter>" "copy mail to Archive" -macro index,pager CD "<copy-message>=Drafts<enter>" "copy mail to Drafts" -macro index,pager CJ "<copy-message>=Spam<enter>" "copy mail to Spam" -macro index,pager CT "<copy-message>=Trash<enter>" "copy mail to Trash" -macro index,pager CS "<copy-message>=Sent<enter>" "copy mail to Sent" -macro index,pager CC "<copy-message>?<toggle-mailboxes>" "copy a message to a mailbox" + +# Delete +macro index,pager d "\ +<delete-message>\ +<modify-labels-then-hide>-inbox -archive -drafts -spam +trash -sent -unread<enter>" + +# Actually delete +bind index,pager D purge-message + +# Undelete +macro index,pager u "\ +<undelete-message>\ +<modify-labels-then-hide>-trash<enter>" + +# Changing folders +macro index,pager gi "<change-vfolder>Inbox (P)<enter>" "go to Inbox" +macro index,pager ga "<change-vfolder>Archive (P)<enter>" "go to Archive" +macro index,pager gd "<change-vfolder>Drafts (P)<enter>" "go to Drafts" +macro index,pager gj "<change-vfolder>Spam (P)<enter>" "go to Spam" +macro index,pager gt "<change-vfolder>Trash (P)<enter>" "go to Trash" +macro index,pager gs "<change-vfolder>Sent (P)<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" +macro index,pager MA "<modify-labels>-inbox +archive -drafts -spam -trash -sent -unread<enter><save-message>=Archive<enter>" "move mail to Archive" +macro index,pager a "<modify-labels>-inbox +archive -drafts -spam -trash -sent -unread<enter><save-message>=Archive<enter>" "move mail to Archive" +macro index,pager MD "<modify-labels>-inbox -archive +drafts -spam -trash -sent -unread<enter><save-message>=Drafts<enter>" "move mail to Drafts" +macro index,pager MJ "<modify-labels>-inbox -archive -drafts +spam -trash -sent -unread<enter><save-message>=Spam<enter>" "move mail to Spam" +macro index,pager MT "<modify-labels>-inbox -archive -drafts -spam +trash -sent -unread<enter><save-message>=Trash<enter>" "move mail to Trash" +macro index,pager MS "<modify-labels>-inbox -archive -drafts -spam -trash +sent -unread<enter><save-message>=Sent<enter>" "move mail to Sent" diff --git a/mutt/school b/mutt/school @@ -7,10 +7,24 @@ set folder = ~/.local/share/mail/$my_school_email/ set postponed = +Drafts set trash = +"Deleted Items" set record = +"Sent Items" -set spoolfile = +Inbox set mbox = +Archive + + +# unmailboxes * +# mailboxes +Inbox +Archive +Drafts +"Sent Items" +"Deleted Items" +"Junk Email" +# set spoolfile = +Inbox +# For notmuch: unmailboxes * -mailboxes +Inbox +Archive +Drafts +"Sent Items" +"Deleted Items" +"Junk Email" +unvirtual-mailboxes * +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" +set spoolfile = "Inbox (S)" + set header_cache = ~/.cache/mutt/$my_school_email/headers set message_cachedir = ~/.cache/mutt/$my_school_email/bodies @@ -27,26 +41,37 @@ set ssl_starttls = yes # Hook -- IMPORTANT! 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,pager A "<save-message>=Archive<enter>" "move mail to Archive" -macro index,pager gi "<change-folder>=Inbox<enter>" "go to Inbox" -macro index,pager ga "<change-folder>=Archive<enter>" "go to Archive" -macro index,pager gd "<change-folder>=Drafts<enter>" "go to Drafts" -macro index,pager gj "<change-folder>=Junk Email<enter>" "go to Junk Email" -macro index,pager gt "<change-folder>=Deleted Items<enter>" "go to Deleted Items" -macro index,pager gs "<change-folder>=Sent Items<enter>" "go to Sent Items" -macro index,pager MI "<save-message>=Inbox<enter>" "move mail to Inbox" -macro index,pager MA "<save-message>=Archive<enter>" "move mail to Archive" -macro index,pager MD "<save-message>=Drafts<enter>" "move mail to Drafts" -macro index,pager MJ "<save-message>=Junk E-Mail<enter>" "move mail to Junk E-Mail" -macro index,pager MT "<save-message>=Deleted Items<enter>" "move mail to Deleted Items" -macro index,pager MS "<save-message>=Sent Items<enter>" "move mail to Sent Items" -macro index,pager MM "<save-message>?<toggle-mailboxes>" "move a message to a mailbox" -macro index,pager CI "<copy-message>=Inbox<enter>" "copy mail to Inbox" -macro index,pager CA "<copy-message>=Archive<enter>" "copy mail to Archive" -macro index,pager CD "<copy-message>=Drafts<enter>" "copy mail to Drafts" -macro index,pager CJ "<copy-message>=Junk E-Mail<enter>" "copy mail to Junk E-Mail" -macro index,pager CT "<copy-message>=Deleted Items<enter>" "copy mail to Deleted Items" -macro index,pager CS "<copy-message>=Sent Items<enter>" "copy mail to Sent Items" -macro index,pager CC "<copy-message>?<toggle-mailboxes>" "copy a message to a mailbox" + +# Delete +macro index,pager d "\ +<delete-message>\ +<modify-labels-then-hide>-inbox -archive -drafts -spam +trash -sent -unread<enter>" + +# Actually delete +bind index,pager D purge-message + +# Undelete +macro index,pager u "\ +<undelete-message>\ +<modify-labels-then-hide>-trash<enter>" + +# Changing folders +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" + +# Moving emails +macro index,pager MI "<modify-labels>+inbox -archive -drafts -spam -trash -sent -unread<enter><save-message>=Inbox<enter>" "move mail to Inbox" +macro index,pager MA "<modify-labels>-inbox +archive -drafts -spam -trash -sent -unread<enter><save-message>=Archive<enter>" "move mail to Archive" +macro index,pager a "<modify-labels>-inbox +archive -drafts -spam -trash -sent -unread<enter><save-message>=Archive<enter>" "move mail to Archive" +macro index,pager MD "<modify-labels>-inbox -archive +drafts -spam -trash -sent -unread<enter><save-message>=Drafts<enter>" "move mail to Drafts" +macro index,pager MJ "<modify-labels>-inbox -archive -drafts +spam -trash -sent -unread<enter><save-message>=Junk Email<enter>" "move mail to Junk Email" +macro index,pager MT "<modify-labels>-inbox -archive -drafts -spam +trash -sent -unread<enter><save-message>=Deleted Items<enter>" "move mail to Deleted Items" +macro index,pager MS "<modify-labels>-inbox -archive -drafts -spam -trash +sent -unread<enter><save-message>=Sent Items<enter>" "move mail to Sent Items" +