diff options
| author | Anton Bobov <abobov@gmail.com> | 2013-10-18 21:00:48 +0600 |
|---|---|---|
| committer | Anton Bobov <abobov@gmail.com> | 2013-10-19 00:47:57 +0600 |
| commit | ad704b4b8b15765b93e385c7431b19202b0bbe71 (patch) | |
| tree | 6488a6bceec06779ea1bb85c87a34277c37e3e62 | |
| parent | 0feed796b4c309b460295443aa849ce1f9b98565 (diff) | |
Mail related changes.
Add offlineimap and msmtp configs. Cleanup mutt configs.
Changes inspired by Steve Losh post:
http://stevelosh.com/blog/2012/10/the-homely-mutt/.
| -rw-r--r-- | files/.msmtprc | 17 | ||||
| -rw-r--r-- | files/.mutt/bindings | 39 | ||||
| -rw-r--r-- | files/.mutt/fcc-hooks | 11 | ||||
| -rw-r--r-- | files/.mutt/folder-hooks.default | 9 | ||||
| -rw-r--r-- | files/.mutt/macros | 10 | ||||
| -rw-r--r-- | files/.mutt/mailboxes | 5 | ||||
| -rwxr-xr-x | files/.mutt/mutt-notmuch | 189 | ||||
| -rw-r--r-- | files/.mutt/mutt_mailcap | 1 | ||||
| -rw-r--r-- | files/.mutt/muttrc | 33 | ||||
| -rw-r--r-- | files/.mutt/send-hooks | 5 | ||||
| -rw-r--r-- | files/.mutt/subscriptions | 14 | ||||
| -rw-r--r-- | files/.offlineimaprc | 36 |
12 files changed, 96 insertions, 273 deletions
diff --git a/files/.msmtprc b/files/.msmtprc new file mode 100644 index 0000000..72b5016 --- /dev/null +++ b/files/.msmtprc @@ -0,0 +1,17 @@ +defaults + logfile ~/Mail/msmtp.log + +account gmail + host smtp.gmail.com + from abobov@gmail.com + auth on + tls on + tls_trust_file /etc/ssl/certs/ca-certificates.crt + tls_starttls on + # Password stored in ~/.netrc + user abobov@gmail.com + port 587 + +account default: gmail + +# vim: nobackup noswapfile : diff --git a/files/.mutt/bindings b/files/.mutt/bindings index 3ed33a3..68da22c 100644 --- a/files/.mutt/bindings +++ b/files/.mutt/bindings @@ -1,29 +1,26 @@ -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 gg first-entry +bind index G last-entry +bind index { previous-thread +bind index } 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 index F flag-message +bind index p recall-message + + +bind index,pager \CP sidebar-prev +bind index,pager \CN sidebar-next +bind index,pager \CO sidebar-open + +bind pager k previous-line +bind pager j next-line +bind pager gg top +bind pager G bottom -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 + +bind compose p postpone-message # vim: ft=muttrc diff --git a/files/.mutt/fcc-hooks b/files/.mutt/fcc-hooks deleted file mode 100644 index 30a3145..0000000 --- a/files/.mutt/fcc-hooks +++ /dev/null @@ -1,11 +0,0 @@ -# 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.default b/files/.mutt/folder-hooks.default index 1f90369..2ea8819 100644 --- a/files/.mutt/folder-hooks.default +++ b/files/.mutt/folder-hooks.default @@ -1,9 +1,10 @@ -reset index_format +set index_format="[%Z] %D %-20.20F %s" push <collapse-all> -push '.i' # see macros for more detail +#push '.i' # see macros for more detail -set date_format="%a, %e %B %Y в %H:%M" -set attribution="В %d, %n пишет:" +set date_format="!%d %B" +set forward_format="Fwd: %s" +set attribution="On %d, %n wrote:" set from="anton@bobov.name" diff --git a/files/.mutt/macros b/files/.mutt/macros index 8eb9152..d587b71 100644 --- a/files/.mutt/macros +++ b/files/.mutt/macros @@ -2,10 +2,12 @@ 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" +macro index .i "l((~N|~O|~F)!~D)|(~d<1w!~Q)\n" "list new, flagged or one week messages" +macro index .n "l~N\n" "list only new messages" +macro index .a "l~A\n" "list all messages" +macro index .t "l~d<1d\n" "list today messages" +macro index O "<shell-escape>offlineimap<enter>" "sync all mailboxes" +macro index o "<shell-escape>offlineimap -qf INBOX<enter>" "sync INBOX" # Threads macros diff --git a/files/.mutt/mailboxes b/files/.mutt/mailboxes index 664c93a..2e42104 100644 --- a/files/.mutt/mailboxes +++ b/files/.mutt/mailboxes @@ -1,7 +1,8 @@ # Don't forget add rule to fcc-hooked maillists mailboxes ! -mailboxes "=[Gmail].Sent Mail" -mailboxes "=[Gmail].Drafts" +mailboxes =archive +mailboxes =sent +mailboxes =drafts # vim: ft=muttrc diff --git a/files/.mutt/mutt-notmuch b/files/.mutt/mutt-notmuch deleted file mode 100755 index e1fe909..0000000 --- a/files/.mutt/mutt-notmuch +++ /dev/null @@ -1,189 +0,0 @@ -#!/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_mailcap b/files/.mutt/mutt_mailcap index b3419ca..d9facf6 100644 --- a/files/.mutt/mutt_mailcap +++ b/files/.mutt/mutt_mailcap @@ -1,6 +1,7 @@ application/msword; oowriter %s application/octet-stream; ~/.mutt/mutt.octet.filter %s; copiousoutput image/*; geeqie '%s' +text/html; x-www-browser '%s'; test=test -n "$DISPLAY"; nametemplate=%s.html text/html; lynx -display_charset=utf-8 -assume_charset=%{charset} -dump -force_html '%s' | sed 's/^\ \ \ //'; copiousoutput; description=H # vim: ft=muttrc : diff --git a/files/.mutt/muttrc b/files/.mutt/muttrc index 859fbdf..a12fe6a 100644 --- a/files/.mutt/muttrc +++ b/files/.mutt/muttrc @@ -4,30 +4,19 @@ # Based on the nuttrc fule by Simon Huggins # Mail boxes -#set mbox_type=Maildir -#set spoolfile="~/Mail/" -#set folder="~/Mail" +set mbox_type=Maildir -#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" -set sendmail="/usr/bin/msmtp" +set sendmail="/usr/bin/msmtp --domain $HOSTNAME" -#Gmail maildir config set folder="~/Mail/Gmail" set spoolfile="+INBOX" -set postponed="+[Gmail].Drafts" +set mbox=+archive +set postponed=+drafts set header_cache="~/.mutt/cache/headers" -set mbox=+mbox - set signature="~/.mutt/signature" set assumed_charset="cp1251:koi8-r:utf-8" @@ -43,19 +32,16 @@ set print_command="muttprint" # 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 sort_aux=reverse-last-date-received set charset=utf-8 # terminal charset set allow_8bit set rfc2047_parameters @@ -73,6 +59,8 @@ 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 beep_new +set pipe_decode set smart_wrap set nomarkers # don't want ant wrap markers set pager_context=3 # XXX @@ -83,6 +71,7 @@ set pager_stop # don't move to next msg on end set nowrite_bcc # don't show Bcc on write msgs set ascii_chars unset collapse_unread # never collapse thread with unread msgs +set uncollapse_jump set fast_reply # don't ask me, just reply set realname="Anton Bobov" # @@ -97,6 +86,8 @@ set thorough_search set sidebar_width=25 set sidebar_visible=yes +set status_format = "---[ Folder: %f ]---[%r%m messages%?n? (%n new)?%?d? (%d to delete)?%?t? (%t tagged)? ]---%>-%?p?( %p postponed )?---" + ## # MIME-types to auto_view @@ -127,12 +118,8 @@ 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 push V diff --git a/files/.mutt/send-hooks b/files/.mutt/send-hooks deleted file mode 100644 index f2fadf2..0000000 --- a/files/.mutt/send-hooks +++ /dev/null @@ -1,5 +0,0 @@ -#send-hook . "set crypt_autosign" - -#send-hook '~t test@example.com' "unset crypt_autosign" - -# vim: ft=muttrc diff --git a/files/.mutt/subscriptions b/files/.mutt/subscriptions deleted file mode 100644 index 138548e..0000000 --- a/files/.mutt/subscriptions +++ /dev/null @@ -1,14 +0,0 @@ -# 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 diff --git a/files/.offlineimaprc b/files/.offlineimaprc new file mode 100644 index 0000000..94a9a4c --- /dev/null +++ b/files/.offlineimaprc @@ -0,0 +1,36 @@ +[general] +accounts = Gmail +socktimeout = 60 +fsync = False + +[Account Gmail] +localrepository = LocalGmail +remoterepository = RemoteGmail +status_backend = sqlite +postsynchook = notmuch new + +[Repository LocalGmail] +type = Maildir +localfolders = ~/Mail/Gmail +nametrans = lambda folder: { 'drafts': '[Gmail]/Drafts', + 'sent': '[Gmail]/Sent Mail', + 'flagged': '[Gmail]/Starred', + 'archive': '[Gmail]/All Mail', + }.get(folder, folder) + +[Repository RemoteGmail] +type = Gmail +maxconnections = 1 +# Password stored in ~/.netrc +remoteuser = abobov@gmail.com +realdelete =no +nametrans = lambda folder: { '[Gmail]/Drafts': 'drafts', + '[Gmail]/Sent Mail': 'sent', + '[Gmail]/Starred': 'flagged', + '[Gmail]/All Mail': 'archive', + }.get(folder, folder) +folderfilter = lambda folder: folder not in [ '[Gmail]/Spam', + '[Gmail]/Starred', + '[Gmail]/Trash', + '[Gmail]/Important', + ] |
