summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md8
-rw-r--r--home.nix4
-rw-r--r--mailcap1
-rwxr-xr-xmutt/generate-contacts.sh15
-rw-r--r--muttrc10
-rw-r--r--packages.nix1
6 files changed, 36 insertions, 3 deletions
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