Mutt notes

From Helpful
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
This article/section is a stub — probably a pile of half-sorted notes and is probably a first version, is not well-checked, so may have incorrect bits. (Feel free to ignore, or tell me)


Some basic useful keys

Note that keybindings in the main list (named the pager) are different from those while reading a message.


  • Arrow up/down or j/k: move among messages not marked for deletion
  • J/K: move among messages regardless of deletion mark
  • Tab: Skip to next unread message
  • typing numbers: Skip to a so-manienth message
  • /: search (in sender/subject if in list, or in message when you have one open, help text when in help, etc.)
  • o: sort


  • enter: Read message
  • space (in message): Skip to next page of message (Home and End are also useful)
  • S (in message): skip quoted text
  • T: Toggle visibility of quoted text


  • d: mark current message for deletion
  • D: mark messages for deletion, by pattern
  • u: remove deletion marker
  • U: remove deltion markers, by pattern
  • $: purge messages marked for deletion (also asked at exit)


  • t: tag current message (tagging is useful for bulk operations)
  • T: tag by pattern
  • ;: Apply next operation to all tagged messages
  • s: save (move) message(s) to other folder
  • c: change to read other folder


  • r: reply to message
  • f: forward mail
  • m: Send mail


  • q: quit mutt (can be used to exit some of mutt's functions)
  • Control-G: stop current action (e.g. when it's asking a question)


mailbox files

You change tell mutt to open a specific mailbox inside mutt using c, or on the command line using:

mutt -f =spam
#Alternatively: 
mutt -f mboxfilename

The = means 'mail box name from your home dir (specifically ~/Mail/)'.

If you omit the =, mutt will treat it as a filename to be opened in the context of the current directory. This can be handy if you want to look around mbox files from elsewhere.

Reading message states

  • N: New
  • O: Old
  • r: Been-replied-to
  • D: slated for deletion
  • d: attachment slated for deletion (use d in attachment view, v)
  • !: flagged (use w and W)
  • *: tagged

PGP:

  • s: signed
  • S: signed and verified
  • P: encrypted

Recipients

  • L: mailing list (based on lists command definition?(verify))
  • +: to only you
  • T: to you, CCd to others
  • C: is a CC
  • F: from you

Settings

The below is an example set. See also The mutt config var reference.

# Pager stuff
folder-hook . set sort=threads   # Set threaded pager as default for all folders
 
set pager_index_lines=12   # Split-screen index/pager preview thing
set pager_stop=yes         # Don't skip to next message at end of message
                           # (avoids accidental setting as being read)      
set nomarkers              # no line wraparound marker (is "+" by default)


# You can show/hide headers (blacklisted and whitelisted). 
# For example, if you only want to see a few headers:
ignore *
unignore Date: From: Organization: To: Cc: Reply-To: Subject:

# If you're doing that for readability, you probably also want to 
# reorder them for skimmability:
hdr_order Date: Subject: From: To: Cc:  Reply-To: Organization:
 


#various mutt behaviour

set editor="/usr/bin/emacs -nw" # in case you don't like your default shell $EDITOR
unset reply_self                # If replying to a message sent by you, 
                                # send mail to only recipient(s?), not you.
#confirmation skipping
set fast_reply=yes        # when replying, don't prompt for address
set include=yes           # include original text on reply?
set forward_quote=yes     # include original text on forward?
set copy=yes              # Save copies of sent messages?
set record="=sent-mail"   # ...and the place for it to go
set delete=yes            # don't ask for delete confirmation
set confirmappend=no      # Makes folder moves faster. 
                          #   ('unset confirmappend' does the same thing)
set move=yes              # avoid "Move messages to mbox?" by always doing so
       # ...'no' is probably more sensible when you only ever use one mailbox

#other features
set mail_check=90         # check mail every x seconds
set status_on_top         # status on top, key suggestions on the bottom
set auto_tag              # apply operations to all currently tagged messages   
# (default is having to use ; before an action to apply to to all tagged messages)


# You could add aliases for easily typed names when mailing people
alias dude   thedude@elsewhere.org (John Smith)
alias admins root,mainguy
#aliases are usually in a separate file, usually referenced like:
set alias_file=~/.mail_aliases


#I like seeing the time for the message, so I played with the format a little:
# set index_format=" %{%H:%M} %Z (%{%b%d})  %-10.10L  %4l lines  |   %s"
#...which gives:
#  21:03  D  (Aug05)  root           2 lines  |   cron: nice -n 5 /regular/script
#  21:03     (Aug05)  root           4 lines  |   cron: nice -n 5 /regular/script
#  21:03 r F (Aug05)  To Mail De    70 lines  |   Re: Undelivered Mail Returned to


#set signature="~/.mysig" # if you're that kind of person :)

Notes:

  • The -nw on emacs there avoids it trying to go through X (when you are logged in locally, or have X forwarding on in SSH), since that's probably not what you wanted and mutt doesn't really have a fallback when the editor doesn't want to work.


Adding keybindings

I may never remember mutt's keys past m, r, f, d, pgup, pgdown, and space, so I added emacs-style keybindings -- then never ended up using them.

Still, you may find it useful to know how: <syntaxhighlightlang="python">

  1. the keybindings are potentially entirely different in the index and pager,
  2. I like them to be the same since I use the preview split.
  1. Get folder list (to open other mailbox if you use more)

macro index "\Cx\Cb" "<change-folder>?" macro pager "\Cx\Cb" "<change-folder>?" macro index "\Cx\Cf" "<change-folder>?" macro pager "\Cx\Cf" "<change-folder>?"

  1. Message save-as (actually 'pipe to command', you still have to add a filename)

macro index "\Cx\Cs" "|cat > ~/" macro pager "\Cx\Cs" "|cat > ~/"

  1. You can also add it to an unbound key, like 'y'
  2. macro index "y" "|cat > ~/"
  3. macro pager "y" "|cat > ~/"

I like to (easily, without any prompting) move my spam to a specific mailbox:

macro index "S" "<save-message> \Cu=spam\Cj" 
macro pager "S" "<save-message> \Cu=spam\Cj"

The Ctrl-U clears the line, =spam specifies a mailbox, Ctrl-j is one one way to virtually press enter.

Coloring

Pager coloring

# menu and status bar. I like the black/white default, but you may like e.g.
color status white brightblack
 
#current highlit message: blue background
color indicator default blue
 
#Color messages based on basic state, for new, old, and to-be-deleted
#  Notes: neither new nor old (saved to mbox): white
#         one for mailing lists is useful, if you use them
color index brightyellow black ~N
color index yellow black ~O
color index red black ~D

Message coloring

Most of the below should either make skimming a little easier, create focus on interesting things, also by making inimportant things subtler.

#thread tree arrows
color tree yellow default
 
#make headers subtler: dark by default, and the major ones a little brighter
color hdrdefault blue default
color header brightblue default "^(From|To|Subject): " 
 
# quoting depths 
# (you may want different colors. the idea here is that deeper is darker)
color quoted brightgreen default
color quoted1 green      default
color quoted2 brightblue default
color quoted3 blue       default
 
# Simple string highlighting can be useful to skim logs from cron:
color body  red black "Warning"
# note that you can color things in the pager based on contents -
#  you may want that instead.


# Attribution line (probably left better colored by depth)
# "On Sat, Aug 05, 2006 at 09:00:56PM +0200, root wrote:"   
#color body blue default "(^|[^[:alnum:]])on [a-z0-9 ,]+( at [a-z0-9:,. +-]+)? wrote:"

#"--My Name" and "----- Forwarded message"... 
color body brightblack default "^\s*--.*

# boxes made with # or *, at any quote depth
color body brightblack default "^[>\ ]*[\*#]+.*"</nowiki>

# PGP messages
color  body            brightyellow    default "^gpg: Good signature .*"
color  body            white           default "^gpg: "
color  body            brightwhite     red     "^gpg: BAD signature from.*"
mono   body            bold                    "^gpg: Good signature"
mono   body            bold                    "^gpg: BAD signature from.*"

# URLs in message bodies
color body yellow default "([a-z][a-z0-9+-]*://(((([a-z0-9_.!~*'();:&=+$,-]|%[0-9a-f][0-9a-f])*@)?((([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?|[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)(:[0-9]+)?)|([a-z0-9_.!~*'()$,;:@&=+-]|%[0-9a-f][0-9a-f])+)(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?(#([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?|(www|ftp)\\.(([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?(:[0-9]+)?(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?(#([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?)[^].,:;!)? \t\r\n<>\"]"

# email addresses
color body brightyellow default "((@(([0-9a-z-]+\\.)*[0-9a-z-]+\\.?|#[0-9]+|\\[[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\]),)*@(([0-9a-z-]+\\.)*[0-9a-z-]+\\.?|#[0-9]+|\\[[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\]):)?[0-9a-z_.+%$-]+@(([0-9a-z-]+\\.)*[0-9a-z-]+\\.?|#[0-9]+|\\[[0-2]?[0-9]?[0-9]\\.[0-2]?[0-9]?[0-9]\\.[0-2]?[0-9]?[0-9]\\.[0-2]?[0-9]?[0-9]\\])"

To read

http://www.ucolick.org/~lharden/learnmutt.html

http://www.michnet.de/mutt/

http://www.mutt.org/doc/manual/manual-2.html

IMAP: http://wiki.dovecot.org/mutt

http://wiki.mutt.org/?MuttFaq

http://www.mutt.org/doc/manual/manual-3.html

http://www.wlug.org.nz/.muttrc