diff options
| -rwxr-xr-x | .gitignore | 2 | ||||
| -rw-r--r-- | files/.mutt/bindings | 29 | ||||
| -rw-r--r-- | files/.mutt/colors | 33 | ||||
| -rw-r--r-- | files/.mutt/crypto | 43 | ||||
| -rw-r--r-- | files/.mutt/fcc-hooks | 11 | ||||
| -rw-r--r-- | files/.mutt/folder-hooks | 3 | ||||
| -rw-r--r-- | files/.mutt/folder-hooks.default | 10 | ||||
| -rw-r--r-- | files/.mutt/folder-hooks.maillist | 8 | ||||
| -rwxr-xr-x | files/.mutt/gen_maillist.sh | 45 | ||||
| -rw-r--r-- | files/.mutt/macros | 16 | ||||
| -rw-r--r-- | files/.mutt/mailboxes | 9 | ||||
| -rw-r--r-- | files/.mutt/maillists | 18 | ||||
| -rw-r--r-- | files/.mutt/maillists.generate | 82 | ||||
| -rwxr-xr-x | files/.mutt/mutt-notmuch | 189 | ||||
| -rwxr-xr-x | files/.mutt/mutt.octet.filter | 328 | ||||
| -rw-r--r-- | files/.mutt/mutt_mailcap | 6 | ||||
| -rw-r--r-- | files/.mutt/muttrc | 139 | ||||
| -rw-r--r-- | files/.mutt/send-hooks | 5 | ||||
| -rw-r--r-- | files/.mutt/signature | 2 | ||||
| -rw-r--r-- | files/.mutt/subscriptions | 14 |
20 files changed, 992 insertions, 0 deletions
@@ -1 +1,3 @@ files/.zsh/cache +files/.mutt/aliases +files/.mutt/certificates diff --git a/files/.mutt/bindings b/files/.mutt/bindings new file mode 100644 index 0000000..3ed33a3 --- /dev/null +++ b/files/.mutt/bindings @@ -0,0 +1,29 @@ +bind generic <Home> first-entry +bind generic <End> last-entry +bind generic <Left> previous-entry +bind generic <Right> next-entry +bind generic "(" current-top + +bind index "{" previous-thread +bind index "}" next-thread +bind index <Up> previous-thread +bind index <Down> next-thread +bind index - collapse-thread +bind index "F" flag-message +bind index \CP sidebar-prev +bind index \CN sidebar-next +bind index \CO sidebar-open + +bind pager <Home> top +bind pager <End> bottom +bind pager "{" previous-thread +bind pager "}" next-thread +bind pager <Up> previous-line +bind pager <Down> next-line +bind pager <Left> previous-entry +bind pager <Right> next-entry +bind pager \CP sidebar-prev +bind pager \CN sidebar-next +bind pager \CO sidebar-open + +# vim: ft=muttrc diff --git a/files/.mutt/colors b/files/.mutt/colors new file mode 100644 index 0000000..227119d --- /dev/null +++ b/files/.mutt/colors @@ -0,0 +1,33 @@ +## +# Colors +# + +color hdrdefault black cyan +color quoted brightred black +color signature magenta black +color indicator brightwhite red +color attachment black green +color error red black +color message white black +color search brightwhite magenta +color status brightyellow magenta +color tree red black +color normal white black +color tilde green black +color bold brightyellow black +color markers red black + +# Highlights inside body of msg. +color body brightblue black "(http|ftp)://[^ \"\t\r\n]*" +color body brightblue black "mailto:[-a-z_0-9.]+@[-a-z0-9.]+" +color body brightblue black "[-a-z_0-9.]+@[-a-z0-9_.]+" +color body brightgreen black " [:;]-*[)>(<|]" + +color header brightwhite cyan "^(From|Subject):" + +color index green black ~p +color index black yellow ~F + +color sidebar_new yellow default + +# vim: ft=muttrc diff --git a/files/.mutt/crypto b/files/.mutt/crypto new file mode 100644 index 0000000..217d15a --- /dev/null +++ b/files/.mutt/crypto @@ -0,0 +1,43 @@ +set pgp_decode_command="gpg %?p?--passphrase-fd 0? --no-verbose --batch --output - %f" +set pgp_verify_command="gpg --no-verbose --batch --output - --verify %s %f" +set pgp_decrypt_command="gpg --passphrase-fd 0 --no-verbose --batch --output - %f" +set pgp_sign_command="gpg --no-verbose --batch --output - --passphrase-fd 0 --armor --detach-sign --textmode %?a?-u %a? %f" +set pgp_clearsign_command="gpg --no-verbose --batch --output - --passphrase-fd 0 --armor --textmode --clearsign %?a?-u %a? %f" +set pgp_encrypt_only_command="pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --always-trust --encrypt-to 0xC9C40C31 -- -r %r -- %f" +set pgp_encrypt_sign_command="pgpewrap gpg --passphrase-fd 0 --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust --encrypt-to 0xC9C40C31 -- -r %r -- %f" +set pgp_import_command="gpg --no-verbose --import -v %f" +set pgp_export_command="gpg --no-verbose --export --armor %r" +set pgp_verify_key_command="gpg --no-verbose --batch --fingerprint --check-sigs %r" +set pgp_list_pubring_command="gpg --no-verbose --batch --with-colons --list-keys %r" +set pgp_list_secring_command="gpg --no-verbose --batch --with-colons --list-secret-keys %r" + +# specify the uid to use when encrypting/signing +set pgp_sign_as=0x0DA8C91F + +# this set the number of seconds to keep in memory the passpharse used to encrypt/sign +# the more the less secure it will be +set pgp_timeout=60 + +# it's a regexp used against the GPG output: if it matches some line of the output +# then mutt considers the message a good signed one (ignoring the GPG exit code) +set pgp_good_sign="^gpg: Good signature from" + +# mutt uses by default PGP/GPG to sign/encrypt messages +# if you want to use S-mime instead set the smime_is_default variable to yes + +# automatically sign all outcoming messages +set crypt_autosign +# sign only replies to signed messages +set crypt_replysign + +## automatically encrypt outcoming messages +#set crypt_autoencrypt=yes +## encrypt only replies to signed messages +#set crypt_replyencrypt=yes +# encrypt and sign replies to encrypted messages +set crypt_replysignencrypted=yes + +# automatically verify the sign of a message when opened +set crypt_verify_sig=no + +# vim: ft=muttrc diff --git a/files/.mutt/fcc-hooks b/files/.mutt/fcc-hooks new file mode 100644 index 0000000..30a3145 --- /dev/null +++ b/files/.mutt/fcc-hooks @@ -0,0 +1,11 @@ +# vim: ft=muttrc +# Fcc hooks, everything else goes to $record +# + +# Lists +#fcc-save-hook '~t mutt-user' =ml_mutt +#fcc-save-hook '~t vim' =ml_vim +#fcc-save-hook '~t gentoo-user@lists.gentoo.org' =ml_gentoo_user +# fcc-save-hook '~t gentoo-user-ru@lists.gentoo.org' =ml_gentoo_user_ru +#fcc-save-hook '~t awesome@naquadah.org' =ml_awesome +# fcc-save-hook '~t cygwin@cygwin.com' =ml_cygwin diff --git a/files/.mutt/folder-hooks b/files/.mutt/folder-hooks new file mode 100644 index 0000000..70baacd --- /dev/null +++ b/files/.mutt/folder-hooks @@ -0,0 +1,3 @@ +folder-hook . source ~/.mutt/folder-hooks.default + +# vim: ft=muttrc diff --git a/files/.mutt/folder-hooks.default b/files/.mutt/folder-hooks.default new file mode 100644 index 0000000..1f90369 --- /dev/null +++ b/files/.mutt/folder-hooks.default @@ -0,0 +1,10 @@ +reset index_format +push <collapse-all> +push '.i' # see macros for more detail + +set date_format="%a, %e %B %Y в %H:%M" +set attribution="В %d, %n пишет:" + +set from="anton@bobov.name" + +# vim: ft=muttrc diff --git a/files/.mutt/folder-hooks.maillist b/files/.mutt/folder-hooks.maillist new file mode 100644 index 0000000..eb14428 --- /dev/null +++ b/files/.mutt/folder-hooks.maillist @@ -0,0 +1,8 @@ +set index_format="%Z %{%b %d} %-15.15n (%4E) %s" + +reset attribution +set date_format="!%a, %b %d, %Y at %H:%M:%S %Z" + +set from="abobov@gmail.com" + +# vim: ft=muttrc diff --git a/files/.mutt/gen_maillist.sh b/files/.mutt/gen_maillist.sh new file mode 100755 index 0000000..89e13c7 --- /dev/null +++ b/files/.mutt/gen_maillist.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +CONFIG=$(dirname $0)/maillists +RESULT=maillists.generate +FOLDER_HOOK=folder-hooks.maillist + +die() { + echo $1 + exit 1 +} + +add_maillist() { + email=$1 + mailbox=$2 + + echo "# email: $email" + echo "# mailbox: $mailbox" + + # Subscription + echo "subscribe $email" + # Mailboxes + echo "mailboxes \"$mailbox\"" + # Folder hook + echo "folder-hook \"$mailbox\" source $FOLDER_HOOK" + # FCC hook + echo "fcc-hook $email \"$mailbox\"" + + printf "\n\n" +} + +test -f "$CONFIG" || die "Config file ($RESULT) not exists." + +echo "# Generate date: $(date)" > "$RESULT" || die "Can't write file ($RESULT)." +echo "# vim: ft=muttrc :" >> "$RESULT" + +while read email mailbox +do + if [[ -n "$email" ]] + then + if [[ "$(echo $email | sed 's/^\s*#//')" == "$email" ]] + then + add_maillist $email $mailbox >> "$RESULT" + fi + fi +done < "${CONFIG}" diff --git a/files/.mutt/macros b/files/.mutt/macros new file mode 100644 index 0000000..8eb9152 --- /dev/null +++ b/files/.mutt/macros @@ -0,0 +1,16 @@ +macro index,pager S "<save-message>=[Gmail]/Spam<enter>" "mark message as spam" +macro index ,r "<tag-pattern>~N<enter><tag-prefix><clear-flag>N<untag-pattern>.<enter>" "mark all new messages read" +#macro index,pager H "<save-message>=INBOX<enter>" "mark message as ham" + +macro index .i "l((~N|~O|~F)!~D)|(~d<1w!~Q)\n" +macro index .n "l~N\n" +macro index .a "l~A\n" +macro index .t "l~d<1d\n" + +# Threads macros + +macro index,pager za "<Esc>v" +macro index,pager zr "<Esc>V" +macro index,pager zm "<Esc>V" + +# vim: ft=muttrc diff --git a/files/.mutt/mailboxes b/files/.mutt/mailboxes new file mode 100644 index 0000000..52da56a --- /dev/null +++ b/files/.mutt/mailboxes @@ -0,0 +1,9 @@ +# Don't forget add rule to fcc-hooked maillists + +mailboxes ! +mailboxes "=[Gmail].Sent Mail" +mailboxes "=[Gmail].Drafts" +mailboxes "=softdata" +mailboxes "/var/spool/mail/dexter" + +# vim: ft=muttrc diff --git a/files/.mutt/maillists b/files/.mutt/maillists new file mode 100644 index 0000000..3bb0e04 --- /dev/null +++ b/files/.mutt/maillists @@ -0,0 +1,18 @@ +# Maillist subscriptions +# +# Format: +# email mailbox + +mutt-users@mutt.org =ml_mutt +vim@vim.org =ml_vim +gentoo-user@lists.gentoo.org =ml_gentoo_user +gentoo-user-ru@lists.gentoo.org =ml_gentoo_user_ru +awesome@naquadah.org =ml_awesome +rxvt-unicode@lists.schmorp.de =ml_urxvt +cygwin@cygwin.com =ml_cygwin +google-web-toolkit@googlegroups.com =ml_gwt +trac-users@googlegroups.com =ml_trac +tmux-users@lists.sourceforge.net =ml_tmux + + +# vim: ft=conf : diff --git a/files/.mutt/maillists.generate b/files/.mutt/maillists.generate new file mode 100644 index 0000000..d7c7f36 --- /dev/null +++ b/files/.mutt/maillists.generate @@ -0,0 +1,82 @@ +# Generate date: Mon Oct 17 11:49:14 2011 +# vim: ft=muttrc : +# email: mutt-users@mutt.org +# mailbox: =ml_mutt +subscribe mutt-users@mutt.org +mailboxes "=ml_mutt" +folder-hook "=ml_mutt" source folder-hooks.maillist +fcc-hook mutt-users@mutt.org "=ml_mutt" + + +# email: vim@vim.org +# mailbox: =ml_vim +subscribe vim@vim.org +mailboxes "=ml_vim" +folder-hook "=ml_vim" source folder-hooks.maillist +fcc-hook vim@vim.org "=ml_vim" + + +# email: gentoo-user@lists.gentoo.org +# mailbox: =ml_gentoo_user +subscribe gentoo-user@lists.gentoo.org +mailboxes "=ml_gentoo_user" +folder-hook "=ml_gentoo_user" source folder-hooks.maillist +fcc-hook gentoo-user@lists.gentoo.org "=ml_gentoo_user" + + +# email: gentoo-user-ru@lists.gentoo.org +# mailbox: =ml_gentoo_user_ru +subscribe gentoo-user-ru@lists.gentoo.org +mailboxes "=ml_gentoo_user_ru" +folder-hook "=ml_gentoo_user_ru" source folder-hooks.maillist +fcc-hook gentoo-user-ru@lists.gentoo.org "=ml_gentoo_user_ru" + + +# email: awesome@naquadah.org +# mailbox: =ml_awesome +subscribe awesome@naquadah.org +mailboxes "=ml_awesome" +folder-hook "=ml_awesome" source folder-hooks.maillist +fcc-hook awesome@naquadah.org "=ml_awesome" + + +# email: rxvt-unicode@lists.schmorp.de +# mailbox: =ml_urxvt +subscribe rxvt-unicode@lists.schmorp.de +mailboxes "=ml_urxvt" +folder-hook "=ml_urxvt" source folder-hooks.maillist +fcc-hook rxvt-unicode@lists.schmorp.de "=ml_urxvt" + + +# email: cygwin@cygwin.com +# mailbox: =ml_cygwin +subscribe cygwin@cygwin.com +mailboxes "=ml_cygwin" +folder-hook "=ml_cygwin" source folder-hooks.maillist +fcc-hook cygwin@cygwin.com "=ml_cygwin" + + +# email: google-web-toolkit@googlegroups.com +# mailbox: =ml_gwt +subscribe google-web-toolkit@googlegroups.com +mailboxes "=ml_gwt" +folder-hook "=ml_gwt" source folder-hooks.maillist +fcc-hook google-web-toolkit@googlegroups.com "=ml_gwt" + + +# email: trac-users@googlegroups.com +# mailbox: =ml_trac +subscribe trac-users@googlegroups.com +mailboxes "=ml_trac" +folder-hook "=ml_trac" source folder-hooks.maillist +fcc-hook trac-users@googlegroups.com "=ml_trac" + + +# email: tmux-users@lists.sourceforge.net +# mailbox: =ml_tmux +subscribe tmux-users@lists.sourceforge.net +mailboxes "=ml_tmux" +folder-hook "=ml_tmux" source folder-hooks.maillist +fcc-hook tmux-users@lists.sourceforge.net "=ml_tmux" + + diff --git a/files/.mutt/mutt-notmuch b/files/.mutt/mutt-notmuch new file mode 100755 index 0000000..e1fe909 --- /dev/null +++ b/files/.mutt/mutt-notmuch @@ -0,0 +1,189 @@ +#!/usr/bin/perl -w +# +# mutt-notmuch - notmuch (of a) helper for Mutt +# +# Copyright: © 2011 Stefano Zacchiroli <zack@upsilon.cc> +# License: GNU General Public License (GPL), version 3 or above +# +# See the bottom of this file for more documentation. +# A manpage can be obtained by running "pod2man mutt-notmuch > mutt-notmuch.1" + +use strict; +use warnings; + +use File::Path; +use Getopt::Long; +use Mail::Internet; +use Mail::Box::Maildir; +use Pod::Usage; + + +# create an empty maildir (if missing) or empty an existing maildir" +sub empty_maildir($) { + my ($maildir) = (@_); + rmtree($maildir) if (-d $maildir); + my $folder = new Mail::Box::Maildir(folder => $maildir, + create => 1); + $folder->close(); +} + +# search($maildir, $query) +# search mails according to $query with notmuch; store results in $maildir +sub search($$) { + my ($maildir, $query) = @_; + + empty_maildir($maildir); + system("notmuch search --output=files $query" + . " | xargs --no-run-if-empty ln -s -t $maildir/cur/"); +} + +sub search_action($$@) { + my ($interactive, $results_dir, @params) = @_; + + if (! $interactive) { + search($results_dir, join(' ', @params)); + } else { + my $query = ""; + my $done = 0; + while (! $done) { + print "search ('?' for man): "; + chomp($query = <STDIN>); + if ($query eq "?") { + system("man notmuch"); + } elsif ($query eq "") { + $done = 1; # quit doing nothing + } else { + search($results_dir, $query); + $done = 1; + } + } + } +} + +sub thread_action(@) { + my ($results_dir, @params) = @_; + + my $mail = Mail::Internet->new(\*STDIN); + $mail->head->get('message-id') =~ /^<(.*)>$/; # get message-id + my $mid = $1; + my $tid = `notmuch search --output=threads id:$mid`;# get thread id + chomp($tid); + + search($results_dir, $tid); +} + +sub die_usage() { + my %podflags = ( "verbose" => 1, + "exitval" => 2 ); + pod2usage(%podflags); +} + +sub main() { + my $results_dir = "$ENV{HOME}/.cache/mutt_results"; + my $interactive = 0; + my $help_needed = 0; + + my $getopt = GetOptions( + "h|help" => \$help_needed, + "o|output-dir=s" => \$results_dir, + "p|prompt" => \$interactive); + if (! $getopt || $#ARGV < 0) { die_usage() }; + my ($action, @params) = ($ARGV[0], @ARGV[1..$#ARGV]); + + if ($help_needed) { + die_usage(); + } elsif ($action eq "search" && $#ARGV == 0 && ! $interactive) { + print STDERR "Error: no search term provided\n\n"; + die_usage(); + } elsif ($action eq "search") { + search_action($interactive, $results_dir, @params); + } elsif ($action eq "thread") { + thread_action($results_dir, @params); + } else { + die_usage(); + } +} + +main(); + +__END__ + +=head1 NAME + +mutt-notmuch - notmuch (of a) helper for Mutt + +=head1 SYNOPSIS + +=over + +=item B<mutt-notmuch> [I<OPTION>]... search [I<SEARCH-TERM>]... + +=item B<mutt-notmuch> [I<OPTION>]... thread < I<MAIL> + +=back + +=head1 DESCRIPTION + +mutt-notmuch is a frontend to the notmuch mail indexer capable of populating +maildir with search results. + +=head1 OPTIONS + +=over 4 + +=item -o DIR + +=item --output-dir DIR + +Store search results as (symlink) messages under maildir DIR. Beware: DIR will +be overwritten. (Default: F<~/.cache/mutt_results/>) + +=item -p + +=item --prompt + +Instead of using command line search terms, prompt the user for them (only for +"search"). + +=item -h + +=item --help + +Show usage information and exit. + +=back + +=head1 INTEGRATION WITH MUTT + +mutt-notmuch can be used to integrate notmuch with the Mutt mail user agent +(unsurprisingly, given the name). To that end, you should define the following +macros in your F<~/.muttrc> (replacing F<~/bin/mutt-notmuch> for the actual +location of mutt-notmuch on your system): + + macro index <F8> \ + "<enter-command>unset wait_key<enter><shell-escape>~/bin/mutt-notmuch --prompt search<enter><change-folder-readonly>~/.cache/mutt_results<enter>" \ + "search mail (using notmuch)" + macro index <F9> \ + "<enter-command>unset wait_key<enter><pipe-message>~/bin/mutt-notmuch thread<enter><change-folder-readonly>~/.cache/mutt_results<enter><enter-command>set wait_key<enter>" \ + "search and reconstruct owning thread (using notmuch)" + +The first macro (activated by <F8>) will prompt the user for notmuch search +terms and then jump to a temporary maildir showing search results. The second +macro (activated by <F9>) will reconstruct the thread corresponding to the +current mail and show it as search results. + +To keep notmuch index current you should then periodically run C<notmuch +new>. Depending on your local mail setup, you might want to do that via cron, +as a hook triggered by mail retrieval, etc. + +=head1 SEE ALSO + +mutt(1), notmuch(1) + +=head1 AUTHOR + +Copyright: (C) 2011 Stefano Zacchiroli <zack@upsilon.cc> + +License: GNU General Public License (GPL), version 3 or higher + +=cut diff --git a/files/.mutt/mutt.octet.filter b/files/.mutt/mutt.octet.filter new file mode 100755 index 0000000..5409bb2 --- /dev/null +++ b/files/.mutt/mutt.octet.filter @@ -0,0 +1,328 @@ +#!/bin/sh +# +# mutt.octet.filter - Octet filter for use with the mutt autoview facility +# Copyright (C) 1997,1998,1999,2000,2001,2002,2003 David A Pearson +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the license, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# + +# This script file is a pretty brain-dead, last resort, "works for me" +# utility that will attempt to make sense of any octet-stream data +# that is received as part of an email and act as a filter for use +# with mutt's auto_view ability. +# +# Here is how I use it. In my ~/.mutt_mailcap (use your filename of +# choice) I have the following entry: +# +# application/octet-stream; mutt.octet.filter %s; copiousoutput +# +# All you then need to do is add a line like: +# +# auto_view application/octet-stream +# +# to your ~/.muttrc (use your filename of choice). +# +# In it's current state the script isn't perfect, it's your typical +# "works for me" type of script and is offered in the hope that it +# maybe handy and that you can do something with it. +# +# All comments/flames/feedback can be directed to: +# +# davep@davep.org +# +# See <URL:http://www.davep.org/mutt/> for the latest version of this file. + +# $Log: mutt.octet.filter,v $ +# Revision 1.15 2003/09/19 09:47:20 davep +# Added DecodeFileName, submitted by Jan Bredereke. +# +# Revision 1.14 2003/08/08 08:39:01 davep +# Added support for .asc and .rar files. +# +# Revision 1.13 2002/10/21 08:28:05 davep +# Improved ShowImage so that it won't barf on file types that aren't known by +# anytopnm. +# +# Revision 1.12 2002/07/23 15:47:17 davep +# Added code for showing LaTeX files, Debian packages and various Image files, +# submitted by Michael Shigorin. +# +# Revision 1.11 2002/06/19 09:44:07 davep +# Documentation changes. +# +# Revision 1.10 2002/06/19 09:43:39 davep +# Changed ShowMSWord() to use antiword instead of catdoc. +# +# Revision 1.9 2001/10/03 08:13:58 davep +# Added a couple of lines to capture and not display PCX files. This was +# suggested by Jeff Abrahamson. It seems that Lotus Notes has a habit of +# including PCX images as octet-streams. +# +# Revision 1.8 2001/08/13 23:39:36 davep +# Jeff Abrahamson suggested adding ShowTXT and using that as a abstraction +# layer over `cat'. +# +# Revision 1.7 2000/08/31 09:13:29 davep +# Added patch from Aaron Schrab that makes the "data" match in ShowMISC() +# greedier. +# +# Revision 1.6 2000/05/10 13:34:19 davep +# Added patch from Aaron Schrab for handling RPM files. +# +# Revision 1.5 2000/02/28 15:28:13 davep +# Added support for .tar.bz2 files (thanks to Dirk Pirschel for that). +# +# Revision 1.4 1999/08/02 12:39:27 davep +# Minor nit-fix. +# +# Revision 1.3 1999/04/13 17:17:03 davep +# Added support for displaying .o files. +# +# Revision 1.2 1999/01/27 17:35:25 davep +# Added handling for .bz2 files (thanks to Lars Hecking for that). +# Added handling of MSWord documents (requires catdoc). +# +# Revision 1.1 1998/10/14 16:00:25 davep +# Initial revision +# + +ShowTAR() +{ + tar tvvf "$1" 2> /dev/null +} + +ShowTGZ() +{ + tar tzvvf "$1" 2> /dev/null +} + +ShowTBZ() +{ + bzip2 -dc "$1" | tar -tvv -f- 2> /dev/null +} + +ShowGZIP() +{ + gzip -dc "$1" 2> /dev/null +} + +ShowBZIP() +{ + bzip2 -dc "$1" 2> /dev/null +} + +ShowZIP() +{ + unzip -l "$1" 2> /dev/null +} + +ShowARJ() +{ + unarj l "$1" 2> /dev/null +} + +ShowRAR() +{ + unrar l "$1" 2> /dev/null +} + +ShowEXE() +{ + echo $(basename "$1"): DOS/Windows executable +} + +ShowOBJ() +{ + echo $(basename "$1"): DOS/Windows object file +} + +ShowLIB() +{ + echo $(basename "$1"): MS-DOS program library +} + +ShowNG() +{ + echo $(basename "$1"): Norton Guide Database +} + +ShowVCard() +{ + cat "$1" | mutt.vcard.filter +} + +ShowTIF() +{ + tiffinfo "$1" +} + +ShowMSWord() +{ + antiword "$1" +} + +ShowObject() +{ + nm "$1" +} + +ShowRPM() +{ + rpm -qip "$1" +} + +ShowDEB() +{ + dpkg --info "$1" + dpkg --contents "$1" +} + +ShowTXT() +{ + echo "[-- Statistics (lines words chars): "$(wc "$1")" --]" + echo + cat -v "$1" +} + +ShowImage() +{ + if anytopnm "$1" > /dev/null 2>&1 + then + (anytopnm "$1" | pnmscale -xysize 240 120 | ppmtopgm | pgmtopbm | pbmtoascii -2x4) 2>&1 + else + echo "$(basename $1) is not a supported image type" + fi +} + +ShowLaTeX() +{ + dir=`mktemp -td mailtex_XXXXXXXX` + ln -s "$1" $dir/index.tex + # TODO: fix latex preamble if absent? -- mike@altlinux.com + latex2html -ascii_mode -noinfo -split 0 -verbosity 0 -noshow_init -dir $dir "$dir/index.tex" > /dev/null + lynx -dump $dir/index.html + rm -rf $dir +} + +ShowData() +{ + echo $(basename "$1"): unprintable data +} + +DisplayFileType() +{ + echo "[-- $(basename $0) file type: \"$1\" --]" + echo +} + +ShowFileType() +{ + FILE_TYPE=$(echo $(file "$1" 2> /dev/null) | cut -d' ' -f 2-) + DisplayFileType "$FILE_TYPE" +} + +DecodeFileName() +{ + # remove character set encodings: + # mutt translates "=?ISO-8859-1?Q?x=E4y.doc?=" + # to "__ISO-8859-1_Q_x_E4y.doc__", we + # translate it to "x_E4y.doc" + echo "$1" | sed -e 's/__[^_]*_Q_\(.*\)__/\1/g' +} + +ShowMISC() +{ + FILE_TYPE=$(file -z "$1" 2> /dev/null) + + if [ $? -gt 0 ] + then + FILE_TYPE=$(file "$1" 2> /dev/null) + fi + + FILE_TYPE=$(echo "$FILE_TYPE" | cut -d' ' -f 2-) + + DisplayFileType "$FILE_TYPE" + + case "$FILE_TYPE" in + *tar*archive*gzip* ) ShowTGZ "$1";; + *tar*archive* ) ShowTAR "$1";; + *gzip* ) ShowGZIP "$1";; + *ARJ*archive*data* ) ShowARJ "$1.";; # "." gets round bug in unarj. + *zip*archive*file* ) ShowZIP "$1";; + *DOS*executable* ) ShowEXE "$1";; + *ascii*text* ) ShowTXT "$1";; + *c*program*text* ) ShowTXT "$1";; + *8086*reloc*Micro* ) ShowOBJ "$1";; + *MS-DOS*prog*lib* ) ShowLIB "$1";; + *LaTeX*text ) ShowLaTeX "$1";; + *data* ) ShowData "$1";; + *Photoshop* ) ;; + * ) ShowTXT "$1";; + esac +} + +if [ "$1" = "" ] +then + echo "syntax: $(basename '$0') file" +else + case $(DecodeFileName "$1") in + *.tar ) ShowFileType "$1"; ShowTAR "$1";; + *.tgz ) ShowFileType "$1"; ShowTGZ "$1";; + *.tar.gz ) ShowFileType "$1"; ShowTGZ "$1";; + *.tar.Z ) ShowFileType "$1"; ShowTGZ "$1";; + *.tar.z ) ShowFileType "$1"; ShowTGZ "$1";; + *.tbz2 ) ShowFileType "$1"; ShowTBZ "$1";; + *.tar.bz2 ) ShowFileType "$1"; ShowTBZ "$1";; + *.Z ) ShowFileType "$1"; ShowGZIP "$1";; + *.z ) ShowFileType "$1"; ShowGZIP "$1";; + *.gz ) ShowFileType "$1"; ShowGZIP "$1";; + *.bz2 ) ShowFileType "$1"; ShowBZIP "$1";; + *.zip ) ShowFileType "$1"; ShowZIP "$1";; + *.ZIP ) ShowFileType "$1"; ShowZIP "$1";; + *.arj ) ShowFileType "$1"; ShowARJ "$1";; + *.ARJ ) ShowFileType "$1"; ShowARJ "$1";; + *.rar ) ShowFileType "$1"; ShowRAR "$1";; + *.RAR ) ShowFileType "$1"; ShowRAR "$1";; + *.log ) ShowFileType "$1"; ShowTXT "$1";; + *.LOG ) ShowFileType "$1"; ShowTXT "$1";; + *.obj ) ShowFileType "$1"; ShowOBJ "$1";; + *.OBJ ) ShowFileType "$1"; ShowOBJ "$1";; + *.lib ) ShowFileType "$1"; ShowLIB "$1";; + *.LIB ) ShowFileType "$1"; ShowLIB "$1";; + *.NG ) ShowFileType "$1"; ShowNG "$1";; + *.ng ) ShowFileType "$1"; ShowNG "$1";; + *.vcf ) ShowFileType "$1"; ShowVCard "$1";; + *.tif ) ShowFileType "$1"; ShowTIF "$1";; + *.TIF ) ShowFileType "$1"; ShowTIF "$1";; + *.doc ) ShowFileType "$1"; ShowMSWord "$1";; + *.DOC ) ShowFileType "$1"; ShowMSWord "$1";; + *.o ) ShowFileType "$1"; ShowObject "$1";; + *.rpm ) ShowFileType "$1"; ShowRPM "$1";; + *.deb ) ShowFileType "$1"; ShowDEB "$1";; + *.tex ) ShowFileType "$1"; ShowLaTeX "$1";; + *.TEX ) ShowFileType "$1"; ShowLaTeX "$1";; + *.pcx ) ShowFileType "$1"; ShowImage "$1";; + *.PCX ) ShowFileType "$1"; ShowImage "$1";; + *.jpg ) ShowFileType "$1"; ShowImage "$1";; + *.JPG ) ShowFileType "$1"; ShowImage "$1";; + *.gif ) ShowFileType "$1"; ShowImage "$1";; + *.GIF ) ShowFileType "$1"; ShowImage "$1";; + *.png ) ShowFileType "$1"; ShowImage "$1";; + *.PNG ) ShowFileType "$1"; ShowImage "$1";; + *.asc ) ShowFileType "$1"; ShowTXT "$1";; + *.ASC ) ShowFileType "$1"; ShowTXT "$1";; + * ) ShowMISC "$1";; + esac +fi diff --git a/files/.mutt/mutt_mailcap b/files/.mutt/mutt_mailcap new file mode 100644 index 0000000..7ffba72 --- /dev/null +++ b/files/.mutt/mutt_mailcap @@ -0,0 +1,6 @@ +application/msword; oowriter %s +application/octet-stream; ~/.mutt/mutt.octet.filter %s; copiousoutput +image/*; geeqie '%s' +text/html; lynx -display_charset=utf-8 -assume_charset=%{charset} -dump -force_html '%s'; copiousoutput; description=H + +# vim: ft=muttrc : diff --git a/files/.mutt/muttrc b/files/.mutt/muttrc new file mode 100644 index 0000000..ca6d353 --- /dev/null +++ b/files/.mutt/muttrc @@ -0,0 +1,139 @@ +# .muttrc file for mutt +# Muttrc file +# Based on the muttrc file by Dave Pearson +# Based on the nuttrc fule by Simon Huggins + +# Mail boxes +#set mbox_type=Maildir +#set spoolfile="~/Mail/" +#set folder="~/Mail" + +#set smtp_url="smtp://abobov@smtp.gmail.com:587/" +set reverse_name +#Gmail IMAP config +#set folder="imaps://imap.gmail.com:993" +#set spoolfile="+INBOX" +#set postponed="+[Gmail]/Drafts" +#set message_cachedir="~/.mutt/cache/bodies" +#set certificate_file="~/.mutt/certificates" + +#Gmail maildir config +set folder="~/Mail/Gmail" +set spoolfile="+INBOX" +set postponed="+[Gmail].Drafts" + +set header_cache="~/.mutt/cache/headers" + +set mbox=+mbox + +set signature="~/.mutt/signature" + +set assumed_charset="cp1251:koi8-r:utf-8" +set attach_charset="cp1251:koi8-r:utf-8" + +set hostname="dexter-laptop" + +alternates "anton@bobov.name" "abobov@gmail.com" + +set print=ask-yes +set print_command="muttprint" + +## +# General options +# + +set nohelp +set locale="ru_RU.UTF8" +set alias_file=~/.mutt/aliases + +set hdrs # add my_hdr lines + +set postpone=ask-no +#set postponed=+postponed +#set move=ask-yes # ask me to move read messages to mbox +set move=no +set include=yes # include message in reply +set delete=yes # just delete then select to delete +set sort=threads +set sort_aux=date-received +set charset=utf-8 # terminal charset +set allow_8bit +set rfc2047_parameters +set mail_check=120 # check for new mail every 120 seconds + +set edit_headers # change headers with body in editor + +set editor="vim -c '/^$/+1' -c nohl" +set visual="vim" + +set menu_scroll + +#set autoedit # don't ask me anyrging, let's go to compose msg +set nomark_old # not mark new unread messages as old +set copy=no # keep copies of outgoing mail +unset record # GMail automatically save in [Gmail]/Sent Mail +set nobeep +set smart_wrap +set nomarkers # don't want ant wrap markers +set pager_context=3 # XXX +set envelope_from # XXX +set tilde # fill message to end of screen with ~ +set pager_stop # don't move to next msg on end +#set pager_index_lines=1 # XXX +set nowrite_bcc # don't show Bcc on write msgs +set ascii_chars +unset collapse_unread # never collapse thread with unread msgs +set fast_reply # don't ask me, just reply +set realname="Anton Bobov" # + +set pager_index_lines=11 # show msgs from index in pager +set noconfirmappend # don't ask me about appending msgs to other + # boxes +set query_command="abook --mutt-query '%s'" +set to_chars=" +TCF " # Drop the "L". + +set thorough_search + +set sidebar_width=25 +set sidebar_visible=yes + + +## +# MIME-types to auto_view +# +set mailcap_path=~/.mutt/mutt_mailcap:/etc/mailcap + +auto_view application/octet-stream +auto_view text/html + +# Ignore some headers +ignore * +unignore From Subject To CC Date Attach +unignore X-Mailer: X-Mailing-List: User-Agent: + +# Order visible header lines +hdr_order From Subject Date To CC + +# Default from +#my_hdr From: Anton Bobov <abobov@gmail.com> +my_hdr X-Attribution: AB +my_hdr X-PGP-Key: http://id.bobov.name/pubkey.asc + +# +# Source files +# + +source ~/.mutt/macros +source ~/.mutt/bindings +source ~/.mutt/colors +source ~/.mutt/mailboxes +source ~/.mutt/subscriptions +source ~/.mutt/crypto +source $alias_file +source ~/.mutt/secret +source ~/.mutt/folder-hooks +source ~/.mutt/fcc-hooks +source ~/.mutt/send-hooks +source ~/.mutt/maillists.generate + +push V diff --git a/files/.mutt/send-hooks b/files/.mutt/send-hooks new file mode 100644 index 0000000..f2fadf2 --- /dev/null +++ b/files/.mutt/send-hooks @@ -0,0 +1,5 @@ +#send-hook . "set crypt_autosign" + +#send-hook '~t test@example.com' "unset crypt_autosign" + +# vim: ft=muttrc diff --git a/files/.mutt/signature b/files/.mutt/signature new file mode 100644 index 0000000..b13f51f --- /dev/null +++ b/files/.mutt/signature @@ -0,0 +1,2 @@ +Cheers, +Anton diff --git a/files/.mutt/subscriptions b/files/.mutt/subscriptions new file mode 100644 index 0000000..138548e --- /dev/null +++ b/files/.mutt/subscriptions @@ -0,0 +1,14 @@ +# vim: ft=muttrc +# +# List of mail lists I'm subscribed to. +# +# Don't forget change folder-hook + +#subscribe mutt-user +#subscribe vim +#subscribe google-web-toolkit@googlegroups.com +#subscribe jboss-user@lists.jboss.org +#subscribe gentoo-user-ru@lists.gentoo.org +#subscribe gentoo-user@lists.gentoo.org +#subscribe awesome@naquadah.org +#subscribe cygwin@cygwin.com |
