From f41646f7ec4bf28e2bcbe19bb9b92637055cbc9d Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Thu, 5 Jul 2018 13:30:36 -0700 Subject: Add some mutt stuff - added lynx - render html emails in lynx - c.f. http://blog.deadlypenguin.com/blog/2009/04/21/mutt-and-lynx/ - added a readme - maybe other stuff, i forget --- README.md | 8 ++++++++ home.nix | 4 ++++ mailcap | 1 + mutt/generate-contacts.sh | 15 +++++++++++++++ muttrc | 10 +++++++--- packages.nix | 1 + 6 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 README.md create mode 100644 mailcap create mode 100755 mutt/generate-contacts.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..364098d --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +My user configs. I use this on a NixOS 18.03 machine and a Debian machine, but +it would work on any unix-like platform (macOS, other linuxen, etc). + +The dotfiles are compiled with @rycee's awesome +[`home-manager`](https://github.com/rycee/home-manager) program.. + +If you want to understand how this works, read the `home-manager` manual and +look at my `home.nix` file. diff --git a/home.nix b/home.nix index 6656cfb..b5b4e2e 100644 --- a/home.nix +++ b/home.nix @@ -17,6 +17,10 @@ in (builtins.readFile ./mutt/solarized.muttrc); target = ".muttrc"; }; + mailcap = { + source = ./mailcap; + target = ".mailcap"; + }; tmux = { source = ./tmux; target = ".tmux.conf"; diff --git a/mailcap b/mailcap new file mode 100644 index 0000000..6e998ad --- /dev/null +++ b/mailcap @@ -0,0 +1 @@ +text/html; lynx -dump -width=78 -nolist %s | sed 's/^ //'; copiousoutput; needsterminal; nametemplate=%s.html diff --git a/mutt/generate-contacts.sh b/mutt/generate-contacts.sh new file mode 100755 index 0000000..ab3cacb --- /dev/null +++ b/mutt/generate-contacts.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env sh +# +# Source: http://wcm1.web.rice.edu/mutt-tips.html + +MESSAGE=$(cat) + +NEWALIAS=$(echo "${MESSAGE}" | grep ^"From: " | sed s/[\,\"\']//g | awk '{$1=""; if (NF == 3) {print "alias" $0;} else if (NF == 2) {print "alias" $0 $0;} else if (NF > 3) {print "alias", tolower($(NF-1))"-"tolower($2) $0;}}') + +if grep -Fxq "$NEWALIAS" $HOME/contacts.txt; then + : +else + echo "$NEWALIAS" >> $HOME/contacts.txt +fi + +echo "${MESSAGE}" diff --git a/muttrc b/muttrc index 451c88a..8bfebb6 100644 --- a/muttrc +++ b/muttrc @@ -4,6 +4,7 @@ set realname = "Ben Sima" set mbox_type = Maildir my_hdr X-URL: https://www.bsima.me +# my_hdr Bcc: ben@bsima.me set editor = "vim -f" set mail_check = 60 @@ -12,11 +13,16 @@ set header_cache = ~/.mutt/cache/headers set message_cachedir = ~/.mutt/cache/bodies set certificate_file =~/.mutt/certificates +# Contacts +set display_filter=~/config/mutt/generate-contacts.sh +set alias_file=~/contacts.txt +source $alias_file + set move = no set include set auto_tag = yes alternative_order text/plain text/html * -auto_view text/html +auto_view text/x-vcard text/html text/enriched bind editor ^T complete set pager_index_lines = 10 set implicit_autoview = yes @@ -69,5 +75,3 @@ set spoolfile = "+INBOX" set postponed = "+Drafts" set record = "+Sent" set imap_pipeline_depth = 0 - - diff --git a/packages.nix b/packages.nix index 5b947fd..fdb3a2b 100644 --- a/packages.nix +++ b/packages.nix @@ -24,6 +24,7 @@ pkgs.keepassx pkgs.keybase pkgs.keybase-gui pkgs.lsof +pkgs.lynx pkgs.mononoki pkgs.mplayer pkgs.mpv -- cgit v1.2.3