changeset 359:1a8e250fdf9d

Mutt config changes.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 20 Dec 2016 22:01:13 -0800
parents a951ca3b5d8c
children 4e4c847fe350
files .hgignore .hgsubstate mutt/fastmailrc mutt/mailcap mutt/muttrc mutt/signature mutt/view_attachment.sh
diffstat 7 files changed, 268 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Mon Dec 19 20:06:46 2016 -0800
+++ b/.hgignore	Tue Dec 20 22:01:13 2016 -0800
@@ -13,6 +13,7 @@
 weechat/logs
 weechat/*.log
 mutt/*.gpg
+mutt/variables
 pentadactyl/.pentadactyl
 pentadactyl/info
 
--- a/.hgsubstate	Mon Dec 19 20:06:46 2016 -0800
+++ b/.hgsubstate	Tue Dec 20 22:01:13 2016 -0800
@@ -4,7 +4,7 @@
 7d99080f276f49e3638ba13b4f5c1cd2dc4cc21f lib/hg/hg-git-sync
 5dc059aeb5f47dc86ef30821b8a8cdfbf10a4080 lib/hg/hg-prompt
 66e2a34005b447d321a96838d7fe2b161e78b7a9 lib/hg/mercurial-cli-templates
-05d15886aaebcee15a372fc28584766e4e7553bd lib/hg/mutable-history
+ba9fabaca91b0897cffb7048d81193e44d440948 lib/hg/mutable-history
 d920e3425db554497a2cfaf1a2548eafbdc8b0e7 lib/hg/onsub
 cc2b3718bcf4c55fab4aa1db36103db76ca6ebda lib/hg/path-pattern
 2d9820cf595263bc7c651295b83f02525a23ca4a lib/hg/terse-status
@@ -19,11 +19,11 @@
 649120e90e92bc2ae5361693fa1e4dd2d02c1822 vim/bundle/easymotion
 19d1c944dbf59f252135688018610a12ce5718b4 vim/bundle/fugitive
 6577ac10e3249d48576a44732dd765650273eef1 vim/bundle/gundo
-04288637e5952f73c20526f5d0fbd9cff654308a vim/bundle/gutentags
+f915393ff68d9e436146845663ae7f76cf2b2707 vim/bundle/gutentags
 1f2e47c78c2faf90ff419c2f4e1241094844678c vim/bundle/haml
 09b5653761879394b24f6c902c7dbbbd11b19512 vim/bundle/interestingwords
 8a8f0ed97c1751d304cf5b7241f2fe27b0e61f81 vim/bundle/jinja
-652a6f5df0f3a204fc2c23418e1f7b4d62efa414 vim/bundle/lawrencium
+4d5f4233b04ecc052d9d46a5dab1f4155e50735f vim/bundle/lawrencium
 6fae407f7ed666a6dd0fb596e67df8787dccca59 vim/bundle/less
 0c60eb4de8827d762137e7d956219ee7f5b67494 vim/bundle/linediff
 4260faa48f5b89261f1168d4a1ad195106f5959c vim/bundle/markdown
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mutt/fastmailrc	Tue Dec 20 22:01:13 2016 -0800
@@ -0,0 +1,36 @@
+
+# Mutt config for FastMail.
+# Just define `my_user` and `my_pass` before sourcing this.
+
+# Variables
+set my_imap=imap.fastmail.com:993
+set my_smtp=smtp.fastmail.com:465
+
+set my_folder_inbox=INBOX
+set my_folder_sent="Sent Items"
+set my_folder_drafts="Drafts"
+set my_folder_trash="Trash"
+set my_folder_archive="Archive"
+
+# Actual connection stuff
+set imap_user = "$my_user"
+set imap_pass = "$my_pass"
+set smtp_url = "smtps://$my_user@$my_smtp"
+set smtp_pass = "$my_pass"
+
+set folder = "imaps://$my_imap/$my_folder_inbox"
+set spoolfile = "imaps://$my_imap/$my_folder_inbox"
+set record = "imaps://$my_imap/$my_folder_sent"
+set postponed = "imaps://$my_imap/$my_folder_drafts"
+set mbox = "imaps://$my_imap/$my_folder_archive"
+set trash = "imaps://$my_imap/$my_folder_trash"
+
+# Miscellaneous connection stuff
+set ssl_force_tls = yes
+set ssl_starttls = no
+
+set imap_check_subscribed
+set imap_idle
+
+
+# vim: ft=muttrc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mutt/mailcap	Tue Dec 20 22:01:13 2016 -0800
@@ -0,0 +1,20 @@
+
+# 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 "-"
+
--- a/mutt/muttrc	Mon Dec 19 20:06:46 2016 -0800
+++ b/mutt/muttrc	Tue Dec 20 22:01:13 2016 -0800
@@ -1,45 +1,103 @@
 
-# Connection
-set folder = "imaps://$my_imap"
-set imap_user = "$my_user"
-set imap_pass = "$my_pass"
-set smtp_url = "smtps://$my_user@$my_smtp"
-set smtp_pass = "$my_pass"
+# Main stuff.
 set from = "$my_user"
 set realname = "$my_realname"
 
-set imap_check_subscribed
-set imap_idle
 
-
-# Folders
-set folder = "imaps://$my_url/$my_folder_inbox"
-set spoolfile = "imaps://$my_url/$my_folder_inbox"
-set record = "imaps://$my_url/$my_folder_sent"
-set postponed = "imaps://$my_url/$my_folder_drafts"
+# Folders... apparently Mutt doesn't pull all of them automatically.
+mailboxes = "imaps://$my_imap/$my_folder_inbox" \
+            "imaps://$my_imap/Sent Items" \
+            "imaps://$my_imap/Drafts" \
+            "imaps://$my_imap/Archive" \
+            "imaps://$my_imap/MailingLists" \
+            "imaps://$my_imap/Newsletters" \
+            "imaps://$my_imap/Trash"
 
 
 # Basic config
-set editor = "vim"
-set hostname = "$my_hostname"
+#set editor = "vim"
+set editor = "vim +/^$ ++1 -c 'set tw=76 expandtab nosmartindent spell'"
+#set hostname = "$my_hostname"
 set header_cache=~/.mutt/cache/headers
 set message_cachedir=~/.mutt/cache/bodies
 set certificate_file=~/.mutt/certificates
 set move = no
 set delete = yes
-set include
 set sort = 'threads'
 set sort_aux = 'reverse-last-date-received'
 set auto_tag = yes
+set pager_stop  # Don't move to the next message automatically
+set fast_reply  # Don't ask stupid questions when replying
+set include  # Auto-quote
+set reverse_name  # Reply from the account the message was sent to
+set use_envelope_from  # Move or less same as previous
+set quit = yes  # Don't ask before quitting
+set mark_old = no  # Read/unread is enough
+set beep_new = yes  # Been when there are new messages
+set pipe_decode  # Strip headers and eval mimes when piping
+set thorough_search  # Strip headers and eval mimes before searching
+set uncollapse_jump
+set date_format = "%d/%m/%Y"  # Show the date like you're civilized
+set index_format = "[%Z]  %D  %-20.20F  %s"
+set collapse_unread
+
 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
+
 bind editor <Tab> complete-query
 bind editor ^T complete
-bind editor <space> noop 
+
+bind index <tab> sync-mailbox
+bind index <space> collapse-thread
+
+bind index gg first-entry
+bind index G last-entry
+
+bind index R group-reply
+
+
+# Pager
+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
+
+bind pager k previous-line
+bind pager j next-line
+bind pager gg top
+bind pager G bottom
+
+bind pager R group-reply
+
+bind attach <return> view-mailcap # View attachements properly
+
+macro pager \Cu "|urlview<enter>" "call urlview to open links"
+
+
+# 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
+set sidebar_visible
+set sidebar_short_path
+set sidebar_format = "%B%?F? [%F]?%* %?N?%N/?%S"
+set mail_check_stats
+
+bind index,pager B sidebar-toggle-visible
+bind index,pager <down>   sidebar-next
+bind index,pager <up>     sidebar-prev
+bind index,pager <right>  sidebar-open
 
 
 # Gmail-style keyboard shortcuts
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mutt/signature	Tue Dec 20 22:01:13 2016 -0800
@@ -0,0 +1,4 @@
+--
+l u d o .
+. 8 0 17 80
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mutt/view_attachment.sh	Tue Dec 20 22:01:13 2016 -0800
@@ -0,0 +1,128 @@
+#!/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
+    file  $1
+    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
+