|
一个人的Muttrc,很有借鉴价值,原网址:http://www.hserus.net/muttrc.html
Here's my .muttrc file. Feel free to use it, abuse it, change it, whatever. It's meant for newer versions (1.3 and above) of mutt, especially the set envelope_from command, and the "subscribe" for mailing lists, instead of the old "lists". Read the README.UPGRADE file in your copy of the mutt docs for more. Yep, I know 1.3.x is 'devel' and 1.2.5i is stable - but the devel tree is a bit better right now than 1.2.5i (more features, more stability even)
# .muttrc file - Suresh Ramasubramanian
# Don't display certain headers
ignore *
unignore From To Cc Subject Date Reply-To Organization X-Mailer User-Agent
# Order to display the headers in
hdr_order From: Date: To: Cc: Subject:
# Default From: line for when mailing in batch mode
my_hdr From: foo@bar.com (Foo Bar)
set imap_user="username@my.imap.server"
set imap_pass="my_imap_password"
set certificate_file=mutt.crt
set ssl_starttls=no
# Automatically begin editing messages
set autoedit=yes
set edit_headers
# Append messages to other mailboxes automatically
unset confirmappend
# Automatically delete messages
set delete=yes
# View html mails using lynx
set implicit_autoview
auto_view text/html application/x-pgp-message
set mailcap_path="~/.mailcap"
set mailcap_sanitize=yes
# envelope sender must match
set envelope_from
# Reply FASTER!
#set fast_reply
# Don't save outgoing attachments
unset fcc_attach
# Dont include self in reply
unset reply_self
# Include full headers in replies
# set header
#set hostname - if not machine name (uname -a)
#will be used for - among other things - making
#up message-ids
#set hostname="kcircle.com"
# Automatically quote message
set include=yes
# Set quotemark to 1 byte
set indent_str="> "
set index_format = "%4C %Z %{%b %d} %-15.15F (%4l) %s"
set forward_format="Fw: %s" # subject in forwarded messages
set date_format="%d/%m/%y %H:%M %Z"
set quote_regexp="^([A-Za-z ]+>|[]%>:|}-][]>:|}-]*)"
#set reply_regexp="^(re([\\[0-9\\]+])*|aw):[ \t]*"
set reply_regexp='^((re(\[[0-9]+\])?: *)?(\[[^]]+\] *)?)*'
set mime_forward=ask-yes
# Use mutt.view as my pager
# set pager=mutt.view
set edit_headers
# Use vim as the editor - this line will wrap
# Set wordwrap on in vim to automatically wrap lines -
# no :gq all the time
set editor="vim +':set textwidth=77' +':set wrap' +\`awk '/^$/ {print i+2; exit} {i++}' %s\` %s"
#set visual=vim # editor invoked by ~v in the builtin editor
# dont mark messages old
set nomark_old
# Location for postponed messages
set postponed="=postponed"
# I don't want to resume postponed messages
#set recall=no
# Save copies of outgoing e-mail
set record="=sent-mail"
# Don't confirm using Reply-To: headers
set reply_to=yes
# Delete empty mailboxes
unset save_empty
# Use as from the address mail was sent to
# You'd have to define $alternates for this
# set reverse_name
# Set my web browser
#set web_browser="lynx %s"
# Save mail to =received when I press ">", like in Elm
set mbox="=received"
# Apply operations to tagged messages automatically
set auto_tag
# Define the directory where mutt looks for mailboxes to
# report new mail
mailboxes `echo $HOME/mail/*`
# Tell mutt which mails to recognize as mailing lists
subscribe linux
subscribe freebsd
folder-hook . set sort=threads
folder-hook . set signature="~/sig.suresh|"
folder-hook . 'set attribution="+++ %n [%d]:"'
folder-hook . my_hdr From: foo@bar.com (Foo Bar)
folder-hook . my_hdr Organization: Eh? What's that?
folder-hook . my_hdr X-OS: `uname -mnrs`
# Ignore annoying MAIL SYSTEM INTERNAL DATA message
# generated by c-client (pine / uw-imapd)
folder-hook . "push \"l!(~s 'FOLDER INTERNAL DATA')\n*\""
#folder-hook linux unmy_hdr reply-to
folder-hook linux 'set attribution="+++ %n [linux] [%d]:"'
folder-hook linux my_hdr From: linux@bar.com (Foo Linux)
folder-hook linux my_hdr Organization: Hopelessly Disorganized
folder-hook linux set signature="~/sig.unix|"
folder-hook freebsd set signature="~/sig.unix|"
folder-hook freebsd 'set attribution="+++ %n [freebsd] [%d]:"'
folder-hook freebsd my_hdr From: freebsd@bar.com (Foo FreeBSD)
folder-hook freebsd my_hdr Organization: Hmmm... I dunno
# color patterns for mutt
color normal white black # normal text
color indicator yellow default # actual message
color tree brightmagenta default # thread arrows
color status yellow default # status line
color error brightred default # errors
color message magenta default # info messages
color signature magenta default # signature
color attachment brightyellow red # MIME attachments
color search brightyellow red # search matches
color tilde brightmagenta default # ~ at bottom of msg
color markers red default # + at beginning of wrapped lines
color hdrdefault cyan default # default header lines
color bold red default # hiliting bold patterns in body
color underline green default # hiliting underlined patterns in body
color quoted cyan default # quoted text
color quoted1 magenta default
color quoted2 red default
color quoted3 green default
color quoted4 magenta default
color quoted5 cyan default
color quoted6 magenta default
color quoted7 red default
color quoted8 green default
color quoted9 cyan default
color body cyan default "((ftp|http|https)://|news[^ >)\"\t]+"
color body cyan default "[-a-z_0-9.+]+@[-a-z_0-9.]+"
color body red default "(^| )\\*[-a-z0-9*]+\\*[,.?]?[ \n]"
color body green default "(^| )_[-a-z0-9_]+_[,.?]?[\n]"
color body red default "(^| )\\*[-a-z0-9*]+\\*[,.?]?[ \n]"
color body green default "(^| )_[-a-z0-9_]+_[,.?]?[ \n]"
color index cyan default ~F # Flagged
color index red default ~N # New
color index magenta default ~T # Tagged
color index cyan default ~D # Deleted
# Don't ask to move read messages to mbox on exit
set move=no
###
# Bindings - change key bindings
###
# Customize the pager
bind pager [ previous-line
bind pager < previous-line
bind pager ] next-line
bind pager > next-line
bind pager down next-page
bind pager up previous-page
# dual window view in mutt
# set pager_index_lines=10
# Similar settings for the index
bind index [ previous-line
bind index ] next-line
# imitate the old search-body function
macro index \eb '/~b ' 'search in message bodies'
# simluate the old url menu
macro index \cb |urlview\n 'call urlview to extract URLs out of a message'
macro pager \cb |urlview\n 'call urlview to extract URLs out of a message'
# Show documentation when pressing F1
macro generic <f1> "!less /usr/doc/mutt/manual.txt\n" "Show Mutt documentation"
macro index <f1> "!less /usr/doc/mutt/manual.txt\n" "Show Mutt documentation"
macro pager <f1> "!less /usr/doc/mutt/manual.txt\n" "Show Mutt documentation"
# Set and source our alias file
set alias_file=~/.mutt-aliases
source ~/.mutt-aliases
# pgp stuff - Snarfed from Roland Rosenfeld http://www.spinnaker.de
# For Mutt 1.3.x versions only - go to his website if you want the
# version for older (1.2.5i say) mutts
source ~/gpg.rc
set fcc_clear
set forward_decrypt
unset pipe_decode
set pgp_ignore_subkeys # On OpenPGP keys only show the main key, not the sub.
unset pgp_autosign # pgp sign every outgoing mail. (send-hook?)
unset pgp_autoencrypt # pgp encrypt every outgoing mail. (send-hook?)
set pgp_create_traditional=ask-no # Use old-style PGP? (don't do it!)
set pgp_replyencrypt # Encrypt replies on encrypted mail
set pgp_replysign # Sign replies on signed mail
set pgp_replysignencrypted # Sign replies on encrypted mail
unset pgp_retainable_sigs # disable retainable signatures.
set pgp_verify_sig=yes # ask me whether I want to check a pgp signature
set pgp_timeout=7200 # forget PGP passphrase after 7200 seconds (=2 hours)
set pgp_strict_enc # allway use QP enc. with PGP.
unset pgp_long_ids # display 64bit PGP key-ids (don't change this!)
set pgp_show_unusable # show unusable PGP keys in menu
# %n = number %k = key id %K = key id of the principal key
# %u = user id %a = algorithm %A = algorithm of the princ. key
# %l = length %L = length of the princ. key
# %f = flags %F = flags of the princ. key
# %c = capabilities %C = capabilities of the princ. key
# %t = trust/validity of the key-uid association
set pgp_entry_format="%4n %t%f %[%y/%m/%d] %4l/0x%k %-4a %2c %u"
set pgp_sort_keys=trust
# Once you are done with composing a mail in vim, and
# before you press y to send out an email, just press
# S and enter your PGP passphrase to pgp-clearsign an
# email. Mutt uses PGP-MIME signatures by default, and
# several clients (most notably windows clients) absolutely
# hate the very idea of PGP-MIME
# Put your gpg key id below instead of my key 0xEDEDEFB9
macro compose S "Fgpg -a --clearsign -u 0xEDEDEFB9"
See that a file called .mutt-aliases exists in your home directory when you start mutt (or it will bitch that it can't find it). Just enter "touch .mutt-aliases" at your shell prompt, or add addresses by yourself in the format
alias joe Joe Blow <joe.blow@warez.slashdot.org>
Of course, you can just press "a" when viewing a message and you'll be able to add the sender to your alias file.
sig.unix or whatever would look like this - change the paths if they don't fit your distro
#!/bin/bash
cat .signature
/usr/games/fortune lost
This just prints out a short signature file - and then adds a random fortune cookie to the bottom of the sig. "fortune lost" uses a fortune file generated from the LOST project (http://lost.sourceforge.net) - the Linux One Stanza Tip. You can also subscribe to the LOST mailing list
You then need a couple of other files - gpg.rc and .mailcap ... you also need another binary - gpg-2comp - which is available from http://muppet.faveve.uni-stuttgart.de/~gero/gpg-2comp/
gpg.rc - snarfed from Roland Rosenfeld http://www.spinnaker.de
# -*-muttrc-*-
#
# Command formats for gpg.
#
# This version uses gpg-2comp from
# http://muppet.faveve.uni-stuttgart.de/~gero/gpg-2comp/
#
# $ Id: gpg.rc,v 1.7 2000/02/02 10:40:59 roland Exp roland $
#
# %p The empty string when no passphrase is needed,
# the string "GPPASSFD=0" if one is needed.
#
# This is mostly used in conditional % sequences.
#
# %f Most PGP commands operate on a single file or a file
# containing a message. %f expands to this file's name.
#
# %s When verifying signatures, there is another temporary file
# containing the detached signature. %s expands to this
# file's name.
#
# %a In "signing" contexts, this expands to the value of the
# configuration variable $pgp_sign_as. You probably need to
# use this within a conditional % sequence.
#
# %r In many contexts, mutt passes key IDs to pgp. %r expands to
# a list of key IDs.
# decode application/pgp
#set pgp_decode_command="gpg %?p?--passphrase-fd 0? --no-verbose --batch -o - %f"
set pgp_decode_command="gpg %?p?--passphrase-fd 0? --batch --output - %f"
# verify a pgp/mime signature
#set pgp_verify_command="gpg --no-verbose --batch -o - --verify %s %f"
set pgp_verify_command="gpg --batch --output - --verify %s %f"
# decrypt a pgp/mime attachment
set pgp_decrypt_command="gpg --passphrase-fd 0 --no-verbose --batch --output - %f"
# create a pgp/mime signed attachment
set pgp_sign_command="gpg-2comp --no-verbose --batch --output - --passphrase-fd 0 --armor --detach-sign --textmode %?a?-u %a? %f"
# create a application/pgp signed (old-style) message
set pgp_clearsign_command="gpg-2comp --no-verbose --batch --output - --passphrase-fd 0 --armor --textmode --clearsign %?a?-u %a? %f"
# create a pgp/mime encrypted attachment
set pgp_encrypt_only_command="pgpewrap gpg-2comp -v --batch --output - --encrypt --textmode --armor --always-trust -- -r %r -- %f"
# create a pgp/mime encrypted and signed attachment
set pgp_encrypt_sign_command="pgpewrap gpg-2comp --passphrase-fd 0 -v --batch -o - --encrypt --sign %?a?-u %a? --armor --always-trust -- -r %r -- %f"
# import a key into the public key ring
set pgp_import_command="gpg --no-verbose --import -v %f"
# export a key from the public key ring
set pgp_export_command="gpg --no-verbose --export --armor %r"
# verify a key
set pgp_verify_key_command="gpg --no-verbose --batch --fingerprint --check-sigs %r"
# read in the public key ring
set pgp_list_pubring_command="gpg --no-verbose --batch --with-colons --list-keys %r"
# read in the secret key ring
set pgp_list_secring_command="gpg --no-verbose --batch --with-colons --list-secret-keys %r"
# receive key from keyserver:
#set pgp_getkeys_command="wrap.sh -g %r"
set pgp_getkeys_command=""
# string that the verify command outputs if the signature is good
#set pgp_good_sign="Good signature" # English version
set pgp_good_sign="" # not needed, if exit code ok.
.mailcap
All this assumes you have gpg, lynx, xv and freeamp (for mp3z) installed
text/html; lynx -dump %s; nametemplate=%s.htm; copiousoutput
application/pgp-keys; gpg -f < %s ; copiousoutput
application/vnd.rn-rn_music_package;freeamp %s
application/x-freeamp-theme;freeamp %s
audio/mp3;freeamp %s
audio/mpeg;freeamp %s
audio/mpegurl;freeamp %s
audio/scpls;freeamp %s
audio/x-mp3;freeamp %s
audio/x-mpeg;freeamp %s
audio/x-mpegurl;freeamp %s
audio/x-scpls;freeamp %s
image/gif; xv %s
image/jpg; xv %s |
|