An initialization file consists of a series of <link linkend="commands">commands</link>. Each line of the file may contain one or more commands.
When multiple commands are used, they must be separated by a semicolon (;).
+<example id="ex-rc-multiple-cmds">
+<title>Multiple configuration commands per line</title>
<screen>
set realname='Mutt user' ; ignore x-
</screen>
+</example>
The hash mark, or pound sign
(<quote>#</quote>), is used as a <quote>comment</quote> character. You can use it to
<para>
+<example id="ex-ec-comment">
+<title>Commenting configuration files</title>
<screen>
my_hdr X-Disclaimer: Why are you listening to me? # This is a comment
</screen>
+</example>
</para>
<quote>\</quote> to force the next character to be a literal instead of interpreted
character.
+<example id="ex-rc-quote">
+<title>Escaping quotes in congfiguration files</title>
<screen>
set realname="Michael \"MuttDude\" Elkins"
</screen>
+</example>
</para>
initialization file. This is accomplished by enclosing the command in
backticks (``). For example,
+<example id="ex-rc-backtick">
+<title>Using external command's output in configuration files</title>
<screen>
my_hdr X-Operating-System: `uname -a`
</screen>
+</example>
The output of the Unix command <quote>uname -a</quote> will be substituted before the
line is parsed. Note that since initialization files are line oriented, only
prepending <quote>$</quote> to the name of the variable. For example,
</para>
+<example id="ex-rc-env">
+<title>Using environment variables in configuration files</title>
<screen>
set record=+sent_on_$HOSTNAME
</screen>
+</example>
<para>
will cause mutt to save outgoing messages to a folder named
<para>
+<example id="ex-alias-external">
+<title>Configuring external alias files</title>
<screen>
source /usr/local/share/Mutt.aliases
source ~/.mail_aliases
set alias_file=~/.mail_aliases
</screen>
+</example>
</para>
</para>
<para>
+<example id="ex-folder-sorting">
+<title>Setting sort method based on mailbox name</title>
<screen>
folder-hook . set sort=date-sent
folder-hook mutt set sort=threads
</screen>
+</example>
</para>
</sect1>
</para>
<para>
+<example id="ex-header-weeding">
+<title>Header weeding</title>
<screen>
# Sven's draconian header weeding
ignore *
unignore organization organisation x-mailer: x-newsreader: x-mailing-list:
unignore posted-to:
</screen>
+</example>
</para>
<anchor id="hdr-order"/>
</para>
<para>
+<example id="ex-hdr-order">
+<title>Configuring header display order</title>
<screen>
hdr_order From Date: From: To: Cc: Subject:
</screen>
+</example>
</para>
</sect1>
</para>
<para>
+<example id="ex-my-hdr">
+<title>Defining custom headers</title>
<screen>
my_hdr Organization: A Really Big Company, Anytown, USA
</screen>
+</example>
</para>
<para>
</para>
<para>
+<example id="ex-save-hook-exando">
+<title>Using %-expandos in <literal>save-hook</literal></title>
<screen>
# default: save all to ~/Mail/<author name>
save-hook . ~/Mail/%F
# save from aol.com to $folder/spam
save-hook aol\\.com$ +spam
</screen>
+</example>
</para>
<para>
certain folders. For example, the following command will automatically
collapse all threads when entering a folder:
+<example id="ex-folder-hook-push">
+<title>Embedding <literal>push</literal> in <literal>folder-hook</literal></title>
<screen>
folder-hook . 'push <collapse-all>'
</screen>
+</example>
</para>
</sect1>
For example, suppose I use DCC, SpamAssassin, and PureMessage. I might
define these spam settings:
+<example id="ex-spam">
+<title>Configuring spam detection</title>
<screen>
spam "X-DCC-.*-Metrics:.*(....)=many" "90+/DCC-%1"
spam "X-Spam-Status: Yes" "90+/SA"
spam "X-PerlMX-Spam: .*Probability=([0-9]+)%" "%1/PM"
set spam_separator=", "
</screen>
+</example>
</para>
</para>
<para>
+<example id="ex-myvar1">
+<title>Using user-defined variables for config file readability</title>
<screen>
set my_cfgdir = $HOME/mutt/config
source $my_cfgdir/macros
# more source commands...
</screen>
+</example>
</para>
<para>
</para>
<para>
+<example id="ex-myvar2">
+<title>Using user-defined variables for backing up other config option values</title>
<screen>
macro pager ,x '\
<enter-command>set my_delete=$delete<enter>\
...\
<enter-command>set delete=$my_delete<enter>'
</screen>
+</example>
</para>
<para>
</para>
<para>
+<example id="ex-myvar3">
+<title>Deferring user-defined variable expansion to runtime</title>
<screen>
macro pager <PageDown> "\
<enter-command> set my_old_pager_stop=\$pager_stop pager_stop<Enter>\
<enter-command> set pager_stop=\$my_old_pager_stop<Enter>\
<enter-command> unset my_old_pager_stop<Enter>"
</screen>
+</example>
</para>
<para>
is called so that:
</para>
+<example id="ex-fmtpipe">
+<title>Using external filters in format strings</title>
<screen>
set status_format="script.sh '%r %f (%L)'|"
</screen>
+</example>
<para>
will make mutt expand <literal>%r</literal>,
<para>
+<example id="ex-pattern-bool">
+<title>Using boolean operators in patterns</title>
<screen>
!(~t mutt|~c mutt) ~f elkins
</screen>
+</example>
</para>
you'd use the following pattern:
<screen>
-
Limit to messages matching: ~d 15/1/2001*2w
</screen>
<para>
+<example id="ex-send-hook-my-hdr">
+<title>Combining <literal>send-hook</literal> and <literal>my_hdr</literal></title>
<screen>
send-hook . 'unmy_hdr From:'
send-hook ~C'^b@b\.b$' my_hdr from: c@c.c
</screen>
+</example>
</para>
commented out define the default configuration of the lists.
</para>
+<example id="ex-attach-count">
+<title>Attachment counting</title>
<screen>
## Removing a pattern from a list removes that pattern literally. It
## does not remove any type matching the pattern.
attachments -A message/external-body
attachments -I message/external-body
</screen>
+</example>
<para>
Entering the command <quote><literal>attachments ?</literal></quote>
@media screen {
body { margin-left:2%; margin-right:2%; font-family:serif; }
- .toc a, .list-of-tables a { font-family:sans-serif; }
+ .toc, .list-of-tables, .list-of-examples { font-family:sans-serif; }
h1, h2, h3, h4, h5, h6 { font-family:sans-serif; }
em.replaceable code { font-family:sans-serif; }
p { text-align:justify; }
- div.table p.title { font-size:smaller; }
- div.table p.title b { font-weight:normal; }
+ div.table p.title, div.example p.title { font-size:smaller; font-family:sans-serif; }
.email, .email a { font-family:monospace; }
div.table-contents table { border-collapse:collapse; border:1px solid #c0c0c0; }
div.table-contents table td, div.table-contents table th { padding:5px; text-align:left; }
font-weight:normal;
vertical-align:top;
}
- pre { background:#f0f0f0; border:1px solid #c0c0c0; padding:5px; }
+ pre.screen { background:#f0f0f0; border:1px solid #c0c0c0; padding:5px; }
}