commit 8fab91cd02a36968aecd55e2be7664d84d6dd079
parent 1005d703d7d329dc05c1e20212a15f5b8d5d0062
Author: pyratebeard <root@pyratebeard.net>
Date: Tue, 28 Jun 2022 14:44:28 +0100
new colours. set {record,postpone} dir. update new mbox dir. use mailfmtshort script
Diffstat:
2 files changed, 40 insertions(+), 6 deletions(-)
diff --git a/bin/bin/mailfmtshort b/bin/bin/mailfmtshort
@@ -0,0 +1,28 @@
+#!/bin/sh
+# use shortner running on lxc container urlshort
+
+w=$(tput cols)
+if [ -z "$w" ] || [ "$w" -gt 120 ] ; then
+ w=120
+fi
+
+tmp1=$(mktemp -p /tmp mailfmt.XXXXXXXX)
+tmp2=$(mktemp -p /tmp mailfmt.XXXXXXXX)
+trap "rm -f $tmp1 $tmp2" EXIT QUIT INT
+
+# trim mutt [-- Attachment --] headers
+grep -vE -- '\[-- .* --\]$' | fmt -s -w $w | tee $tmp1 > $tmp2
+
+grep -oE '[hH][tT]{2}[pP][sS]?://([^/?#><"]+)([^?#><"]*)(\?([^#><"]*))?(#(.*))?' $tmp1 | sort | uniq | while read url; do
+ if [ "$(echo $url | wc -c)" -gt $w ]; then
+ # shorten url
+ short=$(curl -sS -X PUT -d "$url" http://url.short)
+
+ # escape special chars in url for passing it to sed
+ escape=$(printf '%s\n' "$url" | sed 's/[]\/$*.^[]/\\&/g')
+
+ # replace url with short link (using space as sed separator)
+ sed -i "s $escape $short g" $tmp2
+ fi
+done
+cat $tmp2
diff --git a/mutt/.mutt/muttrc b/mutt/.mutt/muttrc
@@ -24,12 +24,15 @@ set header_cache = "~/.mutt/cache/headers"
set message_cachedir = "~/.mutt/cache/"
set certificate_file = "~/.mutt/certificates"
set mbox_type = Maildir
-set folder = "~/lib/documents/email/pyratebeard"
+set folder = "~/var/mbox/pyratebeard"
set spoolfile = +INBOX
-set record = "~/.mutt/sent"
-set postponed = "~/.mutt/postponed"
+set record = "+INBOX.Sent"
+set postponed = "+INBOX.Drafts"
mailboxes = =INBOX
set mail_check = 120
+set collapse_unread = no
+set sort = threads
+set sort_aux = reverse-date-received
# colours
color normal default default
@@ -38,12 +41,15 @@ color tree default default
color status white black
color index white color8 "~T"
color index color10 default "~U"
+color index color15 default "~O"
color index red black "~D"
-color index color5 default "~F"
+color index color14 default "~F"
+color index color3 default "~g"
+color index color0 color3 "~G"
# pgp
source "~/.mutt/gpg.rc"
-set pgp_autosign = no
+set pgp_autosign = yes
set pgp_use_gpg_agent = yes
# compose
@@ -66,7 +72,7 @@ unset markers
set mailcap_path = ~/.mailcap"
auto_view text/html
alternative_order text/html text/plain
-set display_filter = "~/bin/mailfmt"
+set display_filter = "~/bin/mailfmtshort"
# sidebar
set sidebar_visible = no