1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 3. Configuration</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /><link rel="home" href="index.html" title="The Mutt E-Mail Client" /><link rel="up" href="index.html" title="The Mutt E-Mail Client" /><link rel="prev" href="gettingstarted.html" title="Chapter 2. Getting Started" /><link rel="next" href="advancedusage.html" title="Chapter 4. Advanced Usage" /><style xmlns="" type="text/css">
4 body { margin-left:2%; margin-right:2%; font-family:serif; }
5 .toc, .list-of-tables, .list-of-examples { font-family:sans-serif; }
6 h1, h2, h3, h4, h5, h6 { font-family:sans-serif; }
7 p { text-align:justify; }
8 div.table p.title, div.example p.title { font-size:smaller; font-family:sans-serif; }
9 .email, .email a { font-family:monospace; }
10 div.table-contents table, div.informaltable table { border-collapse:collapse; border:1px solid #c0c0c0; }
11 div.table-contents table td, div.informaltable td, div.table-contents table th, div.informaltable table th { padding:5px; text-align:left; }
12 div.table-contents table th, div.informaltable table th {
13 font-family:sans-serif;
18 div.cmdsynopsis { border-left:1px solid #707070; padding-left:5px; }
19 li div.cmdsynopsis { border-left:none; padding-left:0px; }
20 pre.screen, div.note { background:#f0f0f0; border:1px solid #c0c0c0; padding:5px; margin-left:2%; margin-right:2%; }
21 div.example p.title { margin-left:2%; }
22 div.note h3 { font-size:small; font-style:italic; font-variant: small-caps; }
23 div.note h3:after { content: ":" }
24 div.note { margin-bottom: 5px; }
25 .command { font-family: monospace; font-weight: normal; }
26 .command strong { font-weight: normal; }
27 tr { vertical-align: top; }
28 .comment { color:#707070; }
30 </style></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 3. Configuration</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="gettingstarted.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="advancedusage.html">Next</a></td></tr></table><hr /></div><div class="chapter" title="Chapter 3. Configuration"><div class="titlepage"><div><div><h2 class="title"><a id="configuration"></a>Chapter 3. Configuration</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="configuration.html#configuration-files">1. Location of Initialization Files</a></span></dt><dt><span class="sect1"><a href="configuration.html#muttrc-syntax">2. Syntax of Initialization Files</a></span></dt><dt><span class="sect1"><a href="configuration.html#addrgroup">3. Address Groups</a></span></dt><dt><span class="sect1"><a href="configuration.html#alias">4. Defining/Using Aliases</a></span></dt><dt><span class="sect1"><a href="configuration.html#bind">5. Changing the Default Key Bindings</a></span></dt><dt><span class="sect1"><a href="configuration.html#charset-hook">6. Defining Aliases for Character Sets</a></span></dt><dt><span class="sect1"><a href="configuration.html#folder-hook">7. Setting Variables Based Upon Mailbox</a></span></dt><dt><span class="sect1"><a href="configuration.html#macro">8. Keyboard Macros</a></span></dt><dt><span class="sect1"><a href="configuration.html#color">9. Using Color and Mono Video Attributes</a></span></dt><dt><span class="sect1"><a href="configuration.html#msg-hdr-display">10. Message Header Display</a></span></dt><dd><dl><dt><span class="sect2"><a href="configuration.html#hdr-folding">10.1. Header Display</a></span></dt><dt><span class="sect2"><a href="configuration.html#ignore">10.2. Selecting Headers</a></span></dt><dt><span class="sect2"><a href="configuration.html#hdr-order">10.3. Ordering Displayed Headers</a></span></dt></dl></dd><dt><span class="sect1"><a href="configuration.html#alternates">11. Alternative Addresses</a></span></dt><dt><span class="sect1"><a href="configuration.html#lists">12. Mailing Lists</a></span></dt><dt><span class="sect1"><a href="configuration.html#mbox-hook">13. Using Multiple Spool Mailboxes</a></span></dt><dt><span class="sect1"><a href="configuration.html#mailboxes">14. Monitoring Incoming Mail</a></span></dt><dt><span class="sect1"><a href="configuration.html#my-hdr">15. User-Defined Headers</a></span></dt><dt><span class="sect1"><a href="configuration.html#save-hook">16. Specify Default Save Mailbox</a></span></dt><dt><span class="sect1"><a href="configuration.html#fcc-hook">17. Specify Default Fcc: Mailbox When Composing</a></span></dt><dt><span class="sect1"><a href="configuration.html#fcc-save-hook">18. Specify Default Save Filename and Default Fcc: Mailbox at Once</a></span></dt><dt><span class="sect1"><a href="configuration.html#send-hook">19. Change Settings Based Upon Message Recipients</a></span></dt><dt><span class="sect1"><a href="configuration.html#message-hook">20. Change Settings Before Formatting a Message</a></span></dt><dt><span class="sect1"><a href="configuration.html#crypt-hook">21. Choosing the Cryptographic Key of the Recipient</a></span></dt><dt><span class="sect1"><a href="configuration.html#push">22. Adding Key Sequences to the Keyboard Buffer</a></span></dt><dt><span class="sect1"><a href="configuration.html#exec">23. Executing Functions</a></span></dt><dt><span class="sect1"><a href="configuration.html#score-command">24. Message Scoring</a></span></dt><dt><span class="sect1"><a href="configuration.html#spam">25. Spam Detection</a></span></dt><dt><span class="sect1"><a href="configuration.html#set">26. Setting and Querying Variables</a></span></dt><dd><dl><dt><span class="sect2"><a href="configuration.html#var-types">26.1. Variable Types</a></span></dt><dt><span class="sect2"><a href="configuration.html#set-commands">26.2. Commands</a></span></dt><dt><span class="sect2"><a href="configuration.html#set-myvar">26.3. User-Defined Variables</a></span></dt><dt><span class="sect2"><a href="configuration.html#set-conversions">26.4. Type Conversions</a></span></dt></dl></dd><dt><span class="sect1"><a href="configuration.html#source">27. Reading Initialization Commands From Another File</a></span></dt><dt><span class="sect1"><a href="configuration.html#unhook">28. Removing Hooks</a></span></dt><dt><span class="sect1"><a href="configuration.html#formatstrings">29. Format Strings</a></span></dt><dd><dl><dt><span class="sect2"><a href="configuration.html#formatstrings-basics">29.1. Basic usage</a></span></dt><dt><span class="sect2"><a href="configuration.html#formatstrings-conditionals">29.2. Conditionals</a></span></dt><dt><span class="sect2"><a href="configuration.html#formatstrings-filters">29.3. Filters</a></span></dt><dt><span class="sect2"><a href="configuration.html#formatstrings-padding">29.4. Padding</a></span></dt></dl></dd></dl></div><div class="sect1" title="1. Location of Initialization Files"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="configuration-files"></a>1. Location of Initialization Files</h2></div></div></div><p>
31 While the default configuration (or <span class="quote">“<span class="quote">preferences</span>”</span>) make
32 Mutt usable right out of the box, it is often desirable to tailor Mutt
33 to suit your own tastes. When Mutt is first invoked, it will attempt to
34 read the <span class="quote">“<span class="quote">system</span>”</span> configuration file (defaults set by your
35 local system administrator), unless the <span class="quote">“<span class="quote">-n</span>”</span> <a class="link" href="reference.html#commandline" title="1. Command-Line Options">command line</a> option is specified. This
36 file is typically <code class="literal">/usr/local/share/mutt/Muttrc</code> or
37 <code class="literal">/etc/Muttrc</code>. Mutt will next look for a file named
38 <code class="literal">.muttrc</code> in your home directory. If this file does
39 not exist and your home directory has a subdirectory named
40 <code class="literal">.mutt</code>, Mutt tries to load a file named
41 <code class="literal">.mutt/muttrc</code>.
43 <code class="literal">.muttrc</code> is the file where you will usually place your
44 <a class="link" href="reference.html#commands" title="2. Configuration Commands">commands</a> to configure Mutt.
46 In addition, Mutt supports version specific configuration files that are
47 parsed instead of the default files as explained above. For instance,
48 if your system has a <code class="literal">Muttrc-0.88</code> file in the system
49 configuration directory, and you are running version 0.88 of Mutt, this
50 file will be sourced instead of the <code class="literal">Muttrc</code> file. The
51 same is true of the user configuration file, if you have a file
52 <code class="literal">.muttrc-0.88.6</code> in your home directory, when you run
53 Mutt version 0.88.6, it will source this file instead of the default
54 <code class="literal">.muttrc</code> file. The version number is the same which
55 is visible using the <span class="quote">“<span class="quote">-v</span>”</span> <a class="link" href="reference.html#commandline" title="1. Command-Line Options">command line</a> switch or using the
56 <code class="literal">show-version</code> key (default: V) from the index menu.
57 </p></div><div class="sect1" title="2. Syntax of Initialization Files"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="muttrc-syntax"></a>2. Syntax of Initialization Files</h2></div></div></div><p>
58 An initialization file consists of a series of <a class="link" href="reference.html#commands" title="2. Configuration Commands">commands</a>. Each line of the file may contain
59 one or more commands. When multiple commands are used, they must be
60 separated by a semicolon (<span class="quote">“<span class="quote">;</span>”</span>).
61 </p><div class="example"><a id="ex-rc-multiple-cmds"></a><p class="title"><b>Example 3.1. Multiple configuration commands per line</b></p><div class="example-contents"><pre class="screen">
62 set realname='Mutt user' ; ignore x-
63 </pre></div></div><br class="example-break" /><p>
64 The hash mark, or pound sign (<span class="quote">“<span class="quote">#</span>”</span>), is used as a
65 <span class="quote">“<span class="quote">comment</span>”</span> character. You can use it to annotate your
66 initialization file. All text after the comment character to the end of
68 </p><div class="example"><a id="ex-ec-comment"></a><p class="title"><b>Example 3.2. Commenting configuration files</b></p><div class="example-contents"><pre class="screen">
69 my_hdr X-Disclaimer: Why are you listening to me? <span class="comment"># This is a comment</span>
70 </pre></div></div><br class="example-break" /><p>
71 Single quotes (<span class="quote">“<span class="quote">'</span>”</span>) and double quotes (<span class="quote">“<span class="quote">"</span>”</span>)
72 can be used to quote strings which contain spaces or other special
73 characters. The difference between the two types of quotes is similar
74 to that of many popular shell programs, namely that a single quote is
75 used to specify a literal string (one that is not interpreted for shell
76 variables or quoting with a backslash [see next paragraph]), while
77 double quotes indicate a string for which should be evaluated. For
78 example, backticks are evaluated inside of double quotes, but
79 <span class="emphasis"><em>not</em></span> for single quotes.
81 <span class="quote">“<span class="quote">\</span>”</span> quotes the next character, just as in shells such as
82 bash and zsh. For example, if want to put quotes <span class="quote">“<span class="quote">"</span>”</span>
83 inside of a string, you can use <span class="quote">“<span class="quote">\</span>”</span> to force the next
84 character to be a literal instead of interpreted character.
85 </p><div class="example"><a id="ex-rc-quote"></a><p class="title"><b>Example 3.3. Escaping quotes in configuration files</b></p><div class="example-contents"><pre class="screen">
86 set realname="Michael \"MuttDude\" Elkins"
87 </pre></div></div><br class="example-break" /><p>
88 <span class="quote">“<span class="quote">\\</span>”</span> means to insert a literal <span class="quote">“<span class="quote">\</span>”</span> into the line.
89 <span class="quote">“<span class="quote">\n</span>”</span> and <span class="quote">“<span class="quote">\r</span>”</span> have their usual C meanings of linefeed and
90 carriage-return, respectively.
92 A <span class="quote">“<span class="quote">\</span>”</span> at the end of a line can be used to split commands
93 over multiple lines as it <span class="quote">“<span class="quote">escapes</span>”</span> the line end, provided
94 that the split points don't appear in the middle of command names. Lines
95 are first concatenated before interpretation so that a multi-line can be
96 commented by commenting out the first line only.
97 </p><div class="example"><a id="ex-rc-split"></a><p class="title"><b>Example 3.4. Splitting long configuration commands over several lines</b></p><div class="example-contents"><pre class="screen">
98 set status_format="some very \
101 </pre></div></div><br class="example-break" /><p>
102 It is also possible to substitute the output of a Unix command in an
103 initialization file. This is accomplished by enclosing the command in
104 backticks (``). In <a class="xref" href="configuration.html#ex-rc-backtick" title="Example 3.5. Using external command's output in configuration files">Example 3.5, “Using external command's output in configuration files”</a>, the output of the
105 Unix command <span class="quote">“<span class="quote">uname -a</span>”</span> will be substituted before the line
106 is parsed. Since initialization files are line oriented, only the first
107 line of output from the Unix command will be substituted.
108 </p><div class="example"><a id="ex-rc-backtick"></a><p class="title"><b>Example 3.5. Using external command's output in configuration files</b></p><div class="example-contents"><pre class="screen">
109 my_hdr X-Operating-System: `uname -a`
110 </pre></div></div><br class="example-break" /><p>
111 Both environment variables and Mutt variables can be accessed by
112 prepending <span class="quote">“<span class="quote">$</span>”</span> to the name of the variable. For example,
113 </p><div class="example"><a id="ex-rc-env"></a><p class="title"><b>Example 3.6. Using environment variables in configuration files</b></p><div class="example-contents"><pre class="screen">
114 set record=+sent_on_$HOSTNAME
115 </pre></div></div><br class="example-break" /><p>
116 will cause Mutt to save outgoing messages to a folder named
117 <span class="quote">“<span class="quote">sent_on_kremvax</span>”</span> if the environment variable
118 <code class="literal">$HOSTNAME</code> is set to <span class="quote">“<span class="quote">kremvax.</span>”</span> (See
119 <a class="link" href="reference.html#record" title="3.212. record">$record</a> for details.)
121 Mutt expands the variable when it is assigned, not when it is used. If
122 the value of a variable on the right-hand side of an assignment changes
123 after the assignment, the variable on the left-hand side will not be
126 The commands understood by Mutt are explained in the next paragraphs.
127 For a complete list, see the <a class="link" href="reference.html#commands" title="2. Configuration Commands">command
130 All configuration files are expected to be in the current locale as
131 specified by the <a class="link" href="reference.html#charset" title="3.25. charset">$charset</a> variable which
132 doesn't have a default value since it's determined by Mutt at startup.
133 If a configuration file is not encoded in the same character set the
134 <a class="link" href="reference.html#config-charset" title="3.30. config_charset">$config_charset</a> variable should be
135 used: all lines starting with the next are recoded from <a class="link" href="reference.html#config-charset" title="3.30. config_charset">$config_charset</a> to <a class="link" href="reference.html#charset" title="3.25. charset">$charset</a>.
137 This mechanism should be avoided if possible as it has the following
139 </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>These variables should be set early in a configuration
140 file with <a class="link" href="reference.html#charset" title="3.25. charset">$charset</a> preceding <a class="link" href="reference.html#config-charset" title="3.30. config_charset">$config_charset</a> so Mutt knows what
141 character set to convert to.</p></li><li class="listitem"><p>If <a class="link" href="reference.html#config-charset" title="3.30. config_charset">$config_charset</a>
142 is set, it should be set in each configuration file because the value is
143 global and <span class="emphasis"><em>not</em></span> per configuration
144 file.</p></li><li class="listitem"><p>Because Mutt first recodes a line before it attempts to
145 parse it, a conversion introducing question marks or other characters as
146 part of errors (unconvertable characters, transliteration) may introduce
147 syntax errors or silently change the meaning of certain tokens
148 (e.g. inserting question marks into regular
149 expressions).</p></li></ul></div></div><div class="sect1" title="3. Address Groups"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="addrgroup"></a>3. Address Groups</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">group</code> [
150 <code class="option">-group</code>
151 <em class="replaceable"><code>name</code></em>
153 <code class="option">-rx</code>
154 <em class="replaceable"><code>expr</code></em>
156 <code class="option">-addr</code>
157 <em class="replaceable"><code>expr</code></em>
158 ... }<br /><code class="command">ungroup</code> [
159 <code class="option">-group</code>
160 <em class="replaceable"><code>name</code></em>
162 <em class="replaceable"><code>*</code></em>
164 <code class="option">-rx</code>
165 <em class="replaceable"><code>expr</code></em>
167 <code class="option">-addr</code>
168 <em class="replaceable"><code>expr</code></em>
170 Mutt supports grouping addresses logically into named groups. An address
171 or address pattern can appear in several groups at the same time. These
172 groups can be used in <a class="link" href="advancedusage.html#patterns" title="3. Patterns: Searching, Limiting and Tagging">patterns</a> (for searching, limiting and tagging) and
173 in hooks by using group patterns. This can be useful to classify mail
174 and take certain actions depending on in what groups the message is.
175 For example, the mutt user's mailing list would fit into the categories
176 <span class="quote">“<span class="quote">mailing list</span>”</span> and <span class="quote">“<span class="quote">mutt-related</span>”</span>. Using <a class="link" href="configuration.html#send-hook" title="19. Change Settings Based Upon Message Recipients"><code class="literal">send-hook</code></a>, the sender can
177 be set to a dedicated one for writing mailing list messages, and the
178 signature could be set to a mutt-related one for writing to a mutt list
179 — for other lists, the list sender setting still applies but a
180 different signature can be selected. Or, given a group only containing
181 recipients known to accept encrypted mail,
182 <span class="quote">“<span class="quote">auto-encryption</span>”</span> can be achieved easily.
184 The <span class="command"><strong>group</strong></span> command is used to directly add either
185 addresses or regular expressions to the specified group or groups. The
186 different categories of arguments to the <span class="command"><strong>group</strong></span>
187 command can be in any order. The flags <code class="literal">-rx</code> and
188 <code class="literal">-addr</code> specify what the following strings (that cannot
189 begin with a hyphen) should be interpreted as: either a regular
190 expression or an email address, respectively.
192 These address groups can also be created implicitly by the <a class="link" href="configuration.html#alias" title="4. Defining/Using Aliases"><span class="command"><strong>alias</strong></span></a>, <a class="link" href="configuration.html#lists" title="12. Mailing Lists"><span class="command"><strong>lists</strong></span></a>, <a class="link" href="configuration.html#lists" title="12. Mailing Lists"><span class="command"><strong>subscribe</strong></span></a> and <a class="link" href="configuration.html#alternates" title="11. Alternative Addresses"><span class="command"><strong>alternates</strong></span></a> commands by
193 specifying the optional <code class="literal">-group</code> option. For example,
194 </p><pre class="screen">
195 alternates -group me address1 address2
196 alternates -group me -group work address3
198 would create a group named <span class="quote">“<span class="quote">me</span>”</span> which contains all your
199 addresses and a group named <span class="quote">“<span class="quote">work</span>”</span> which contains only your
200 work address <span class="emphasis"><em>address3</em></span>. Besides many other
201 possibilities, this could be used to automatically mark your own
202 messages in a mailing list folder as read or use a special signature for
203 work-related messages.
205 The <span class="command"><strong>ungroup</strong></span> command is used to remove addresses or
206 regular expressions from the specified group or groups. The syntax is
207 similar to the <span class="command"><strong>group</strong></span> command, however the special
208 character <code class="literal">*</code> can be used to empty a group of all of
209 its contents. As soon as a group gets empty because all addresses and
210 regular expressions have been removed, it'll internally be removed, too
211 (i.e. there cannot be an empty group). When removing regular expressions
212 from a group, the pattern must be specified exactly as given to the
213 <span class="command"><strong>group</strong></span> command or <code class="literal">-group</code> argument.
214 </p></div><div class="sect1" title="4. Defining/Using Aliases"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="alias"></a>4. Defining/Using Aliases</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">alias</code> [
215 <code class="option">-group</code>
216 <em class="replaceable"><code>name</code></em>
218 <em class="replaceable"><code>key</code></em>
220 <em class="replaceable"><code>address</code></em>
222 <em class="replaceable"><code>address</code></em>
223 ...]<br /><code class="command">unalias</code> [
224 <code class="option">-group</code>
225 <em class="replaceable"><code>name</code></em>
227 <em class="replaceable"><code>*</code></em>
229 <em class="replaceable"><code>key</code></em>
231 It's usually very cumbersome to remember or type out the address of
232 someone you are communicating with. Mutt allows you to create
233 <span class="quote">“<span class="quote">aliases</span>”</span> which map a short string to a full address.
234 </p><div class="note" title="Note"><h3 class="title">Note</h3><p>
235 If you want to create an alias for more than one address, you
236 <span class="emphasis"><em>must</em></span> separate the addresses with a comma
237 (<span class="quote">“<span class="quote">,</span>”</span>).
239 The optional <code class="literal">-group</code> argument to
240 <span class="command"><strong>alias</strong></span> causes the aliased address(es) to be added to
241 the named <span class="emphasis"><em>group</em></span>.
243 To remove an alias or aliases (<span class="quote">“<span class="quote">*</span>”</span> means all aliases):
244 </p><pre class="screen">
245 alias muttdude me@cs.hmc.edu (Michael Elkins)
246 alias theguys manny, moe, jack
248 Unlike other mailers, Mutt doesn't require aliases to be defined in a
249 special file. The <span class="command"><strong>alias</strong></span> command can appear anywhere
250 in a configuration file, as long as this file is <a class="link" href="configuration.html#source" title="27. Reading Initialization Commands From Another File"><span class="command"><strong>source</strong></span>d</a>. Consequently, you
251 can have multiple alias files, or you can have all aliases defined in
252 your <code class="literal">.muttrc</code>.
254 On the other hand, the <a class="link" href="gettingstarted.html#create-alias"><code class="literal"><create-alias></code></a>
255 function can use only one file, the one pointed to by the <a class="link" href="reference.html#alias-file" title="3.3. alias_file">$alias_file</a> variable (which is
256 <code class="literal">~/.muttrc</code> by default). This file is not special
257 either, in the sense that Mutt will happily append aliases to any file,
258 but in order for the new aliases to take effect you need to explicitly
259 <a class="link" href="configuration.html#source" title="27. Reading Initialization Commands From Another File"><span class="command"><strong>source</strong></span></a> this file too.
260 </p><div class="example"><a id="ex-alias-external"></a><p class="title"><b>Example 3.7. Configuring external alias files</b></p><div class="example-contents"><pre class="screen">
261 source /usr/local/share/Mutt.aliases
262 source ~/.mail_aliases
263 set alias_file=~/.mail_aliases
264 </pre></div></div><br class="example-break" /><p>
265 To use aliases, you merely use the alias at any place in Mutt where Mutt
266 prompts for addresses, such as the <span class="emphasis"><em>To:</em></span> or
267 <span class="emphasis"><em>Cc:</em></span> prompt. You can also enter aliases in your
268 editor at the appropriate headers if you have the <a class="link" href="reference.html#edit-headers" title="3.57. edit_headers">$edit_headers</a> variable set.
270 In addition, at the various address prompts, you can use the tab
271 character to expand a partial alias to the full alias. If there are
272 multiple matches, Mutt will bring up a menu with the matching aliases.
273 In order to be presented with the full list of aliases, you must hit tab
274 without a partial alias, such as at the beginning of the prompt or after
275 a comma denoting multiple addresses.
277 In the alias menu, you can select as many aliases as you want with the
278 <code class="literal">select-entry</code> key (default: <Return>), and use
279 the <span class="emphasis"><em>exit</em></span> key (default: q) to return to the address
281 </p></div><div class="sect1" title="5. Changing the Default Key Bindings"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="bind"></a>5. Changing the Default Key Bindings</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">bind</code>
282 <em class="replaceable"><code>map</code></em>
284 <em class="replaceable"><code>key</code></em>
286 <em class="replaceable"><code>function</code></em>
288 This command allows you to change the default key bindings (operation
289 invoked when pressing a key).
291 <span class="emphasis"><em>map</em></span> specifies in which menu the binding belongs.
292 Multiple maps may be specified by separating them with commas (no
293 additional whitespace is allowed). The currently defined maps are:
294 </p><a id="maps"></a><div class="variablelist"><dl><dt><span class="term">generic</span></dt><dd><p>
295 This is not a real menu, but is used as a fallback for all of the other
296 menus except for the pager and editor modes. If a key is not defined in
297 another menu, Mutt will look for a binding to use in this menu. This
298 allows you to bind a key to a certain function in multiple menus instead
299 of having multiple <span class="command"><strong>bind</strong></span> statements to accomplish the
301 </p></dd><dt><span class="term">alias</span></dt><dd><p>
302 The alias menu is the list of your personal aliases as defined in your
303 <code class="literal">.muttrc</code>. It is the mapping from a short alias name
304 to the full email address(es) of the recipient(s).
305 </p></dd><dt><span class="term">attach</span></dt><dd><p>
306 The attachment menu is used to access the attachments on received
308 </p></dd><dt><span class="term">browser</span></dt><dd><p>
309 The browser is used for both browsing the local directory structure, and
310 for listing all of your incoming mailboxes.
311 </p></dd><dt><span class="term">editor</span></dt><dd><p>
312 The editor is used to allow the user to enter a single line of text, such as
313 the <span class="emphasis"><em>To</em></span> or <span class="emphasis"><em>Subject</em></span> prompts in the
314 <code class="literal">compose</code> menu.
315 </p></dd><dt><span class="term">index</span></dt><dd><p>
316 The index is the list of messages contained in a mailbox.
317 </p></dd><dt><span class="term">compose</span></dt><dd><p>
318 The compose menu is the screen used when sending a new message.
319 </p></dd><dt><span class="term">pager</span></dt><dd><p>
320 The pager is the mode used to display message/attachment data, and help
322 </p></dd><dt><span class="term">pgp</span></dt><dd><p>
323 The pgp menu is used to select the OpenPGP keys used to encrypt outgoing
325 </p></dd><dt><span class="term">smime</span></dt><dd><p>
326 The smime menu is used to select the OpenSSL certificates used to
327 encrypt outgoing messages.
328 </p></dd><dt><span class="term">postpone</span></dt><dd><p>
329 The postpone menu is similar to the index menu, except is used when
330 recalling a message the user was composing, but saved until later.
331 </p></dd><dt><span class="term">query</span></dt><dd><p>
332 The query menu is the browser for results returned by <a class="link" href="reference.html#query-command" title="3.204. query_command">$query_command</a>.
333 </p></dd><dt><span class="term">mix</span></dt><dd><p>
334 The mixmaster screen is used to select remailer options for outgoing
335 messages (if Mutt is compiled with Mixmaster support).
336 </p></dd></dl></div><p>
337 <span class="emphasis"><em>key</em></span> is the key (or key sequence) you wish to bind.
338 To specify a control character, use the sequence
339 <span class="emphasis"><em>\Cx</em></span>, where <span class="emphasis"><em>x</em></span> is the letter of
340 the control character (for example, to specify control-A use
341 <span class="quote">“<span class="quote">\Ca</span>”</span>). Note that the case of <span class="emphasis"><em>x</em></span> as
342 well as <span class="emphasis"><em>\C</em></span> is ignored, so that
343 <span class="emphasis"><em>\CA</em></span>, <span class="emphasis"><em>\Ca</em></span>,
344 <span class="emphasis"><em>\cA</em></span> and <span class="emphasis"><em>\ca</em></span> are all
345 equivalent. An alternative form is to specify the key as a three digit
346 octal number prefixed with a <span class="quote">“<span class="quote">\</span>”</span> (for example
347 <span class="emphasis"><em>\177</em></span> is equivalent to <span class="emphasis"><em>\c?</em></span>). In
348 addition, <span class="emphasis"><em>key</em></span> may be a symbolic name as shown in
349 <a class="xref" href="configuration.html#tab-key-names" title="Table 3.1. Symbolic key names">Table 3.1, “Symbolic key names”</a>.
350 </p><div class="table"><a id="tab-key-names"></a><p class="title"><b>Table 3.1. Symbolic key names</b></p><div class="table-contents"><table summary="Symbolic key names" border="1"><colgroup><col /><col /></colgroup><thead><tr><th>Symbolic name</th><th>Meaning</th></tr></thead><tbody><tr><td>\t</td><td>tab</td></tr><tr><td><tab></td><td>tab</td></tr><tr><td><backtab></td><td>backtab / shift-tab</td></tr><tr><td>\r</td><td>carriage return</td></tr><tr><td>\n</td><td>newline</td></tr><tr><td>\e</td><td>escape</td></tr><tr><td><esc></td><td>escape</td></tr><tr><td><up></td><td>up arrow</td></tr><tr><td><down></td><td>down arrow</td></tr><tr><td><left></td><td>left arrow</td></tr><tr><td><right></td><td>right arrow</td></tr><tr><td><pageup></td><td>Page Up</td></tr><tr><td><pagedown></td><td>Page Down</td></tr><tr><td><backspace></td><td>Backspace</td></tr><tr><td><delete></td><td>Delete</td></tr><tr><td><insert></td><td>Insert</td></tr><tr><td><enter></td><td>Enter</td></tr><tr><td><return></td><td>Return</td></tr><tr><td><home></td><td>Home</td></tr><tr><td><end></td><td>End</td></tr><tr><td><space></td><td>Space bar</td></tr><tr><td><f1></td><td>function key 1</td></tr><tr><td><f10></td><td>function key 10</td></tr></tbody></table></div></div><br class="table-break" /><p>
351 <span class="emphasis"><em>key</em></span> does not need to be enclosed in quotes unless
352 it contains a space (<span class="quote">“<span class="quote"> </span>”</span>) or semi-colon
353 (<span class="quote">“<span class="quote">;</span>”</span>).
355 <span class="emphasis"><em>function</em></span> specifies which action to take when
356 <span class="emphasis"><em>key</em></span> is pressed. For a complete list of functions,
357 see the <a class="link" href="reference.html#functions" title="4. Functions">reference</a>. Note that the
358 <span class="command"><strong>bind</strong></span> expects <span class="emphasis"><em>function</em></span> to be
359 specified without angle brackets.
361 The special function <code class="literal"><noop></code> unbinds the
362 specified key sequence.
363 </p></div><div class="sect1" title="6. Defining Aliases for Character Sets"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="charset-hook"></a>6. Defining Aliases for Character Sets</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">charset-hook</code>
364 <em class="replaceable"><code>alias</code></em>
366 <em class="replaceable"><code>charset</code></em>
367 <br /><code class="command">iconv-hook<a id="iconv-hook"></a></code>
368 <em class="replaceable"><code>charset</code></em>
370 <em class="replaceable"><code>local-charset</code></em>
372 The <span class="command"><strong>charset-hook</strong></span> command defines an alias for a
373 character set. This is useful to properly display messages which are
374 tagged with a character set name not known to Mutt.
376 The <span class="command"><strong>iconv-hook</strong></span> command defines a system-specific name
377 for a character set. This is helpful when your systems character
378 conversion library insists on using strange, system-specific names for
380 </p></div><div class="sect1" title="7. Setting Variables Based Upon Mailbox"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="folder-hook"></a>7. Setting Variables Based Upon Mailbox</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">folder-hook</code>
381 <em class="replaceable"><code>[!]regexp</code></em>
383 <em class="replaceable"><code>command</code></em>
385 It is often desirable to change settings based on which mailbox you are
386 reading. The <span class="command"><strong>folder-hook</strong></span> command provides a method
387 by which you can execute any configuration command.
388 <span class="emphasis"><em>regexp</em></span> is a regular expression specifying in which
389 mailboxes to execute <span class="emphasis"><em>command</em></span> before loading. If a
390 mailbox matches multiple <span class="command"><strong>folder-hook</strong></span>s, they are
391 executed in the order given in the <code class="literal">.muttrc</code>.
392 </p><div class="note" title="Note"><h3 class="title">Note</h3><p>
393 If you use the <span class="quote">“<span class="quote">!</span>”</span> shortcut for <a class="link" href="reference.html#spoolfile" title="3.270. spoolfile">$spoolfile</a> at the beginning of the pattern,
394 you must place it inside of double or single quotes in order to
395 distinguish it from the logical <span class="emphasis"><em>not</em></span> operator for
397 </p></div><div class="note" title="Note"><h3 class="title">Note</h3><p>
398 Settings are <span class="emphasis"><em>not</em></span> restored when you leave the
399 mailbox. For example, a command action to perform is to change the
400 sorting method based upon the mailbox being read:
401 </p><pre class="screen">
402 folder-hook mutt "set sort=threads"</pre><p>
403 However, the sorting method is not restored to its previous value when
404 reading a different mailbox. To specify a <span class="emphasis"><em>default</em></span>
405 command, use the pattern <span class="quote">“<span class="quote">.</span>”</span> before other
406 <span class="command"><strong>folder-hook</strong></span>s adjusting a value on a per-folder basis
407 because <span class="command"><strong>folder-hook</strong></span>s are evaluated in the order given
408 in the configuration file.
410 The following example will set the <a class="link" href="reference.html#sort" title="3.264. sort">sort</a>
411 variable to <code class="literal">date-sent</code> for all folders but to
412 <code class="literal">threads</code> for all folders containing
413 <span class="quote">“<span class="quote">mutt</span>”</span> in their name.
414 </p><div class="example"><a id="ex-folder-sorting"></a><p class="title"><b>Example 3.8. Setting sort method based on mailbox name</b></p><div class="example-contents"><pre class="screen">
415 folder-hook . "set sort=date-sent"
416 folder-hook mutt "set sort=threads"
417 </pre></div></div><br class="example-break" /></div><div class="sect1" title="8. Keyboard Macros"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="macro"></a>8. Keyboard Macros</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">macro</code>
418 <em class="replaceable"><code>menu</code></em>
420 <em class="replaceable"><code>key</code></em>
422 <em class="replaceable"><code>sequence</code></em>
424 <em class="replaceable"><code>description</code></em>
426 Macros are useful when you would like a single key to perform a series
427 of actions. When you press <span class="emphasis"><em>key</em></span> in menu
428 <span class="emphasis"><em>menu</em></span>, Mutt will behave as if you had typed
429 <span class="emphasis"><em>sequence</em></span>. So if you have a common sequence of
430 commands you type, you can create a macro to execute those commands with
431 a single key or fewer keys.
433 <span class="emphasis"><em>menu</em></span> is the <a class="link" href="configuration.html#maps">map</a> which
434 the macro will be bound in. Multiple maps may be specified by
435 separating multiple menu arguments by commas. Whitespace may not be used
436 in between the menu arguments and the commas separating them.
438 <span class="emphasis"><em>key</em></span> and <span class="emphasis"><em>sequence</em></span> are expanded
439 by the same rules as the <a class="link" href="configuration.html#bind" title="5. Changing the Default Key Bindings">key bindings</a> with
440 some additions. The first is that control characters in
441 <span class="emphasis"><em>sequence</em></span> can also be specified as
442 <span class="emphasis"><em>^x</em></span>. In order to get a caret (<span class="quote">“<span class="quote">^</span>”</span>) you
443 need to use <span class="emphasis"><em>^^</em></span>. Secondly, to specify a certain key
444 such as <span class="emphasis"><em>up</em></span> or to invoke a function directly, you
445 can use the format <span class="emphasis"><em><key name></em></span> and
446 <span class="emphasis"><em><function name></em></span>. For a listing of key names
447 see the section on <a class="link" href="configuration.html#bind" title="5. Changing the Default Key Bindings">key bindings</a>. Functions
448 are listed in the <a class="link" href="reference.html#functions" title="4. Functions">reference</a>.
450 The advantage with using function names directly is that the macros will
451 work regardless of the current key bindings, so they are not dependent
452 on the user having particular key definitions. This makes them more
453 robust and portable, and also facilitates defining of macros in files
454 used by more than one user (e.g., the system Muttrc).
456 Optionally you can specify a descriptive text after
457 <span class="emphasis"><em>sequence</em></span>, which is shown in the help screens if
458 they contain a description.
459 </p><div class="note" title="Note"><h3 class="title">Note</h3><p>
460 Macro definitions (if any) listed in the help screen(s), are
461 silently truncated at the screen width, and are not wrapped.
462 </p></div></div><div class="sect1" title="9. Using Color and Mono Video Attributes"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="color"></a>9. Using Color and Mono Video Attributes</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">color</code>
463 <em class="replaceable"><code>object</code></em>
465 <em class="replaceable"><code>foreground</code></em>
467 <em class="replaceable"><code>background</code></em>
468 <br /><code class="command">color</code> {
469 <code class="option">header</code>
471 <code class="option">body</code>
473 <em class="replaceable"><code>foreground</code></em>
475 <em class="replaceable"><code>background</code></em>
477 <em class="replaceable"><code>regexp</code></em>
478 <br /><code class="command">color</code>
479 <code class="option">index</code>
481 <em class="replaceable"><code>foreground</code></em>
483 <em class="replaceable"><code>background</code></em>
485 <em class="replaceable"><code>pattern</code></em>
486 <br /><code class="command">uncolor</code> {
487 <code class="option">index</code>
489 <code class="option">header</code>
491 <code class="option">body</code>
493 <em class="replaceable"><code>*</code></em>
495 <em class="replaceable"><code>pattern</code></em>
497 If your terminal supports color, you can spice up Mutt by creating your
498 own color scheme. To define the color of an object (type of
499 information), you must specify both a foreground color
500 <span class="emphasis"><em>and</em></span> a background color (it is not possible to only
501 specify one or the other).
503 <span class="emphasis"><em>header</em></span> and <span class="emphasis"><em>body</em></span> match
504 <span class="emphasis"><em>regexp</em></span> in the header/body of a message,
505 <span class="emphasis"><em>index</em></span> matches <span class="emphasis"><em>pattern</em></span> (see
506 <a class="xref" href="advancedusage.html#patterns" title="3. Patterns: Searching, Limiting and Tagging">Section 3, “Patterns: Searching, Limiting and Tagging”</a>) in the message index.
508 <span class="emphasis"><em>object</em></span> can be one of:
509 </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>attachment</p></li><li class="listitem"><p>bold (highlighting bold patterns in the body of messages)</p></li><li class="listitem"><p>error (error messages printed by Mutt)</p></li><li class="listitem"><p>hdrdefault (default color of the message header in the pager)</p></li><li class="listitem"><p>indicator (arrow or bar used to indicate the current item in a menu)</p></li><li class="listitem"><p>markers (the <span class="quote">“<span class="quote">+</span>”</span> markers at the beginning of wrapped lines in the pager)</p></li><li class="listitem"><p>message (informational messages)</p></li><li class="listitem"><p>normal</p></li><li class="listitem"><p>quoted (text matching <a class="link" href="reference.html#quote-regexp" title="3.207. quote_regexp">$quote_regexp</a> in the body of a message)</p></li><li class="listitem"><p>quoted1, quoted2, ..., quoted<span class="emphasis"><em>N</em></span> (higher levels of quoting)</p></li><li class="listitem"><p>search (highlighting of words in the pager)</p></li><li class="listitem"><p>signature</p></li><li class="listitem"><p>status (mode lines used to display info about the mailbox or message)</p></li><li class="listitem"><p>tilde (the <span class="quote">“<span class="quote">~</span>”</span> used to pad blank lines in the pager)</p></li><li class="listitem"><p>tree (thread tree drawn in the message index and attachment menu)</p></li><li class="listitem"><p>underline (highlighting underlined patterns in the body of messages)</p></li></ul></div><p>
510 <span class="emphasis"><em>foreground</em></span> and <span class="emphasis"><em>background</em></span> can
511 be one of the following:
512 </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>white</p></li><li class="listitem"><p>black</p></li><li class="listitem"><p>green</p></li><li class="listitem"><p>magenta</p></li><li class="listitem"><p>blue</p></li><li class="listitem"><p>cyan</p></li><li class="listitem"><p>yellow</p></li><li class="listitem"><p>red</p></li><li class="listitem"><p>default</p></li><li class="listitem"><p>color<span class="emphasis"><em>x</em></span></p></li></ul></div><p>
513 <span class="emphasis"><em>foreground</em></span> can optionally be prefixed with the
514 keyword <code class="literal">bright</code> to make the foreground color boldfaced
515 (e.g., <code class="literal">brightred</code>).
517 If your terminal supports it, the special keyword
518 <span class="emphasis"><em>default</em></span> can be used as a transparent color. The
519 value <span class="emphasis"><em>brightdefault</em></span> is also valid. If Mutt is
520 linked against the <span class="emphasis"><em>S-Lang</em></span> library, you also need to
521 set the <code class="literal">$COLORFGBG</code> environment variable to the
522 default colors of your terminal for this to work; for example (for
524 </p><pre class="screen">
525 set COLORFGBG="green;black"
527 </pre><div class="note" title="Note"><h3 class="title">Note</h3><p>
528 The <span class="emphasis"><em>S-Lang</em></span> library requires you to use the
529 <span class="emphasis"><em>lightgray</em></span> and <span class="emphasis"><em>brown</em></span> keywords
530 instead of <span class="emphasis"><em>white</em></span> and <span class="emphasis"><em>yellow</em></span>
531 when setting this variable.
532 </p></div><div class="note" title="Note"><h3 class="title">Note</h3><p>
533 The <span class="command"><strong>uncolor</strong></span> command can be applied to the index,
534 header and body objects only. It removes entries from the list. You
535 <span class="emphasis"><em>must</em></span> specify the same pattern specified in the
536 <span class="command"><strong>color</strong></span> command for it to be removed. The pattern
537 <span class="quote">“<span class="quote">*</span>”</span> is a special token which means to clear the color list
540 Mutt also recognizes the keywords <span class="emphasis"><em>color0</em></span>,
541 <span class="emphasis"><em>color1</em></span>, ...,
542 <span class="emphasis"><em>color</em></span><span class="emphasis"><em>N-1</em></span>
543 (<span class="emphasis"><em>N</em></span> being the number of colors supported by your
544 terminal). This is useful when you remap the colors for your display
545 (for example by changing the color associated with
546 <span class="emphasis"><em>color2</em></span> for your xterm), since color names may then
547 lose their normal meaning.
548 </p><a id="mono"></a><p>
549 If your terminal does not support color, it is still possible change the
550 video attributes through the use of the <span class="quote">“<span class="quote">mono</span>”</span>
552 </p><div class="cmdsynopsis"><p><code class="command">mono</code>
553 <em class="replaceable"><code>object</code></em>
555 <em class="replaceable"><code>attribute</code></em>
556 <br /><code class="command">mono</code> {
557 <code class="option">header</code>
559 <code class="option">body</code>
561 <em class="replaceable"><code>attribute</code></em>
563 <em class="replaceable"><code>regexp</code></em>
564 <br /><code class="command">mono</code>
565 <code class="option">index</code>
567 <em class="replaceable"><code>attribute</code></em>
569 <em class="replaceable"><code>pattern</code></em>
570 <br /><code class="command">unmono</code> {
571 <code class="option">index</code>
573 <code class="option">header</code>
575 <code class="option">body</code>
577 <em class="replaceable"><code>*</code></em>
579 <em class="replaceable"><code>pattern</code></em>
581 For <span class="emphasis"><em>object</em></span>, see the <span class="command"><strong>color</strong></span>
582 command. <span class="emphasis"><em>attribute</em></span> can be one of the following:
583 </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>none</p></li><li class="listitem"><p>bold</p></li><li class="listitem"><p>underline</p></li><li class="listitem"><p>reverse</p></li><li class="listitem"><p>standout</p></li></ul></div></div><div class="sect1" title="10. Message Header Display"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="msg-hdr-display"></a>10. Message Header Display</h2></div></div></div><div class="sect2" title="10.1. Header Display"><div class="titlepage"><div><div><h3 class="title"><a id="hdr-folding"></a>10.1. Header Display</h3></div></div></div><p>
584 When displaying a message in the pager, Mutt folds long header lines at
585 <a class="link" href="reference.html#wrap" title="3.307. wrap">$wrap</a> columns. Though there're precise rules
586 about where to break and how, Mutt always folds headers using a tab for
587 readability. (Note that the sending side is not affected by this, Mutt
588 tries to implement standards compliant folding.)
589 </p></div><div class="sect2" title="10.2. Selecting Headers"><div class="titlepage"><div><div><h3 class="title"><a id="ignore"></a>10.2. Selecting Headers</h3></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">ignore</code>
590 <em class="replaceable"><code>pattern</code></em>
592 <em class="replaceable"><code>pattern</code></em>
593 ...]<br /><code class="command">unignore</code> {
594 <em class="replaceable"><code>*</code></em>
596 <em class="replaceable"><code>pattern</code></em>
598 Messages often have many header fields added by automatic processing
599 systems, or which may not seem useful to display on the screen. This
600 command allows you to specify header fields which you don't normally
601 want to see in the pager.
603 You do not need to specify the full header field name. For example,
604 <span class="quote">“<span class="quote">ignore content-</span>”</span> will ignore all header fields that begin
605 with the pattern <span class="quote">“<span class="quote">content-</span>”</span>. <span class="quote">“<span class="quote">ignore *</span>”</span> will
608 To remove a previously added token from the list, use the
609 <span class="quote">“<span class="quote">unignore</span>”</span> command. The <span class="quote">“<span class="quote">unignore</span>”</span> command
610 will make Mutt display headers with the given pattern. For example, if
611 you do <span class="quote">“<span class="quote">ignore x-</span>”</span> it is possible to <span class="quote">“<span class="quote">unignore
612 x-mailer</span>”</span>.
614 <span class="quote">“<span class="quote">unignore *</span>”</span> will remove all tokens from the ignore list.
615 </p><div class="example"><a id="ex-header-weeding"></a><p class="title"><b>Example 3.9. Header weeding</b></p><div class="example-contents"><pre class="screen">
616 <span class="comment"># Sven's draconian header weeding</span>
618 unignore from date subject to cc
619 unignore organization organisation x-mailer: x-newsreader: x-mailing-list:
621 </pre></div></div><br class="example-break" /></div><div class="sect2" title="10.3. Ordering Displayed Headers"><div class="titlepage"><div><div><h3 class="title"><a id="hdr-order"></a>10.3. Ordering Displayed Headers</h3></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">hdr_order</code>
622 <em class="replaceable"><code>header</code></em>
624 <em class="replaceable"><code>header</code></em>
625 ...]<br /><code class="command">unhdr_order</code> {
626 <em class="replaceable"><code>*</code></em>
628 <em class="replaceable"><code>header</code></em>
630 With the <span class="command"><strong>hdr_order</strong></span> command you can specify an order
631 in which Mutt will attempt to present these headers to you when viewing
634 <span class="quote">“<span class="quote"><span class="command"><strong>unhdr_order</strong></span> *</span>”</span> will clear all previous
635 headers from the order list, thus removing the header order effects set
636 by the system-wide startup file.
637 </p><div class="example"><a id="ex-hdr-order"></a><p class="title"><b>Example 3.10. Configuring header display order</b></p><div class="example-contents"><pre class="screen">
638 hdr_order From Date: From: To: Cc: Subject:
639 </pre></div></div><br class="example-break" /></div></div><div class="sect1" title="11. Alternative Addresses"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="alternates"></a>11. Alternative Addresses</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">alternates</code> [
640 <code class="option">-group</code>
641 <em class="replaceable"><code>name</code></em>
643 <em class="replaceable"><code>regexp</code></em>
645 <em class="replaceable"><code>regexp</code></em>
646 ...]<br /><code class="command">unalternates</code> [
647 <code class="option">-group</code>
648 <em class="replaceable"><code>name</code></em>
650 <em class="replaceable"><code>*</code></em>
652 <em class="replaceable"><code>regexp</code></em>
654 With various functions, Mutt will treat messages differently, depending
655 on whether you sent them or whether you received them from someone else.
656 For instance, when replying to a message that you sent to a different
657 party, Mutt will automatically suggest to send the response to the
658 original message's recipients — responding to yourself won't make
659 much sense in many cases. (See <a class="link" href="reference.html#reply-to" title="3.215. reply_to">$reply_to</a>.)
661 Many users receive e-mail under a number of different addresses. To
662 fully use Mutt's features here, the program must be able to recognize
663 what e-mail addresses you receive mail under. That's the purpose of the
664 <span class="command"><strong>alternates</strong></span> command: It takes a list of regular
665 expressions, each of which can identify an address under which you
668 As addresses are matched using regular expressions and not exact strict
669 comparisons, you should make sure you specify your addresses as precise
670 as possible to avoid mismatches. For example, if you specify:
671 </p><pre class="screen">
672 alternates user@example
674 Mutt will consider <span class="quote">“<span class="quote"><code class="literal">some-user@example</code></span>”</span>
675 as being your address, too which may not be desired. As a solution, in
676 such cases addresses should be specified as:
677 </p><pre class="screen">
678 alternates '^user@example$'
680 The <code class="literal">-group</code> flag causes all of the subsequent regular
681 expressions to be added to the named group.
683 The <span class="command"><strong>unalternates</strong></span> command can be used to write
684 exceptions to <span class="command"><strong>alternates</strong></span> patterns. If an address
685 matches something in an <span class="command"><strong>alternates</strong></span> command, but you
686 nonetheless do not think it is from you, you can list a more precise
687 pattern under an <span class="command"><strong>unalternates</strong></span> command.
689 To remove a regular expression from the <span class="command"><strong>alternates</strong></span>
690 list, use the <span class="command"><strong>unalternates</strong></span> command with exactly the
691 same <span class="emphasis"><em>regexp</em></span>. Likewise, if the
692 <span class="emphasis"><em>regexp</em></span> for an <span class="command"><strong>alternates</strong></span> command
693 matches an entry on the <span class="command"><strong>unalternates</strong></span> list, that
694 <span class="command"><strong>unalternates</strong></span> entry will be removed. If the
695 <span class="emphasis"><em>regexp</em></span> for <span class="command"><strong>unalternates</strong></span> is
696 <span class="quote">“<span class="quote">*</span>”</span>, <span class="emphasis"><em>all entries</em></span> on
697 <span class="command"><strong>alternates</strong></span> will be removed.
698 </p></div><div class="sect1" title="12. Mailing Lists"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="lists"></a>12. Mailing Lists</h2></div></div></div><a id="subscribe"></a><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">lists</code> [
699 <code class="option">-group</code>
700 <em class="replaceable"><code>name</code></em>
702 <em class="replaceable"><code>regexp</code></em>
704 <em class="replaceable"><code>regexp</code></em>
705 ...]<br /><code class="command">unlists</code> {
706 <em class="replaceable"><code>*</code></em>
708 <em class="replaceable"><code>regexp</code></em>
709 ... }<br /><code class="command">subscribe</code> [
710 <code class="option">-group</code>
711 <em class="replaceable"><code>name</code></em>
713 <em class="replaceable"><code>regexp</code></em>
715 <em class="replaceable"><code>regexp</code></em>
716 ...]<br /><code class="command">unsubscribe</code> {
717 <em class="replaceable"><code>*</code></em>
719 <em class="replaceable"><code>regexp</code></em>
721 Mutt has a few nice features for <a class="link" href="advancedusage.html#using-lists" title="9. Handling Mailing Lists">handling
722 mailing lists</a>. In order to take advantage of them, you must
723 specify which addresses belong to mailing lists, and which mailing lists
724 you are subscribed to. Mutt also has limited support for auto-detecting
725 mailing lists: it supports parsing <code class="literal">mailto:</code> links in
726 the common <code class="literal">List-Post:</code> header which has the same
727 effect as specifying the list address via the <span class="command"><strong>lists</strong></span>
728 command (except the group feature). Once you have done this, the <a class="link" href="gettingstarted.html#list-reply"><code class="literal"><list-reply></code></a>
729 function will work for all known lists. Additionally, when you send a
730 message to a subscribed list, Mutt will add a Mail-Followup-To header to
731 tell other users' mail user agents not to send copies of replies to your
733 </p><div class="note" title="Note"><h3 class="title">Note</h3><p>
734 The Mail-Followup-To header is a non-standard extension which is not
735 supported by all mail user agents. Adding it is not bullet-proof
736 against receiving personal CCs of list messages. Also note that the
737 generation of the Mail-Followup-To header is controlled by the <a class="link" href="reference.html#followup-to" title="3.68. followup_to">$followup_to</a> configuration variable since
738 it's common practice on some mailing lists to send Cc upon replies
739 (which is more a group- than a list-reply).
741 More precisely, Mutt maintains lists of patterns for the addresses of
742 known and subscribed mailing lists. Every subscribed mailing list is
743 known. To mark a mailing list as known, use the <span class="command"><strong>list</strong></span>
744 command. To mark it as subscribed, use <span class="command"><strong>subscribe</strong></span>.
746 You can use regular expressions with both commands. To mark all messages
747 sent to a specific bug report's address on Debian's bug tracking system
748 as list mail, for instance, you could say
749 </p><pre class="screen">
750 subscribe [0-9]*.*@bugs.debian.org</pre><p>
751 as it's often sufficient to just give a portion of the list's e-mail
754 Specify as much of the address as you need to to remove ambiguity. For
755 example, if you've subscribed to the Mutt mailing list, you will receive
756 mail addressed to <code class="literal">mutt-users@mutt.org</code>. So, to tell
757 Mutt that this is a mailing list, you could add <code class="literal">lists
758 mutt-users@</code> to your initialization file. To tell Mutt that
759 you are subscribed to it, add <code class="literal"><span class="command"><strong>subscribe</strong></span>
760 mutt-users</code> to your initialization file instead. If you also
761 happen to get mail from someone whose address is
762 <code class="literal">mutt-users@example.com</code>, you could use
763 <code class="literal"><span class="command"><strong>lists</strong></span> ^mutt-users@mutt\\.org$</code> or
764 <code class="literal"><span class="command"><strong>subscribe</strong></span> ^mutt-users@mutt\\.org$</code>
765 to match only mail from the actual list.
767 The <code class="literal">-group</code> flag adds all of the subsequent regular
768 expressions to the named <a class="link" href="configuration.html#addrgroup" title="3. Address Groups">address group</a>
769 in addition to adding to the specified address list.
771 The <span class="quote">“<span class="quote">unlists</span>”</span> command is used to remove a token from the
772 list of known and subscribed mailing-lists. Use <span class="quote">“<span class="quote">unlists *</span>”</span>
773 to remove all tokens.
775 To remove a mailing list from the list of subscribed mailing lists, but
776 keep it on the list of known mailing lists, use
777 <span class="command"><strong>unsubscribe</strong></span>.
778 </p></div><div class="sect1" title="13. Using Multiple Spool Mailboxes"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mbox-hook"></a>13. Using Multiple Spool Mailboxes</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">mbox-hook</code>
779 <em class="replaceable"><code>[!]pattern</code></em>
781 <em class="replaceable"><code>mailbox</code></em>
783 This command is used to move read messages from a specified mailbox to a
784 different mailbox automatically when you quit or change folders.
785 <span class="emphasis"><em>pattern</em></span> is a regular expression specifying the
786 mailbox to treat as a <span class="quote">“<span class="quote">spool</span>”</span> mailbox and
787 <span class="emphasis"><em>mailbox</em></span> specifies where mail should be saved when
790 Unlike some of the other <span class="emphasis"><em>hook</em></span> commands, only the
791 <span class="emphasis"><em>first</em></span> matching pattern is used (it is not possible
792 to save read mail in more than a single mailbox).
793 </p></div><div class="sect1" title="14. Monitoring Incoming Mail"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mailboxes"></a>14. Monitoring Incoming Mail</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">mailboxes</code>
794 <em class="replaceable"><code>mailbox</code></em>
796 <em class="replaceable"><code>mailbox</code></em>
797 ...]<br /><code class="command">unmailboxes</code> {
798 <em class="replaceable"><code>*</code></em>
800 <em class="replaceable"><code>mailbox</code></em>
802 This command specifies folders which can receive mail and which will be
803 checked for new messages periodically.
805 <span class="emphasis"><em>folder</em></span> can either be a local file or directory
806 (Mbox/Mmdf or Maildir/Mh). If Mutt was built with POP and/or IMAP
807 support, <span class="emphasis"><em>folder</em></span> can also be a POP/IMAP folder
808 URL. The URL syntax is described in <a class="xref" href="optionalfeatures.html#url-syntax" title="1.2. URL Syntax">Section 1.2, “URL Syntax”</a>, POP
809 and IMAP are described in <a class="xref" href="optionalfeatures.html#pop" title="3. POP3 Support">Section 3, “POP3 Support”</a> and <a class="xref" href="optionalfeatures.html#imap" title="4. IMAP Support">Section 4, “IMAP Support”</a> respectively.
811 Mutt provides a number of advanced features for handling (possibly many)
812 folders and new mail within them, please refer to <a class="xref" href="advancedusage.html#new-mail" title="10. New Mail Detection">Section 10, “New Mail Detection”</a> for details (including in what situations and how
813 often Mutt checks for new mail).
815 The <span class="quote">“<span class="quote">unmailboxes</span>”</span> command is used to remove a token from
816 the list of folders which receive mail. Use <span class="quote">“<span class="quote">unmailboxes *</span>”</span>
817 to remove all tokens.
818 </p><div class="note" title="Note"><h3 class="title">Note</h3><p>
819 The folders in the <span class="command"><strong>mailboxes</strong></span> command are resolved
820 when the command is executed, so if these names contain <a class="link" href="advancedusage.html#shortcuts" title="8. Mailbox Shortcuts">shortcut characters</a> (such as <span class="quote">“<span class="quote">=</span>”</span>
821 and <span class="quote">“<span class="quote">!</span>”</span>), any variable definition that affects these
822 characters (like <a class="link" href="reference.html#folder" title="3.66. folder">$folder</a> and <a class="link" href="reference.html#spoolfile" title="3.270. spoolfile">$spoolfile</a>) should be set before the
823 <span class="command"><strong>mailboxes</strong></span> command. If none of these shortcuts are
824 used, a local path should be absolute as otherwise Mutt tries to find it
825 relative to the directory from where Mutt was started which may not
827 </p></div></div><div class="sect1" title="15. User-Defined Headers"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="my-hdr"></a>15. User-Defined Headers</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">my_hdr</code>
828 <em class="replaceable"><code>string</code></em>
829 <br /><code class="command">unmy_hdr</code> {
830 <em class="replaceable"><code>*</code></em>
832 <em class="replaceable"><code>field</code></em>
834 The <span class="command"><strong>my_hdr</strong></span> command allows you to create your own
835 header fields which will be added to every message you send and appear
836 in the editor if <a class="link" href="reference.html#edit-headers" title="3.57. edit_headers">$edit_headers</a> is
839 For example, if you would like to add an <span class="quote">“<span class="quote">Organization:</span>”</span>
840 header field to all of your outgoing messages, you can put the command
841 something like shown in <a class="xref" href="configuration.html#ex-my-hdr" title="Example 3.11. Defining custom headers">Example 3.11, “Defining custom headers”</a> in your
842 <code class="literal">.muttrc</code>.
843 </p><div class="example"><a id="ex-my-hdr"></a><p class="title"><b>Example 3.11. Defining custom headers</b></p><div class="example-contents"><pre class="screen">
844 my_hdr Organization: A Really Big Company, Anytown, USA
845 </pre></div></div><br class="example-break" /><div class="note" title="Note"><h3 class="title">Note</h3><p>
846 Space characters are <span class="emphasis"><em>not</em></span> allowed between the
847 keyword and the colon (<span class="quote">“<span class="quote">:</span>”</span>). The standard for electronic
848 mail (RFC2822) says that space is illegal there, so Mutt enforces the
851 If you would like to add a header field to a single message, you should
852 either set the <a class="link" href="reference.html#edit-headers" title="3.57. edit_headers">$edit_headers</a>
853 variable, or use the <code class="literal"><edit-headers></code> function
854 (default: <span class="quote">“<span class="quote">E</span>”</span>) in the compose menu so that you can edit the
855 header of your message along with the body.
857 To remove user defined header fields, use the
858 <span class="command"><strong>unmy_hdr</strong></span> command. You may specify an asterisk
859 (<span class="quote">“<span class="quote">*</span>”</span>) to remove all header fields, or the fields to
860 remove. For example, to remove all <span class="quote">“<span class="quote">To</span>”</span> and
861 <span class="quote">“<span class="quote">Cc</span>”</span> header fields, you could use:
862 </p><pre class="screen">
864 </pre></div><div class="sect1" title="16. Specify Default Save Mailbox"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="save-hook"></a>16. Specify Default Save Mailbox</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">save-hook</code>
865 <em class="replaceable"><code>[!]pattern</code></em>
867 <em class="replaceable"><code>mailbox</code></em>
869 This command is used to override the default mailbox used when saving
870 messages. <span class="emphasis"><em>mailbox</em></span> will be used as the default if
871 the message matches <span class="emphasis"><em>pattern</em></span>, see <a class="xref" href="advancedusage.html#pattern-hook" title="5.1. Message Matching in Hooks">Message Matching in Hooks</a> for information on the exact format.
873 To provide more flexibility and good defaults, Mutt applies the expandos
874 of <a class="link" href="reference.html#index-format" title="3.114. index_format">$index_format</a> to
875 <span class="emphasis"><em>mailbox</em></span> after it was expanded.
876 </p><div class="example"><a id="ex-save-hook-exando"></a><p class="title"><b>Example 3.12. Using %-expandos in <span class="command">save-hook</span></b></p><div class="example-contents"><pre class="screen">
877 <span class="comment"># default: save all to ~/Mail/<author name></span>
878 save-hook . ~/Mail/%F
880 <span class="comment"># save from me@turing.cs.hmc.edu and me@cs.hmc.edu to $folder/elkins</span>
881 save-hook me@(turing\\.)?cs\\.hmc\\.edu$ +elkins
883 <span class="comment"># save from aol.com to $folder/spam</span>
884 save-hook aol\\.com$ +spam
885 </pre></div></div><br class="example-break" /><p>
886 Also see the <a class="link" href="configuration.html#fcc-save-hook" title="18. Specify Default Save Filename and Default Fcc: Mailbox at Once"><span class="command"><strong>fcc-save-hook</strong></span></a> command.
887 </p></div><div class="sect1" title="17. Specify Default Fcc: Mailbox When Composing"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="fcc-hook"></a>17. Specify Default Fcc: Mailbox When Composing</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">fcc-hook</code>
888 <em class="replaceable"><code>[!]pattern</code></em>
890 <em class="replaceable"><code>mailbox</code></em>
892 This command is used to save outgoing mail in a mailbox other than <a class="link" href="reference.html#record" title="3.212. record">$record</a>. Mutt searches the initial list of
893 message recipients for the first matching <span class="emphasis"><em>regexp</em></span>
894 and uses <span class="emphasis"><em>mailbox</em></span> as the default Fcc: mailbox. If
895 no match is found the message will be saved to <a class="link" href="reference.html#record" title="3.212. record">$record</a> mailbox.
897 To provide more flexibility and good defaults, Mutt applies the
898 expandos of <a class="link" href="reference.html#index-format" title="3.114. index_format">$index_format</a> to
899 <span class="emphasis"><em>mailbox</em></span> after it was expanded.
901 See <a class="xref" href="advancedusage.html#pattern-hook" title="5.1. Message Matching in Hooks">Message Matching in Hooks</a> for information on the exact format
902 of <span class="emphasis"><em>pattern</em></span>.
903 </p><pre class="screen">fcc-hook [@.]aol\\.com$ +spammers</pre><p>
904 ...will save a copy of all messages going to the aol.com domain to the
905 `+spammers' mailbox by default. Also see the <a class="link" href="configuration.html#fcc-save-hook" title="18. Specify Default Save Filename and Default Fcc: Mailbox at Once"><span class="command"><strong>fcc-save-hook</strong></span></a> command.
906 </p></div><div class="sect1" title="18. Specify Default Save Filename and Default Fcc: Mailbox at Once"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="fcc-save-hook"></a>18. Specify Default Save Filename and Default Fcc: Mailbox at Once</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">fcc-save-hook</code>
907 <em class="replaceable"><code>[!]pattern</code></em>
909 <em class="replaceable"><code>mailbox</code></em>
911 This command is a shortcut, equivalent to doing both a <a class="link" href="configuration.html#fcc-hook" title="17. Specify Default Fcc: Mailbox When Composing"><span class="command"><strong>fcc-hook</strong></span></a> and a <a class="link" href="configuration.html#save-hook" title="16. Specify Default Save Mailbox"><span class="command"><strong>save-hook</strong></span></a> with its
912 arguments, including %-expansion on <span class="emphasis"><em>mailbox</em></span>
913 according to <a class="link" href="reference.html#index-format" title="3.114. index_format">$index_format</a>.
914 </p></div><div class="sect1" title="19. Change Settings Based Upon Message Recipients"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="send-hook"></a>19. Change Settings Based Upon Message Recipients</h2></div></div></div><a id="reply-hook"></a><a id="send2-hook"></a><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">reply-hook</code>
915 <em class="replaceable"><code>[!]pattern</code></em>
917 <em class="replaceable"><code>command</code></em>
918 <br /><code class="command">send-hook</code>
919 <em class="replaceable"><code>[!]pattern</code></em>
921 <em class="replaceable"><code>command</code></em>
922 <br /><code class="command">send2-hook</code>
923 <em class="replaceable"><code>[!]pattern</code></em>
925 <em class="replaceable"><code>command</code></em>
927 These commands can be used to execute arbitrary configuration commands
928 based upon recipients of the message. <span class="emphasis"><em>pattern</em></span> is
929 used to match the message, see <a class="xref" href="advancedusage.html#pattern-hook" title="5.1. Message Matching in Hooks">Message Matching in Hooks</a> for
930 details. <span class="emphasis"><em>command</em></span> is executed when
931 <span class="emphasis"><em>pattern</em></span> matches.
933 <span class="command"><strong>reply-hook</strong></span> is matched against the message you are
934 <span class="emphasis"><em>replying to</em></span>, instead of the message you are
935 <span class="emphasis"><em>sending</em></span>. <span class="command"><strong>send-hook</strong></span> is matched
936 against all messages, both <span class="emphasis"><em>new</em></span> and
937 <span class="emphasis"><em>replies</em></span>.
938 </p><div class="note" title="Note"><h3 class="title">Note</h3><p>
939 <span class="command"><strong>reply-hook</strong></span>s are matched <span class="emphasis"><em>before</em></span>
940 the <span class="command"><strong>send-hook</strong></span>, <span class="emphasis"><em>regardless</em></span> of the
941 order specified in the user's configuration file.
943 <span class="command"><strong>send2-hook</strong></span> is matched every time a message is
944 changed, either by editing it, or by using the compose menu to change
945 its recipients or subject. <span class="command"><strong>send2-hook</strong></span> is executed
946 after <span class="command"><strong>send-hook</strong></span>, and can, e.g., be used to set
947 parameters such as the <a class="link" href="reference.html#sendmail" title="3.231. sendmail">$sendmail</a>
948 variable depending on the message's sender address.
950 For each type of <span class="command"><strong>send-hook</strong></span> or
951 <span class="command"><strong>reply-hook</strong></span>, when multiple matches occur, commands are
952 executed in the order they are specified in the
953 <code class="literal">.muttrc</code> (for that type of hook).
955 Example: <code class="literal"><span class="command"><strong>send-hook</strong></span> mutt
956 "<span class="command"><strong>set</strong></span> mime_forward signature=''"</code>
958 Another typical use for this command is to change the values of the
959 <a class="link" href="reference.html#attribution" title="3.16. attribution">$attribution</a>, <a class="link" href="reference.html#signature" title="3.236. signature">$signature</a> and <a class="link" href="reference.html#locale" title="3.117. locale">$locale</a> variables in order to change the
960 language of the attributions and signatures based upon the recipients.
961 </p><div class="note" title="Note"><h3 class="title">Note</h3><p>
962 <span class="command"><strong>send-hook</strong></span>'s are only executed once after getting the
963 initial list of recipients. Adding a recipient after replying or
964 editing the message will not cause any <span class="command"><strong>send-hook</strong></span> to
965 be executed, similarly if <a class="link" href="reference.html#autoedit" title="3.18. autoedit">$autoedit</a> is
966 set (as then the initial list of recipients is empty). Also note that
967 <a class="link" href="configuration.html#my-hdr" title="15. User-Defined Headers"><span class="command"><strong>my_hdr</strong></span></a> commands which
968 modify recipient headers, or the message's subject, don't have any
969 effect on the current message when executed from a
970 <span class="command"><strong>send-hook</strong></span>.
971 </p></div></div><div class="sect1" title="20. Change Settings Before Formatting a Message"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="message-hook"></a>20. Change Settings Before Formatting a Message</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">message-hook</code>
972 <em class="replaceable"><code>[!]pattern</code></em>
974 <em class="replaceable"><code>command</code></em>
976 This command can be used to execute arbitrary configuration commands
977 before viewing or formatting a message based upon information about the
978 message. <span class="emphasis"><em>command</em></span> is executed if the
979 <span class="emphasis"><em>pattern</em></span> matches the message to be displayed. When
980 multiple matches occur, commands are executed in the order they are
981 specified in the <code class="literal">.muttrc</code>.
983 See <a class="xref" href="advancedusage.html#pattern-hook" title="5.1. Message Matching in Hooks">Message Matching in Hooks</a> for information on the exact format
984 of <span class="emphasis"><em>pattern</em></span>.
987 </p><pre class="screen">
988 message-hook ~A 'set pager=builtin'
989 message-hook '~f freshmeat-news' 'set pager="less \"+/^ subject: .*\""'
990 </pre></div><div class="sect1" title="21. Choosing the Cryptographic Key of the Recipient"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="crypt-hook"></a>21. Choosing the Cryptographic Key of the Recipient</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">crypt-hook</code>
991 <em class="replaceable"><code>pattern</code></em>
993 <em class="replaceable"><code>keyid</code></em>
995 When encrypting messages with PGP/GnuPG or OpenSSL, you may want to
996 associate a certain key with a given e-mail address automatically,
997 either because the recipient's public key can't be deduced from the
998 destination address, or because, for some reasons, you need to override
999 the key Mutt would normally use. The <span class="command"><strong>crypt-hook</strong></span>
1000 command provides a method by which you can specify the ID of the public
1001 key to be used when encrypting messages to a certain recipient.
1003 The meaning of <span class="emphasis"><em>keyid</em></span> is to be taken broadly in this
1004 context: You can either put a numerical key ID here, an e-mail address,
1005 or even just a real name.
1006 </p></div><div class="sect1" title="22. Adding Key Sequences to the Keyboard Buffer"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="push"></a>22. Adding Key Sequences to the Keyboard Buffer</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">push</code>
1007 <em class="replaceable"><code>string</code></em>
1009 This command adds the named string to the keyboard buffer. The string
1010 may contain control characters, key names and function names like the
1011 sequence string in the <a class="link" href="configuration.html#macro" title="8. Keyboard Macros">macro</a> command. You
1012 may use it to automatically run a sequence of commands at startup, or
1013 when entering certain folders. For example, <a class="xref" href="configuration.html#ex-folder-hook-push" title="Example 3.13. Embedding push in folder-hook">Example 3.13, “Embedding <span class="command">push</span> in <span class="command">folder-hook</span>”</a> shows how to automatically collapse all
1014 threads when entering a folder.
1015 </p><div class="example"><a id="ex-folder-hook-push"></a><p class="title"><b>Example 3.13. Embedding <span class="command">push</span> in <span class="command">folder-hook</span></b></p><div class="example-contents"><pre class="screen">
1016 folder-hook . 'push <collapse-all>'
1017 </pre></div></div><br class="example-break" /><p>
1018 For using functions like shown in the example, it's important to use
1019 angle brackets (<span class="quote">“<span class="quote"><</span>”</span> and <span class="quote">“<span class="quote">></span>”</span>) to make
1020 Mutt recognize the input as a function name. Otherwise it will simulate
1021 individual just keystrokes, i.e. <span class="quote">“<span class="quote"><code class="literal">push
1022 collapse-all</code></span>”</span> would be interpreted as if you had typed
1023 <span class="quote">“<span class="quote">c</span>”</span>, followed by <span class="quote">“<span class="quote">o</span>”</span>, followed by
1024 <span class="quote">“<span class="quote">l</span>”</span>, ..., which is not desired and may lead to very
1025 unexpected behavior.
1027 Keystrokes can be used, too, but are less portable because of
1028 potentially changed key bindings. With default bindings, this is
1029 equivalent to the above example:
1030 </p><pre class="screen">
1031 folder-hook . 'push \eV'
1033 because it simulates that Esc+V was pressed (which is the default
1034 binding of <code class="literal"><collapse-all></code>).
1035 </p></div><div class="sect1" title="23. Executing Functions"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="exec"></a>23. Executing Functions</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">exec</code>
1036 <em class="replaceable"><code>function</code></em>
1038 <em class="replaceable"><code>function</code></em>
1040 This command can be used to execute any function. Functions are listed
1041 in the <a class="link" href="reference.html#functions" title="4. Functions">function reference</a>.
1042 <span class="quote">“<span class="quote"><span class="command"><strong>exec</strong></span> <code class="literal">function</code></span>”</span> is
1043 equivalent to <span class="quote">“<span class="quote"><code class="literal">push <function></code></span>”</span>.
1044 </p></div><div class="sect1" title="24. Message Scoring"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="score-command"></a>24. Message Scoring</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">score</code>
1045 <em class="replaceable"><code>pattern</code></em>
1047 <em class="replaceable"><code>value</code></em>
1048 <br /><code class="command">unscore</code> {
1049 <em class="replaceable"><code>*</code></em>
1051 <em class="replaceable"><code>pattern</code></em>
1053 The <span class="command"><strong>score</strong></span> commands adds <span class="emphasis"><em>value</em></span> to
1054 a message's score if <span class="emphasis"><em>pattern</em></span> matches it.
1055 <span class="emphasis"><em>pattern</em></span> is a string in the format described in the
1056 <a class="link" href="advancedusage.html#patterns" title="3. Patterns: Searching, Limiting and Tagging">patterns</a> section (note: For efficiency
1057 reasons, patterns which scan information not available in the index,
1058 such as <code class="literal">~b</code>, <code class="literal">~B</code> or
1059 <code class="literal">~h</code>, may not be used). <span class="emphasis"><em>value</em></span> is
1060 a positive or negative integer. A message's final score is the sum
1061 total of all matching <span class="command"><strong>score</strong></span> entries. However, you
1062 may optionally prefix <span class="emphasis"><em>value</em></span> with an equal sign
1063 (<span class="quote">“<span class="quote">=</span>”</span>) to cause evaluation to stop at a particular entry if
1064 there is a match. Negative final scores are rounded up to 0.
1066 The <span class="command"><strong>unscore</strong></span> command removes score entries from the
1067 list. You <span class="emphasis"><em>must</em></span> specify the same pattern specified
1068 in the <span class="command"><strong>score</strong></span> command for it to be removed. The
1069 pattern <span class="quote">“<span class="quote">*</span>”</span> is a special token which means to clear the
1070 list of all score entries.
1071 </p></div><div class="sect1" title="25. Spam Detection"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="spam"></a>25. Spam Detection</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">spam</code>
1072 <em class="replaceable"><code>pattern</code></em>
1074 <em class="replaceable"><code>format</code></em>
1075 <br /><code class="command">nospam</code> {
1076 <em class="replaceable"><code>*</code></em>
1078 <em class="replaceable"><code>pattern</code></em>
1080 Mutt has generalized support for external spam-scoring filters. By
1081 defining your spam patterns with the <span class="command"><strong>spam</strong></span> and
1082 <code class="literal">nospam</code> commands, you can <span class="emphasis"><em>limit</em></span>,
1083 <span class="emphasis"><em>search</em></span>, and <span class="emphasis"><em>sort</em></span> your mail
1084 based on its spam attributes, as determined by the external filter. You
1085 also can display the spam attributes in your index display using the
1086 <code class="literal">%H</code> selector in the <a class="link" href="reference.html#index-format" title="3.114. index_format">$index_format</a> variable. (Tip: try
1087 <code class="literal">%?H?[%H] ?</code> to display spam tags only when they are
1088 defined for a given message.)
1090 Your first step is to define your external filter's spam patterns using
1091 the <span class="command"><strong>spam</strong></span> command. <span class="emphasis"><em>pattern</em></span> should
1092 be a regular expression that matches a header in a mail message. If any
1093 message in the mailbox matches this regular expression, it will receive
1094 a <span class="quote">“<span class="quote">spam tag</span>”</span> or <span class="quote">“<span class="quote">spam attribute</span>”</span> (unless it
1095 also matches a <span class="command"><strong>nospam</strong></span> pattern — see below.) The
1096 appearance of this attribute is entirely up to you, and is governed by
1097 the <span class="emphasis"><em>format</em></span> parameter. <span class="emphasis"><em>format</em></span>
1098 can be any static text, but it also can include back-references from the
1099 <span class="emphasis"><em>pattern</em></span> expression. (A regular expression
1100 <span class="quote">“<span class="quote">back-reference</span>”</span> refers to a sub-expression contained
1101 within parentheses.) <code class="literal">%1</code> is replaced with the first
1102 back-reference in the regex, <code class="literal">%2</code> with the second, etc.
1104 To match spam tags, mutt needs the corresponding header information
1105 which is always the case for local and POP folders but not for IMAP in
1106 the default configuration. Depending on the spam header to be analyzed,
1107 <a class="link" href="reference.html#imap-headers" title="3.99. imap_headers">$imap_headers</a> may need to be
1110 If you're using multiple spam filters, a message can have more than one
1111 spam-related header. You can define <span class="command"><strong>spam</strong></span> patterns for
1112 each filter you use. If a message matches two or more of these patterns,
1113 and the <a class="link" href="reference.html#spam-separator" title="3.269. spam_separator">$spam_separator</a> variable
1114 is set to a string, then the message's spam tag will consist of all the
1115 <span class="emphasis"><em>format</em></span> strings joined together, with the value of
1116 <a class="link" href="reference.html#spam-separator" title="3.269. spam_separator">$spam_separator</a> separating them.
1118 For example, suppose one uses DCC, SpamAssassin, and PureMessage, then
1119 the configuration might look like in <a class="xref" href="configuration.html#ex-spam" title="Example 3.14. Configuring spam detection">Example 3.14, “Configuring spam detection”</a>.
1120 </p><div class="example"><a id="ex-spam"></a><p class="title"><b>Example 3.14. Configuring spam detection</b></p><div class="example-contents"><pre class="screen">
1121 spam "X-DCC-.*-Metrics:.*(....)=many" "90+/DCC-%1"
1122 spam "X-Spam-Status: Yes" "90+/SA"
1123 spam "X-PerlMX-Spam: .*Probability=([0-9]+)%" "%1/PM"
1124 set spam_separator=", "
1125 </pre></div></div><br class="example-break" /><p>
1126 If then a message is received that DCC registered with
1127 <span class="quote">“<span class="quote">many</span>”</span> hits under the <span class="quote">“<span class="quote">Fuz2</span>”</span> checksum, and
1128 that PureMessage registered with a 97% probability of being spam, that
1129 message's spam tag would read <code class="literal">90+/DCC-Fuz2,
1130 97/PM</code>. (The four characters before <span class="quote">“<span class="quote">=many</span>”</span> in a
1131 DCC report indicate the checksum used — in this case,
1132 <span class="quote">“<span class="quote">Fuz2</span>”</span>.)
1134 If the <a class="link" href="reference.html#spam-separator" title="3.269. spam_separator">$spam_separator</a> variable is
1135 unset, then each spam pattern match supersedes the previous one. Instead
1136 of getting joined <span class="emphasis"><em>format</em></span> strings, you'll get only
1137 the last one to match.
1139 The spam tag is what will be displayed in the index when you use
1140 <code class="literal">%H</code> in the <a class="link" href="reference.html#index-format" title="3.114. index_format">$index_format</a> variable. It's also the
1141 string that the <code class="literal">~H</code> pattern-matching expression
1142 matches against for <code class="literal"><search></code> and
1143 <code class="literal"><limit></code> functions. And it's what sorting by
1144 spam attribute will use as a sort key.
1146 That's a pretty complicated example, and most people's actual
1147 environments will have only one spam filter. The simpler your
1148 configuration, the more effective Mutt can be, especially when it comes
1151 Generally, when you sort by spam tag, Mutt will sort
1152 <span class="emphasis"><em>lexically</em></span> — that is, by ordering strings
1153 alphanumerically. However, if a spam tag begins with a number, Mutt will
1154 sort numerically first, and lexically only when two numbers are equal in
1155 value. (This is like UNIX's <code class="literal">sort -n</code>.) A message with
1156 no spam attributes at all — that is, one that didn't match
1157 <span class="emphasis"><em>any</em></span> of your <span class="command"><strong>spam</strong></span> patterns
1158 — is sorted at lowest priority. Numbers are sorted next, beginning
1159 with 0 and ranging upward. Finally, non-numeric strings are sorted, with
1160 <span class="quote">“<span class="quote">a</span>”</span> taking lower priority than <span class="quote">“<span class="quote">z</span>”</span>. Clearly,
1161 in general, sorting by spam tags is most effective when you can coerce
1162 your filter to give you a raw number. But in case you can't, Mutt can
1163 still do something useful.
1165 The <span class="command"><strong>nospam</strong></span> command can be used to write exceptions to
1166 <span class="command"><strong>spam</strong></span> patterns. If a header pattern matches something
1167 in a <span class="command"><strong>spam</strong></span> command, but you nonetheless do not want it
1168 to receive a spam tag, you can list a more precise pattern under a
1169 <span class="command"><strong>nospam</strong></span> command.
1171 If the <span class="emphasis"><em>pattern</em></span> given to <span class="command"><strong>nospam</strong></span>
1172 is exactly the same as the <span class="emphasis"><em>pattern</em></span> on an existing
1173 <span class="command"><strong>spam</strong></span> list entry, the effect will be to remove the
1174 entry from the spam list, instead of adding an exception. Likewise, if
1175 the <span class="emphasis"><em>pattern</em></span> for a <span class="command"><strong>spam</strong></span> command
1176 matches an entry on the <span class="command"><strong>nospam</strong></span> list, that nospam
1177 entry will be removed. If the <span class="emphasis"><em>pattern</em></span> for
1178 <span class="command"><strong>nospam</strong></span> is <span class="quote">“<span class="quote">*</span>”</span>, <span class="emphasis"><em>all entries on
1179 both lists</em></span> will be removed. This might be the default action
1180 if you use <span class="command"><strong>spam</strong></span> and <span class="command"><strong>nospam</strong></span> in
1181 conjunction with a <span class="command"><strong>folder-hook</strong></span>.
1183 You can have as many <span class="command"><strong>spam</strong></span> or
1184 <span class="command"><strong>nospam</strong></span> commands as you like. You can even do your
1185 own primitive <span class="command"><strong>spam</strong></span> detection within Mutt — for
1186 example, if you consider all mail from <code class="literal">MAILER-DAEMON</code>
1187 to be spam, you can use a <span class="command"><strong>spam</strong></span> command like this:
1188 </p><pre class="screen">
1189 spam "^From: .*MAILER-DAEMON" "999"
1190 </pre></div><div class="sect1" title="26. Setting and Querying Variables"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="set"></a>26. Setting and Querying Variables</h2></div></div></div><div class="sect2" title="26.1. Variable Types"><div class="titlepage"><div><div><h3 class="title"><a id="var-types"></a>26.1. Variable Types</h3></div></div></div><p>
1191 Mutt supports these types of configuration variables:
1192 </p><div class="variablelist"><dl><dt><span class="term">boolean</span></dt><dd><p>
1193 A boolean expression, either <span class="quote">“<span class="quote">yes</span>”</span> or <span class="quote">“<span class="quote">no</span>”</span>.
1194 </p></dd><dt><span class="term">number</span></dt><dd><p>
1195 A signed integer number in the range -32768 to 32767.
1196 </p></dd><dt><span class="term">string</span></dt><dd><p>
1198 </p></dd><dt><span class="term">path</span></dt><dd><p>
1199 A specialized string for representing paths including support for
1200 mailbox shortcuts (see <a class="xref" href="advancedusage.html#shortcuts" title="8. Mailbox Shortcuts">Section 8, “Mailbox Shortcuts”</a>) as well as tilde
1201 (<span class="quote">“<span class="quote">~</span>”</span>) for a user's home directory and more.
1202 </p></dd><dt><span class="term">quadoption</span></dt><dd><p>
1203 Like a boolean but triggers a prompt when set to <span class="quote">“<span class="quote">ask-yes</span>”</span>
1204 or <span class="quote">“<span class="quote">ask-no</span>”</span> with <span class="quote">“<span class="quote">yes</span>”</span> and <span class="quote">“<span class="quote">no</span>”</span>
1205 preselected respectively.
1206 </p></dd><dt><span class="term">sort order</span></dt><dd><p>
1207 A specialized string allowing only particular words as values depending
1209 </p></dd><dt><span class="term">regular expression</span></dt><dd><p>
1210 A regular expression, see <a class="xref" href="advancedusage.html#regexp" title="2. Regular Expressions">Section 2, “Regular Expressions”</a> for an introduction.
1211 </p></dd><dt><span class="term">folder magic</span></dt><dd><p>
1212 Specifies the type of folder to use: <span class="emphasis"><em>mbox</em></span>,
1213 <span class="emphasis"><em>mmdf</em></span>, <span class="emphasis"><em>mh</em></span> or
1214 <span class="emphasis"><em>maildir</em></span>. Currently only used to determine the type
1215 for newly created folders.
1216 </p></dd><dt><span class="term">e-mail address</span></dt><dd><p>
1217 An e-mail address either with or without realname. The older
1218 <span class="quote">“<span class="quote"><code class="literal">user@example.org (Joe User)</code></span>”</span> form is
1219 supported but strongly deprecated.
1220 </p></dd><dt><span class="term">user-defined</span></dt><dd><p>
1221 Arbitrary text, see <a class="xref" href="configuration.html#set-myvar" title="26.3. User-Defined Variables">Section 26.3, “User-Defined Variables”</a> for details.
1222 </p></dd></dl></div></div><div class="sect2" title="26.2. Commands"><div class="titlepage"><div><div><h3 class="title"><a id="set-commands"></a>26.2. Commands</h3></div></div></div><p>
1223 The following commands are available to manipulate and query variables:
1224 </p><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">set</code> {
1225 [ <code class="option">no</code> | <code class="option">inv</code> ]
1226 <em class="replaceable"><code>variable</code></em>
1228 <em class="replaceable"><code>variable=value</code></em>
1229 } [...]<br /><code class="command">toggle</code>
1230 <em class="replaceable"><code>variable</code></em>
1232 <em class="replaceable"><code>variable</code></em>
1233 ...]<br /><code class="command">unset</code>
1234 <em class="replaceable"><code>variable</code></em>
1236 <em class="replaceable"><code>variable</code></em>
1237 ...]<br /><code class="command">reset</code>
1238 <em class="replaceable"><code>variable</code></em>
1240 <em class="replaceable"><code>variable</code></em>
1242 This command is used to set (and unset) <a class="link" href="reference.html#variables" title="3. Configuration Variables">configuration variables</a>. There are four
1243 basic types of variables: boolean, number, string and quadoption.
1244 <span class="emphasis"><em>boolean</em></span> variables can be <span class="emphasis"><em>set</em></span>
1245 (true) or <span class="emphasis"><em>unset</em></span> (false).
1246 <span class="emphasis"><em>number</em></span> variables can be assigned a positive integer
1247 value. <span class="emphasis"><em>string</em></span> variables consist of any number of
1248 printable characters and must be enclosed in quotes if they contain
1249 spaces or tabs. You may also use the escape sequences <span class="quote">“<span class="quote">\n</span>”</span>
1250 and <span class="quote">“<span class="quote">\t</span>”</span> for newline and tab, respectively.
1251 <span class="emphasis"><em>quadoption</em></span> variables are used to control whether or
1252 not to be prompted for certain actions, or to specify a default action.
1253 A value of <span class="emphasis"><em>yes</em></span> will cause the action to be carried
1254 out automatically as if you had answered yes to the question.
1255 Similarly, a value of <span class="emphasis"><em>no</em></span> will cause the action to
1256 be carried out as if you had answered <span class="quote">“<span class="quote">no.</span>”</span> A value of
1257 <span class="emphasis"><em>ask-yes</em></span> will cause a prompt with a default answer
1258 of <span class="quote">“<span class="quote">yes</span>”</span> and <span class="emphasis"><em>ask-no</em></span> will provide a
1259 default answer of <span class="quote">“<span class="quote">no.</span>”</span>
1261 Prefixing a variable with <span class="quote">“<span class="quote">no</span>”</span> will unset it. Example:
1262 <code class="literal"><span class="command"><strong>set</strong></span> noaskbcc</code>.
1264 For <span class="emphasis"><em>boolean</em></span> variables, you may optionally prefix
1265 the variable name with <code class="literal">inv</code> to toggle the value (on or
1266 off). This is useful when writing macros. Example:
1267 <code class="literal"><span class="command"><strong>set</strong></span> invsmart_wrap</code>.
1269 The <span class="command"><strong>toggle</strong></span> command automatically prepends the
1270 <code class="literal">inv</code> prefix to all specified variables.
1272 The <span class="command"><strong>unset</strong></span> command automatically prepends the
1273 <code class="literal">no</code> prefix to all specified variables.
1275 Using the <code class="literal"><enter-command></code> function in the
1276 <span class="emphasis"><em>index</em></span> menu, you can query the value of a variable
1277 by prefixing the name of the variable with a question mark:
1278 </p><pre class="screen">
1281 The question mark is actually only required for boolean and quadoption
1284 The <span class="command"><strong>reset</strong></span> command resets all given variables to the
1285 compile time defaults (hopefully mentioned in this manual). If you use
1286 the command <span class="command"><strong>set</strong></span> and prefix the variable with
1287 <span class="quote">“<span class="quote">&</span>”</span> this has the same behavior as the
1288 <span class="command"><strong>reset</strong></span> command.
1290 With the <span class="command"><strong>reset</strong></span> command there exists the special
1291 variable <span class="quote">“<span class="quote">all</span>”</span>, which allows you to reset all variables to
1292 their system defaults.
1293 </p></div><div class="sect2" title="26.3. User-Defined Variables"><div class="titlepage"><div><div><h3 class="title"><a id="set-myvar"></a>26.3. User-Defined Variables</h3></div></div></div><div class="sect3" title="26.3.1. Introduction"><div class="titlepage"><div><div><h4 class="title"><a id="set-myvar-intro"></a>26.3.1. Introduction</h4></div></div></div><p>
1294 Along with the variables listed in the <a class="link" href="reference.html#variables" title="3. Configuration Variables">Configuration variables</a> section, Mutt
1295 supports user-defined variables with names starting with
1296 <code class="literal">my_</code> as in, for example, <code class="literal">my_cfgdir</code>.
1298 The <span class="command"><strong>set</strong></span> command either creates a custom
1299 <code class="literal">my_</code> variable or changes its value if it does exist
1300 already. The <span class="command"><strong>unset</strong></span> and <span class="command"><strong>reset</strong></span>
1301 commands remove the variable entirely.
1303 Since user-defined variables are expanded in the same way that
1304 environment variables are (except for the <a class="link" href="gettingstarted.html#shell-escape">shell-escape</a> command and backtick
1305 expansion), this feature can be used to make configuration files more
1307 </p></div><div class="sect3" title="26.3.2. Examples"><div class="titlepage"><div><div><h4 class="title"><a id="set-myvar-examples"></a>26.3.2. Examples</h4></div></div></div><p>
1308 The following example defines and uses the variable
1309 <code class="literal">my_cfgdir</code> to abbreviate the calls of the <a class="link" href="configuration.html#source" title="27. Reading Initialization Commands From Another File"><span class="command"><strong>source</strong></span></a> command:
1310 </p><div class="example"><a id="ex-myvar1"></a><p class="title"><b>Example 3.15. Using user-defined variables for config file readability</b></p><div class="example-contents"><pre class="screen">
1311 set my_cfgdir = $HOME/mutt/config
1313 source $my_cfgdir/hooks
1314 source $my_cfgdir/macros
1315 <span class="comment"># more source commands...</span>
1316 </pre></div></div><br class="example-break" /><p>
1317 A custom variable can also be used in macros to backup the current value
1318 of another variable. In the following example, the value of the <a class="link" href="reference.html#delete" title="3.49. delete">$delete</a> is changed temporarily while its
1319 original value is saved as <code class="literal">my_delete</code>. After the
1320 macro has executed all commands, the original value of <a class="link" href="reference.html#delete" title="3.49. delete">$delete</a> is restored.
1321 </p><div class="example"><a id="ex-myvar2"></a><p class="title"><b>Example 3.16. Using user-defined variables for backing up other config option values</b></p><div class="example-contents"><pre class="screen">
1323 <enter-command>set my_delete=$delete<enter>\
1324 <enter-command>set delete=yes<enter>\
1326 <enter-command>set delete=$my_delete<enter>'
1327 </pre></div></div><br class="example-break" /><p>
1328 Since Mutt expands such values already when parsing the configuration
1329 file(s), the value of <code class="literal">$my_delete</code> in the
1330 last example would be the value of <a class="link" href="reference.html#delete" title="3.49. delete">$delete</a> exactly
1331 as it was at that point during parsing the configuration file. If
1332 another statement would change the value for <a class="link" href="reference.html#delete" title="3.49. delete">$delete</a>
1333 later in the same or another file, it would have no effect on
1334 <code class="literal">$my_delete</code>. However, the expansion can
1335 be deferred to runtime, as shown in the next example, when escaping the
1337 </p><div class="example"><a id="ex-myvar3"></a><p class="title"><b>Example 3.17. Deferring user-defined variable expansion to runtime</b></p><div class="example-contents"><pre class="screen">
1338 macro pager <PageDown> "\
1339 <enter-command> set my_old_pager_stop=\$pager_stop pager_stop<Enter>\
1341 <enter-command> set pager_stop=\$my_old_pager_stop<Enter>\
1342 <enter-command> unset my_old_pager_stop<Enter>"
1343 </pre></div></div><br class="example-break" /><p>
1344 Note that there is a space between
1345 <code class="literal"><enter-command></code> and the <span class="command"><strong>set</strong></span>
1346 configuration command, preventing Mutt from recording the
1347 <span class="command"><strong>macro</strong></span>'s commands into its history.
1348 </p></div></div><div class="sect2" title="26.4. Type Conversions"><div class="titlepage"><div><div><h3 class="title"><a id="set-conversions"></a>26.4. Type Conversions</h3></div></div></div><p>
1349 Variables are always assigned string values which Mutt parses into its
1350 internal representation according to the type of the variable, for
1351 example an integer number for numeric types. For all queries (including
1352 $-expansion) the value is converted from its internal type back into
1353 string. As a result, any variable can be assigned any value given that
1354 its content is valid for the target. This also counts for custom
1355 variables which are of type string. In case of parsing errors, Mutt will
1356 print error messages. <a class="xref" href="configuration.html#ex-myvar4" title="Example 3.18. Type conversions using variables">Example 3.18, “Type conversions using variables”</a> demonstrates type
1358 </p><div class="example"><a id="ex-myvar4"></a><p class="title"><b>Example 3.18. Type conversions using variables</b></p><div class="example-contents"><pre class="screen">
1359 set my_lines = "5" <span class="comment"># value is string "5"</span>
1360 set pager_index_lines = $my_lines <span class="comment"># value is integer 5</span>
1362 set my_sort = "date-received" <span class="comment"># value is string "date-received"</span>
1363 set sort = "last-$my_sort" <span class="comment"># value is sort last-date-received</span>
1365 set my_inc = $read_inc <span class="comment"># value is string "10" (default of $read_inc)</span>
1366 set my_foo = $my_inc <span class="comment"># value is string "10"</span>
1367 </pre></div></div><br class="example-break" /><p>
1368 These assignments are all valid. If, however, the value of
1369 <code class="literal">$my_lines</code> would have been
1370 <span class="quote">“<span class="quote">five</span>”</span> (or something else that cannot be parsed into a
1371 number), the assignment to
1372 <code class="literal">$pager_index_lines</code> would have
1373 produced an error message.
1375 Type conversion applies to all configuration commands which take
1376 arguments. But please note that every expanded value of a variable is
1377 considered just a single token. A working example is:
1378 </p><pre class="screen">
1379 set my_pattern = "~A"
1380 set my_number = "10"
1382 <span class="comment"># same as: score ~A +10</span>
1383 score $my_pattern +$my_number</pre><p>
1384 What does <span class="emphasis"><em>not</em></span> work is:
1385 </p><pre class="screen">
1386 set my_mx = "+mailbox1 +mailbox2"
1387 mailboxes $my_mx +mailbox3</pre><p>
1388 because the value of <code class="literal">$my_mx</code> is interpreted as a
1389 single mailbox named <span class="quote">“<span class="quote">+mailbox1 +mailbox2</span>”</span> and not two
1391 </p></div></div><div class="sect1" title="27. Reading Initialization Commands From Another File"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="source"></a>27. Reading Initialization Commands From Another File</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">source</code>
1392 <em class="replaceable"><code>filename</code></em>
1394 This command allows the inclusion of initialization commands from other
1395 files. For example, I place all of my aliases in
1396 <code class="literal">~/.mail_aliases</code> so that I can make my
1397 <code class="literal">~/.muttrc</code> readable and keep my aliases private.
1399 If the filename begins with a tilde (<span class="quote">“<span class="quote">~</span>”</span>), it will be
1400 expanded to the path of your home directory.
1402 If the filename ends with a vertical bar (<span class="quote">“<span class="quote">|</span>”</span>), then
1403 <span class="emphasis"><em>filename</em></span> is considered to be an executable program
1404 from which to read input (e.g. <code class="literal"><span class="command"><strong>source</strong></span>
1405 ~/bin/myscript|</code>).
1406 </p></div><div class="sect1" title="28. Removing Hooks"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="unhook"></a>28. Removing Hooks</h2></div></div></div><p>Usage:</p><div class="cmdsynopsis"><p><code class="command">unhook</code> {
1407 <em class="replaceable"><code>*</code></em>
1409 <em class="replaceable"><code>hook-type</code></em>
1411 This command permits you to flush hooks you have previously defined.
1412 You can either remove all hooks by giving the <span class="quote">“<span class="quote">*</span>”</span> character
1413 as an argument, or you can remove all hooks of a specific type by saying
1414 something like <code class="literal"><span class="command"><strong>unhook</strong></span> send-hook</code>.
1415 </p></div><div class="sect1" title="29. Format Strings"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="formatstrings"></a>29. Format Strings</h2></div></div></div><div class="sect2" title="29.1. Basic usage"><div class="titlepage"><div><div><h3 class="title"><a id="formatstrings-basics"></a>29.1. Basic usage</h3></div></div></div><p>
1416 Format strings are a general concept you'll find in several locations
1417 through the Mutt configuration, especially in the <a class="link" href="reference.html#index-format" title="3.114. index_format">$index_format</a>, <a class="link" href="reference.html#pager-format" title="3.151. pager_format">$pager_format</a>, <a class="link" href="reference.html#status-format" title="3.283. status_format">$status_format</a>, and other related
1418 variables. These can be very straightforward, and it's quite possible
1419 you already know how to use them.
1421 The most basic format string element is a percent symbol followed by
1422 another character. For example, <code class="literal">%s</code> represents a
1423 message's Subject: header in the <a class="link" href="reference.html#index-format" title="3.114. index_format">$index_format</a> variable. The
1424 <span class="quote">“<span class="quote">expandos</span>”</span> available are documented with each format
1425 variable, but there are general modifiers available with all formatting
1426 expandos, too. Those are our concern here.
1428 Some of the modifiers are borrowed right out of C (though you might know
1429 them from Perl, Python, shell, or another language). These are the
1430 <code class="literal">[-]m.n</code> modifiers, as in
1431 <code class="literal">%-12.12s</code>. As with such programming languages, these
1432 modifiers allow you to specify the minimum and maximum size of the
1433 resulting string, as well as its justification. If the <span class="quote">“<span class="quote">-</span>”</span>
1434 sign follows the percent, the string will be left-justified instead of
1435 right-justified. If there's a number immediately following that, it's
1436 the minimum amount of space the formatted string will occupy — if
1437 it's naturally smaller than that, it will be padded out with spaces. If
1438 a decimal point and another number follow, that's the maximum space
1439 allowable — the string will not be permitted to exceed that width,
1440 no matter its natural size. Each of these three elements is optional, so
1441 that all these are legal format strings: <code class="literal">%-12s</code>,
1442 <code class="literal">%4c</code>, <code class="literal">%.15F</code> and
1443 <code class="literal">%-12.15L</code>.
1445 Mutt adds some other modifiers to format strings. If you use an equals
1446 symbol (<code class="literal">=</code>) as a numeric prefix (like the minus
1447 above), it will force the string to be centered within its minimum space
1448 range. For example, <code class="literal">%=14y</code> will reserve 14 characters
1449 for the %y expansion — that's the X-Label: header, in <a class="link" href="reference.html#index-format" title="3.114. index_format">$index_format</a>. If the expansion results in
1450 a string less than 14 characters, it will be centered in a 14-character
1451 space. If the X-Label for a message were <span class="quote">“<span class="quote">test</span>”</span>, that
1452 expansion would look like
1453 <span class="quote">“<span class="quote"> test </span>”</span>.
1455 There are two very little-known modifiers that affect the way that an
1456 expando is replaced. If there is an underline (<span class="quote">“<span class="quote">_</span>”</span>)
1457 character between any format modifiers (as above) and the expando
1458 letter, it will expands in all lower case. And if you use a colon
1459 (<span class="quote">“<span class="quote">:</span>”</span>), it will replace all decimal points with underlines.
1460 </p></div><div class="sect2" title="29.2. Conditionals"><div class="titlepage"><div><div><h3 class="title"><a id="formatstrings-conditionals"></a>29.2. Conditionals</h3></div></div></div><p>
1461 Depending on the format string variable, some of its sequences can be
1462 used to optionally print a string if their value is nonzero. For
1463 example, you may only want to see the number of flagged messages if such
1464 messages exist, since zero is not particularly meaningful. To optionally
1465 print a string based upon one of the above sequences, the following
1467 </p><pre class="screen">
1468 %?<sequence_char>?<optional_string>?</pre><p>
1469 where <span class="emphasis"><em>sequence_char</em></span> is an expando, and
1470 <span class="emphasis"><em>optional_string</em></span> is the string you would like
1471 printed if <span class="emphasis"><em>sequence_char</em></span> is nonzero.
1472 <span class="emphasis"><em>optional_string</em></span> may contain other sequences as well
1473 as normal text, but you may not nest optional strings.
1475 Here is an example illustrating how to optionally print the number of
1476 new messages in a mailbox in <a class="link" href="reference.html#status-format" title="3.283. status_format">$status_format</a>:
1477 </p><pre class="screen">
1478 %?n?%n new messages.?</pre><p>
1479 You can also switch between two strings using the following construct:
1480 </p><pre class="screen">
1481 %?<sequence_char>?<if_string>&<else_string>?</pre><p>
1482 If the value of <span class="emphasis"><em>sequence_char</em></span> is non-zero,
1483 <span class="emphasis"><em>if_string</em></span> will be expanded, otherwise
1484 <span class="emphasis"><em>else_string</em></span> will be expanded.
1485 </p></div><div class="sect2" title="29.3. Filters"><div class="titlepage"><div><div><h3 class="title"><a id="formatstrings-filters"></a>29.3. Filters</h3></div></div></div><p>
1486 Any format string ending in a vertical bar (<span class="quote">“<span class="quote">|</span>”</span>) will be
1487 expanded and piped through the first word in the string, using spaces as
1488 separator. The string returned will be used for display. If the
1489 returned string ends in %, it will be passed through the formatter a
1490 second time. This allows the filter to generate a replacement format
1491 string including % expandos.
1493 All % expandos in a format string are expanded before the script is
1495 </p><div class="example"><a id="ex-fmtpipe"></a><p class="title"><b>Example 3.19. Using external filters in format strings</b></p><div class="example-contents"><pre class="screen">
1496 set status_format="script.sh '%r %f (%L)'|"
1497 </pre></div></div><br class="example-break" /><p>
1498 will make Mutt expand <code class="literal">%r</code>, <code class="literal">%f</code> and
1499 <code class="literal">%L</code> before calling the script. The example also shows
1500 that arguments can be quoted: the script will receive the expanded
1501 string between the single quotes as the only argument.
1503 A practical example is the <code class="literal">mutt_xtitle</code> script
1504 installed in the <code class="literal">samples</code> subdirectory of the Mutt
1505 documentation: it can be used as filter for <a class="link" href="reference.html#status-format" title="3.283. status_format">$status_format</a> to set the current
1506 terminal's title, if supported.
1507 </p></div><div class="sect2" title="29.4. Padding"><div class="titlepage"><div><div><h3 class="title"><a id="formatstrings-padding"></a>29.4. Padding</h3></div></div></div><p>
1508 In most format strings, Mutt supports different types of padding using
1510 </p><div class="variablelist"><dl><dt><span class="term"><code class="literal">%|X</code></span></dt><dd><p>
1511 When this occurs, Mutt will fill the rest of the line with the character
1512 <code class="literal">X</code>. For example, filling the rest of the line with
1513 dashes is done by setting:
1514 </p><pre class="screen">
1515 set status_format = "%v on %h: %B: %?n?%n&no? new messages %|-"</pre></dd><dt><span class="term">
1516 <code class="literal">%>X</code>
1518 Since the previous expando stops at the end of line, there must be a way
1519 to fill the gap between two items via the <code class="literal">%>X</code>
1520 expando: it puts as many characters <code class="literal">X</code> in between two
1521 items so that the rest of the line will be right-justified. For example,
1522 to not put the version string and hostname the above example on the left
1523 but on the right and fill the gap with spaces, one might use (note the
1524 space after <code class="literal">%></code>):
1525 </p><pre class="screen">
1526 set status_format = "%B: %?n?%n&no? new messages %> (%v on %h)"</pre></dd><dt><span class="term"><code class="literal">%*X</code>
1528 Normal right-justification will print everything to the left of the
1529 <code class="literal">%></code>, displaying padding and whatever lies to the
1530 right only if there's room. By contrast, <span class="quote">“<span class="quote">soft-fill</span>”</span> gives
1531 priority to the right-hand side, guaranteeing space to display it and
1532 showing padding only if there's still room. If necessary, soft-fill will
1533 eat text leftwards to make room for rightward text. For example, to
1534 right-justify the subject making sure as much as possible of it fits on
1535 screen, one might use (note two spaces after <code class="literal">%* </code>: the
1536 second ensures there's a space between the truncated right-hand side and
1538 </p><pre class="screen">
1539 set index_format="%4C %Z %{%b %d} %-15.15L (%?l?%4l&%4c?)%* %s"</pre></dd></dl></div></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="gettingstarted.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="advancedusage.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 2. Getting Started </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 4. Advanced Usage</td></tr></table></div></body></html>