From 78987c493ec03e8f2e70e41e22c7234990c9c2c4 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 12 Dec 2023 12:37:13 +0100 Subject: [PATCH] mutt: Update neomutt configuration Changed some colors, some keymaps and made it more flexible for new mail account setups. Also removed most of the static gmail-related account stuff since I don't need this in my public repo. --- office/.config/isync/mbsyncrc | 58 +------------------------- office/.config/msmtp/config | 6 +-- office/.config/neomutt/account | 19 ++++----- office/.config/neomutt/colors | 6 +-- office/.config/neomutt/mailcap | 6 +-- office/.config/neomutt/maps | 23 +++++----- office/.config/neomutt/profile.gmail | 2 + office/.config/neomutt/profile.private | 2 + office/.config/neomutt/settings | 11 +---- 9 files changed, 36 insertions(+), 97 deletions(-) create mode 100644 office/.config/neomutt/profile.gmail create mode 100644 office/.config/neomutt/profile.private diff --git a/office/.config/isync/mbsyncrc b/office/.config/isync/mbsyncrc index be558c8..327e852 100644 --- a/office/.config/isync/mbsyncrc +++ b/office/.config/isync/mbsyncrc @@ -1,68 +1,12 @@ # documentation: https://wiki.archlinux.org/index.php/isync -IMAPAccount gmail -# Address to connect to -Host imap.gmail.com -UserCmd "pass show misc/gmail-app-password | grep username | cut -d: -f2" -PassCmd "pass show misc/gmail-app-password | head -n1" -# To store the password in an encrypted file use PassCmd instead of Pass -# PassCmd "gpg2 -q --for-your-eyes-only --no-tty -d ~/.mailpass.gpg" -# -# Use SSL TLSType IMAPS -CertificateFile /etc/ssl/certs/ca-certificates.crt -# Throttle simultaneous access to make google happy -PipelineDepth 60 -IMAPStore gmail-remote -Account gmail -MaildirStore mail-local -Subfolders Verbatim -# The trailing "/" is important Path ~/documents/mail/ Inbox ~/documents/mail/Inbox -# define generous maximum size to store locally +SubFolders Verbatim MaxSize 50M -Channel gmail-inbox -Far :gmail-remote:INBOX -Near :mail-local:inbox -# Exclude everything under the internal [Gmail] folder, except the interesting folders -# Automatically create missing mailboxes, both locally and on the server -Create Near -# Save the synchronization state files in the relevant directory SyncState * -Channel gmail-sent -Far :gmail-remote:"[Google Mail]/Sent Mail" -Near :mail-local:sent -Create Near - -Channel gmail-trash -Far :gmail-remote:"[Google Mail]/Trash" -Near :mail-local:trash -Create Near - -Channel gmail-important -Far :gmail-remote:"[Google Mail]/Starred" -Near :mail-local:important -Create Near - -Channel gmail-drafts -Far :gmail-remote:"[Google Mail]/Drafts" -Near :mail-local:drafts -Create Near - -Channel gmail-all -Far :gmail-remote:"[Google Mail]/All Mail" -Near :mail-local:archive -Create Near - -# Put all the channels into one group -Group googlemail -Channel gmail-inbox -Channel gmail-important -Channel gmail-sent -Channel gmail-trash -Channel gmail-all diff --git a/office/.config/msmtp/config b/office/.config/msmtp/config index fd173cb..cfa1484 100644 --- a/office/.config/msmtp/config +++ b/office/.config/msmtp/config @@ -2,17 +2,17 @@ defaults auth on tls on +# disable starttls to use whole connection through ssl +tls_starttls off tls_trust_file /etc/ssl/certs/ca-certificates.crt # logfile ~/.msmtp.log # Gmail account personal-gmail +tls_starttls on host smtp.gmail.com port 587 from marty.oehme@gmail.com -user marty.oehme@gmail.com -# password plain-text-password-goes-here passwordeval "pass show misc/gmail-app-password | head -n1" # Set a default account -account default : personal-gmail diff --git a/office/.config/neomutt/account b/office/.config/neomutt/account index 9ee034c..9abd8b7 100644 --- a/office/.config/neomutt/account +++ b/office/.config/neomutt/account @@ -2,15 +2,14 @@ # local maildir settings set mbox_type = Maildir set folder = ~/documents/mail # This has the shortcut '+' or '=' -set spoolfile = "+inbox" # This has the shortcut '!' -set postponed = "+drafts" -set trash = "+trash" -# Disable saving outgoing mail since Gmail saves them by default. -unset record +set spoolfile = "+Inbox" # This has the shortcut '!' +set postponed = "+Drafts" +set record = "+Sent" +set trash = "+Trash" mailboxes ! \ - "+important" \ - "+sent" \ - "+drafts" \ - "+trash" \ - "+archive" + "+Sent" \ + "+Drafts" \ + "+Trash" \ + "+Archive" \ + "+Junk" diff --git a/office/.config/neomutt/colors b/office/.config/neomutt/colors index 03216b7..866d471 100644 --- a/office/.config/neomutt/colors +++ b/office/.config/neomutt/colors @@ -62,8 +62,8 @@ color index_number blue default color index_subject cyan default '.*' # For new mail: -color index brightyellow black "~N" -color index_author brightred black "~N" +color index brightyellow brightblack "~N" +color index_author brightred brightblack "~N" color index_subject brightcyan black "~N" color progress black cyan @@ -155,7 +155,7 @@ color attachment color8 default color signature color8 default # emails -# color body color14 default '[\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+' +color body color14 default '[\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+' # hide "mailto" color body color0 color0 '' diff --git a/office/.config/neomutt/mailcap b/office/.config/neomutt/mailcap index d1afae9..027ca80 100644 --- a/office/.config/neomutt/mailcap +++ b/office/.config/neomutt/mailcap @@ -1,5 +1,5 @@ # open html emails in browser (or whatever GUI program is used to render HTML) -text/html; xdg-open %s ; nametemplate=%s.html +text/html; open %s ; nametemplate=%s.html # render html emails inline using magic (uncomment the line below to use lynx instead) # text/html; lynx -assume_charset=%{charset} -display_charset=utf-8 -collapse_br_tags -dump %s; nametemplate=%s.html; copiousoutput text/html; render-prettyhtml %s; nametemplate=%s.html; copiousoutput; @@ -20,9 +20,9 @@ video/*; setsid mpv --quiet %s &; copiousoutput application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; sc-im %s; needsterminal # open anything else externally -application/pdf; xdg-open %s; +application/pdf; open %s; -application/*; mkdir -p /tmp/mutt \; cp %s /tmp/mutt \; xdg-open /tmp/mutt/$(basename %s) & +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; diff --git a/office/.config/neomutt/maps b/office/.config/neomutt/maps index aa8fabe..a3e79a6 100644 --- a/office/.config/neomutt/maps +++ b/office/.config/neomutt/maps @@ -5,6 +5,10 @@ bind index,pager g noop # don't send group-replies with g bind index gg first-entry bind index G last-entry bind index collapse-thread +macro index J "tag current and select next entry" +macro index K "tag current and select previous entry" +macro index t "tag current entry" + # view manipulation bind attach,browser,index,pager \CF next-page @@ -44,12 +48,12 @@ macro index,pager ,a \ "add the sender email address to khard" # mailbox navigation -macro index,pager gi "=inbox" "go to inbox" -macro index,pager gm "=important" "go to important" -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 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" # sidebar navigation bind index,pager B sidebar-toggle-visible bind index,pager sidebar-next @@ -66,8 +70,7 @@ bind pager k previous-line bind pager j next-line bind pager gg top bind pager G bottom -# compose postpone -bind compose p postpone-message + # markdown to html for composition macro compose ,m "F pandoc -s -f markdown -t html \ny^T^Utext/html; charset=UTF-8\n" "Convert from MD to HTML" @@ -79,9 +82,7 @@ bind index,pager ro reply macro index,pager \CU " unset pipe_decodeextract_url | fzf | clip" "get URLs" # Refresh far imap email -macro index O "export MBSYNC_PRE=true; sync-mail" "refresh all e-mail" -macro index o "export MBSYNC_PRE=true; sync-mail gmail-inbox" "refresh inbox e-mail" - +macro index O "export MBSYNC_PRE=true; sync-mail" "refresh all e-mail" # Send mail to taskwarrior macro index,pager ,T "mutt2task -c -d -t" "add mail as task to taskwarrior with custom description and tags" diff --git a/office/.config/neomutt/profile.gmail b/office/.config/neomutt/profile.gmail new file mode 100644 index 0000000..b7fd46f --- /dev/null +++ b/office/.config/neomutt/profile.gmail @@ -0,0 +1,2 @@ +color status color3 black '(\` )' # bubble account variation +macro generic ":source ~/.config/neomutt/profile.private" diff --git a/office/.config/neomutt/profile.private b/office/.config/neomutt/profile.private new file mode 100644 index 0000000..34ef5fe --- /dev/null +++ b/office/.config/neomutt/profile.private @@ -0,0 +1,2 @@ +color status color69 black '(\` )' # bubble account variation +macro generic ":source ~/.config/neomutt/profile.gmail" diff --git a/office/.config/neomutt/settings b/office/.config/neomutt/settings index 0ad0317..6e71428 100644 --- a/office/.config/neomutt/settings +++ b/office/.config/neomutt/settings @@ -1,12 +1,3 @@ -# Identity -# -set realname = "Marty Oehme" -set from = "marty.oehme@gmail.com" -# # If you have another address: -# alternates "^neomutt@example\.com$" -# # Or, if you use the entire domain: -# alternates "@example\.com$" -# set reverse_name set mail_check = 60 set mail_check_stats @@ -52,7 +43,7 @@ set fcc_attach # attachments saved with body # set editor = "vim" set mime_type_query_command = "xdg-mime query filetype" # send settings -set sendmail = "/usr/bin/msmtp -a personal-gmail" +set sendmail = "/usr/bin/msmtp" set sendmail_wait = 0 # Display Settings