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