Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adds new mutt + offlineimap config with much credit to Steve Losh

  • Loading branch information...
commit c993d839f01a76d9e4dc723422f0da3e49e9cdbd 1 parent 9ad9d0d
@dlobraico authored
View
3  .gitignore
@@ -37,3 +37,6 @@ emacs.d/.mc-lists.el
.hg
.hg/*
*.cache
+
+mutt/cache
+mutt/tmp
View
11 msmtprc
@@ -0,0 +1,11 @@
+account personal
+host smtp.gmail.com
+port 587
+protocol smtp
+auth on
+from dj@lobraico.com
+user dj@lobraico.com
+tls on
+tls_trust_file ~/.mutt/Equifax_Secure_CA.cert
+
+account default : personal
View
17 mutt/Equifax_Secure_CA.cert
@@ -0,0 +1,17 @@
+-----BEGIN CERTIFICATE-----
+MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJVUzEQMA4GA1UE
+ChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5
+MB4XDTk4MDgyMjE2NDE1MVoXDTE4MDgyMjE2NDE1MVowTjELMAkGA1UEBhMCVVMxEDAOBgNVBAoT
+B0VxdWlmYXgxLTArBgNVBAsTJEVxdWlmYXggU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0eTCB
+nzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2RFGiYCh7+2gRvE4RiIcPR
+fM6fBeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO/t0BCezhABRP/PvwDN1Dulsr4R+AcJkVV5MW
+8Q+XarfCaCMczE1ZMKxRHjuvK9buY0V7xdlfUNLjUA86iOe/FP3gx7kCAwEAAaOCAQkwggEFMHAG
+A1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UE
+CxMkRXF1aWZheCBTZWN1cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMBoG
+A1UdEAQTMBGBDzIwMTgwODIyMTY0MTUxWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUSOZo+SvS
+spXXR9gjIBBPM5iQn9QwHQYDVR0OBBYEFEjmaPkr0rKV10fYIyAQTzOYkJ/UMAwGA1UdEwQFMAMB
+Af8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUAA4GBAFjOKer89961
+zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y7qj/WsjTVbJmcVfewCHrPSqnI0kB
+BIZCe/zuf6IWUrVnZ9NA2zsmWLIodz2uFHdh1voqZiegDfqnc1zqcPGUIWVEX/r87yloqaKHee95
+70+sB3c4
+-----END CERTIFICATE-----
View
18 mutt/mailcap
@@ -0,0 +1,18 @@
+# MS Word documents
+application/msword; ~/.mutt/view_attachment.sh %s "-" '/Applications/TextEdit.app'
+
+# Images
+image/jpg; ~/.mutt/view_attachment.sh %s jpg
+image/jpeg; ~/.mutt/view_attachment.sh %s jpg
+image/pjpeg; ~/.mutt/view_attachment.sh %s jpg
+image/png; ~/.mutt/view_attachment.sh %s png
+image/gif; ~/.mutt/view_attachment.sh %s gif
+
+# PDFs
+application/pdf; ~/.mutt/view_attachment.sh %s pdf
+
+# HTML
+text/html; ~/.mutt/view_attachment.sh %s html
+
+# Unidentified files
+application/octet-stream; ~/.mutt/view_attachment.sh %s "-"
View
1  mutt/mutt-colors-solarized
View
1  mutt/muttrc
View
16 mutt/offlineimap.py
@@ -0,0 +1,16 @@
+#!/usr/bin/python
+import re, subprocess
+def get_keychain_pass(account=None, server=None):
+ params = {
+ 'security': '/usr/bin/security',
+ 'command': 'find-internet-password',
+ 'account': account,
+ 'server': server,
+ 'keychain': '/Users/dlobraico/Library/Keychains/login.keychain',
+ }
+ command = "sudo -u dlobraico %(security)s -v %(command)s -g -a %(account)s -s %(server)s %(keychain)s" % params
+ output = subprocess.check_output(command, shell=True, stderr=subprocess.STDOUT)
+ outtext = [l for l in output.splitlines()
+ if l.startswith('password: ')][0]
+
+ return re.match(r'password: "(.*)"', outtext).group(1)
View
126 mutt/view_attachment.sh
@@ -0,0 +1,126 @@
+#!/bin/bash
+#
+# Author: Eric Gebhart
+#
+# Purpose: To be called by mutt as indicated by .mailcap to handle mail attachments.
+#
+# Function: Copy the given file to a temporary directory so mutt
+# Won't delete it before it is read by the application.
+#
+# Along the way, discern the file type or use the type
+# That is given.
+#
+# Finally use 'open' or 'open -a' if the third argument is
+# given.
+#
+#
+# Arguments:
+#
+# $1 is the file
+# $2 is the type - for those times when file magic isn't enough.
+# I frequently get html mail that has no extension
+# and file can't figure out what it is.
+#
+# Set to '-' if you don't want the type to be discerned.
+# Many applications can sniff out the type on their own.
+# And they do a better job of it too.
+#
+# Open Office and MS Office for example.
+#
+# $3 is open with. as in open -a 'open with this .app' foo.xls
+#
+# Examples: These are typical .mailcap entries which use this program.
+#
+# Image/JPEG; /Users/vdanen/.mutt/view_attachment %s
+# Image/PNG; /Users/vdanen/.mutt/view_attachment %s
+# Image/GIF; /Users/vdanen/.mutt/view_attachment %s
+#
+# Application/PDF; /Users/vdanen/.mutt/view_attachment %s
+#
+# #This HTML example passes the type because file doesn't always work and
+# #there aren't always extensions.
+#
+# text/html; /Users/vdanen/.mutt/view_attachment %s html
+#
+# # If your Start OpenOffice.org.app is spelled with a space like this one, <--
+# # then you'll need to precede the space with a \ . I found that too painful
+# # and renamed it with an _.
+#
+# Application/vnd.ms-excel; /Users/vdanen/.mutt/view_attachment %s "-" '/Applications/OpenOffice.org1.1.2/Start_OpenOffice.org.app'
+# Application/msword; /Users/vdanen/.mutt/view_attachment %s "-" '/Applications/OpenOffice.org1.1.2/Start_OpenOffice.org.app'
+#
+#
+# Debugging: If you have problems set debug to 'yes'. That will cause a debug file
+# be written to /tmp/mutt_attach/debug so you can see what is going on.
+#
+# See Also: The man pages for open, file, basename
+#
+
+# the tmp directory to use.
+tmpdir="$HOME/tmp/mutt_attach"
+
+# the name of the debug file if debugging is turned on.
+debug_file=$tmpdir/debug
+
+# debug. yes or no.
+#debug="no"
+debug="yes"
+
+type=$2
+open_with=$3
+
+# make sure the tmpdir exists.
+mkdir -p $tmpdir
+
+# clean it out. Remove this if you want the directory
+# to accumulate attachment files.
+rm -f $tmpdir/*
+
+# Mutt puts everything in /tmp by default.
+# This gets the basic filename from the full pathname.
+filename=`basename $1`
+
+# get rid of the extenson and save the name for later.
+file=`echo $filename | cut -d"." -f1`
+
+if [ $debug = "yes" ]; then
+ echo "1:" $1 " 2:" $2 " 3:" $3 > $debug_file
+ echo "Filename:"$filename >> $debug_file
+ echo "File:"$file >> $debug_file
+ echo "===========================" >> $debug_file
+fi
+
+# if the type is empty then try to figure it out.
+if [ -z $type ]; then
+ type=`file -bi $1 | cut -d"/" -f2`
+fi
+
+# if the type is '-' then we don't want to mess with type.
+# Otherwise we are rebuilding the name. Either from the
+# type that was passed in or from the type we discerned.
+if [ $type = "-" ]; then
+ newfile=$filename
+else
+ newfile=$file.$type
+fi
+
+newfile=$tmpdir/$newfile
+
+# Copy the file to our new spot so mutt can't delete it
+# before the app has a chance to view it.
+cp $1 $newfile
+
+if [ $debug = "yes" ]; then
+ echo "File:" $file "TYPE:" $type >> $debug_file
+ echo "Newfile:" $newfile >> $debug_file
+ echo "Open With:" $open_with >> $debug_file
+fi
+
+# If there's no 'open with' then we can let preview do it's thing.
+# Otherwise we've been told what to use. So do an open -a.
+
+if [ -z $open_with ]; then
+ open $newfile
+else
+ open -a "$open_with" $newfile
+fi
View
162 muttrc
@@ -0,0 +1,162 @@
+set from = "dj@lobraico.com"
+set sendmail = "/usr/local/bin/msmtp -a personal"
+set sendmail_wait = 0
+unset record
+
+set realname = "D. LoBraico"
+
+set folder = "$HOME/Mail"
+set spoolfile =+/personal/INBOX
+alternates d@lobraico.com
+
+# Paths and folders
+set alias_file = "~/.mutt/alias"
+set header_cache = "~/.mutt/cache/headers"
+set message_cachedir = "~/.mutt/cache/bodies"
+set certificate_file = "~/.mutt/.certificates"
+set mailcap_path = "~/.mutt/mailcap"
+set tmpdir = "~/.mutt/tmp"
+set signature = "~/.mutt/sig"
+
+# Basic options
+set wait_key = no
+set mbox_type = Maildir
+set timeout = 3
+set mail_check = 0
+unset move
+set delete
+unset confirmappend
+set quit
+unset mark_old
+set beep_new
+set pipe_decode
+set thorough_search
+
+set mbox = "+personal/archive"
+set postponed = "+personal/drafts"
+bind compose p postpone-message
+bind index p recall-message
+
+auto_view text/html
+
+#set sort = 'threads'
+#set sort_aux = 'reverse-last-date-received'
+#set auto_tag = yes
+#ignore "Authentication-Results:"
+#ignore "DomainKey-Signature:"
+#ignore "DKIM-Signature:"
+#hdr_order Date From To Cc
+#alternative_order text/plain text/html *
+#auto_view text/html
+
+# Editor
+set editor = "vim"
+
+# Colors
+color index red black ~N
+color index red black ~O
+source $MAILCONF/mutt-colors-solarized/mutt-colors-solarized-dark-16.muttrc
+
+# Sidebar Patch
+source $HOME/Mail/muttrc.mailboxes
+set sidebar_delim = ' |'
+set sidebar_visible = yes
+set sidebar_width = 24
+color sidebar_new color221 color233
+
+# Status Bar
+set status_chars = " *%A"
+set status_format = "───[ Folder: %f ]───[%r%m messages%?n? (%n new)?%?d? (%d to delete)?%?t? (%t tagged)? ]───%>─%?p?( %p postponed )?───"
+
+# Sidebar navigation
+bind index,pager <down> sidebar-next
+bind index,pager <up> sidebar-prev
+bind index,pager <right> sidebar-open
+
+# Header options
+ignore * # ignore all headers
+unignore from: to: cc: date: subject: # show only these
+unhdr_order * # some distros order things by default
+hdr_order from: to: cc: date: subject: # and in this order
+
+# Index View options
+set date_format = "%m/%d"
+set index_format = "[%Z] %D %-20.20F %s"
+set sort = threads # like gmail
+set sort_aux = reverse-last-date-received # like gmail
+set uncollapse_jump # don't collapse on an unread message
+set sort_re # thread based on regex
+set reply_regexp = "^(([Rr][Ee]?(\[[0-9]+\])?: *)?(\[[^]]+\] *)?)*"
+
+# Index key bindings
+# Index Key Bindings ---------------------------------
+bind index gg first-entry
+bind index G last-entry
+
+bind index R group-reply
+bind index <tab> sync-mailbox
+bind index <space> collapse-thread
+
+# Ctrl-R to mark all as read
+macro index \Cr "T~U<enter><tag-prefix><clear-flag>N<untag-pattern>.<enter>" "mark all messages as read"
+
+# Sync email
+macro index O "<shell-escape>offlineimap<enter>" "run offlineimap to sync all mail"
+macro index o "<shell-escape>offlineimap -qf INBOX<enter>" "run offlineimap to sync inbox"
+
+# Saner copy/move dialogs
+macro index C "<copy-message>?<toggle-mailboxes>" "copy a message to a mailbox"
+macro index M "<save-message>?<toggle-mailboxes>" "move a message to a mailbox"
+
+# Pager View Options
+set pager_index_lines = 10 # number of index lines to show
+set pager_context = 3 # number of context lines to show
+set pager_stop # don't go to next message automatically
+set menu_scroll # scroll in menus
+set tilde # show tildes like in vim
+unset markers # no ugly plus signs
+
+set quote_regexp = "^( {0,4}[>|:#%]| {0,4}[a-z0-9]+[>|]+)+"
+alternative_order text/plain text/enriched text/html
+
+# Pager Key Bindings
+bind pager k previous-line
+bind pager j next-line
+bind pager gg top
+bind pager G bottom
+
+bind pager R group-reply
+
+# View attachments properly.
+bind attach <return> view-mailcap
+
+macro pager \Cu "|urlview<enter>" "call urlview to open links"
+
+# Compose view options
+set envelope_from # which from?
+set sig_dashes # dashes before sig
+set edit_headers # show headers when composing
+set fast_reply # skip to compose when replying
+set askcc # ask for CC:
+set fcc_attach # save attachments with the body
+unset mime_forward # forward attachments as part of body
+set forward_format = "Fwd: %s" # format of subject when forwarding
+set forward_decode # decode when forwarding
+set attribution = "On %d, %n wrote:" # format of quoting header
+set reply_to # reply to Reply to: field
+set reverse_name # reply as whomever it was to
+set include # include message in replies
+set forward_quote # include message in forwards
+
+# Address book!
+set query_command = "contacts -Sf '%eTOKEN%n' '%s' | sed -e 's/TOKEN/\t/g'"
+bind editor <Tab> complete-query
+bind editor ^T complete
+
+# Search
+bind index N search-opposite
+bind pager N search-opposite
+macro index a "<limit>all\n" "show all messages (undo limit)"
+
+# 'L' performs a notmuch query, showing only the results
+macro index L "<enter-command>unset wait_key<enter><shell-escape>read -p 'notmuch query: ' x; echo \$x >~/.mutt/cache/mutt_terms<enter><limit>~i \"\`notmuch search --output=messages \$(cat ~/.cache/mutt_terms) | head -n 600 | perl -le '@a=<>;chomp@a;s/\^id:// for@a;$,=\"|\";print@a'\`\"<enter>" "show only messages matching a notmuch pattern"
View
2  zshrc
@@ -122,4 +122,6 @@ if [[ -n ${INSIDE_EMACS} ]]; then
print -P "\033AnSiTc %d"
fi
+export MAILCONF="~/.mutt"
+
source "${HOME}/.zshrc.local"
Please sign in to comment.
Something went wrong with that request. Please try again.