/usr/share/doc/vim/html/quickfix.html is in vim-doc 2:8.0.1453-1ubuntu1.
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 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 | <HTML>
<HEAD>
<META HTTP-EQUIV="Content-type" content="text/html; charset=ISO-8859-1">
<TITLE>Vim documentation: quickfix</TITLE>
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>Vim documentation: quickfix</H1>
<A NAME="top"></A>
<A HREF="index.html">main help file</A>
<HR>
<PRE>
*<A NAME="quickfix.txt"></A><B>quickfix.txt</B>* For Vim version 8.0. Last change: 2017 Dec 13
VIM REFERENCE MANUAL by <A HREF="intro.html#Bram">Bram</A> <A HREF="intro.html#Moolenaar">Moolenaar</A>
This subject is introduced in section |<A HREF="usr_30.html#30.1">30.1</A>| of the user manual.
1. Using QuickFix commands |<A HREF="#quickfix">quickfix</A>|
2. The error window |<A HREF="#quickfix-window">quickfix-window</A>|
3. Using more than one list of <A HREF="message.html#errors">errors</A> |<A HREF="#quickfix-error-lists">quickfix-error-lists</A>|
4. Using :make |<A HREF="#:make_makeprg">:make_makeprg</A>|
5. Using <A HREF="#:grep">:grep</A> |<A HREF="#grep">grep</A>|
6. Selecting a compiler |<A HREF="#compiler-select">compiler-select</A>|
7. The error format |<A HREF="#error-file-format">error-file-format</A>|
8. The directory stack |<A HREF="#quickfix-directory-stack">quickfix-directory-stack</A>|
9. Specific error file formats |<A HREF="#errorformats">errorformats</A>|
{Vi does not have any of these commands}
The quickfix commands are not available when the |<A HREF="various.html#+quickfix">+quickfix</A>| feature was
disabled at compile time.
=============================================================================
1. Using QuickFix commands *<A NAME="quickfix"></A><B>quickfix</B>* *<A NAME="Quickfix"></A><B>Quickfix</B>* *<A NAME="E42"></A><B>E42</B>*
Vim has a special mode to speedup the edit-compile-edit cycle. This is
inspired by the <A HREF="#quickfix">quickfix</A> option of the Manx's Aztec C compiler on the <A HREF="os_amiga.html#Amiga">Amiga</A>.
The idea is to save the error <A HREF="message.html#messages">messages</A> from the compiler in a file and use Vim
to jump to the <A HREF="message.html#errors">errors</A> one by one. You can examine each problem and fix <A HREF="motion.html#it">it</A>,
without having to remember all the error <A HREF="message.html#messages">messages</A>.
In Vim the <A HREF="#quickfix">quickfix</A> commands are used more generally to find a <A HREF="eval.html#list">list</A> of
positions in files. For example, |<A HREF="#:vimgrep">:vimgrep</A>| finds <A HREF="pattern.html#pattern">pattern</A> matches. You can
use the positions in a <A HREF="usr_41.html#script">script</A> with the |<A HREF="eval.html#getqflist()">getqflist()</A>| function. Thus you can
<A HREF="diff.html#do">do</A> a lot more than the edit/compile/fix cycle!
If you have the error <A HREF="message.html#messages">messages</A> in a file you can start Vim with:
<B> vim -q filename</B>
From inside Vim an <A HREF="starting.html#easy">easy</A> way to run a command and handle the output is with the
|<A HREF="#:make">:make</A>| command (see below).
The <A HREF="options.html#'errorformat'">'errorformat'</A> option should be set to match the error <A HREF="message.html#messages">messages</A> from your
compiler (see |<A HREF="#errorformat">errorformat</A>| below).
*<A NAME="quickfix-ID"></A><B>quickfix-ID</B>*
Each <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A> has a unique identifier called the <A HREF="#quickfix">quickfix</A> ID and this
number will not change within a Vim session. The <A HREF="eval.html#getqflist()">getqflist()</A> function can be
used to get the identifier assigned to a <A HREF="eval.html#list">list</A>. There is also a <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A>
number which may change whenever more than ten lists are added to a <A HREF="#quickfix">quickfix</A>
stack.
*<A NAME="location-list"></A><B>location-list</B>* *<A NAME="E776"></A><B>E776</B>*
A location <A HREF="eval.html#list">list</A> is a window-local <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A>. You get one after commands
like `:lvimgrep`, `:lgrep`, `:lhelpgrep`, `:lmake`, etc., which create a
location <A HREF="eval.html#list">list</A> instead of a <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A> <A HREF="motion.html#as">as</A> the corresponding `:vimgrep`,
`:grep`, `:helpgrep`, `:make` <A HREF="diff.html#do">do</A>.
A location <A HREF="eval.html#list">list</A> is associated with a <A HREF="windows.html#window">window</A> and each <A HREF="windows.html#window">window</A> can have a
separate location <A HREF="eval.html#list">list</A>. A location <A HREF="eval.html#list">list</A> can be associated with only one
<A HREF="windows.html#window">window</A>. The location <A HREF="eval.html#list">list</A> is independent of the <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A>.
When a <A HREF="windows.html#window">window</A> with a location <A HREF="eval.html#list">list</A> is split, the new <A HREF="windows.html#window">window</A> gets a copy of the
location <A HREF="eval.html#list">list</A>. When there are no longer any references to a location <A HREF="eval.html#list">list</A>,
the location <A HREF="eval.html#list">list</A> is destroyed.
*<A NAME="quickfix-changedtick"></A><B>quickfix-changedtick</B>*
Every <A HREF="#quickfix">quickfix</A> and location <A HREF="eval.html#list">list</A> has a read-only changedtick variable that
tracks the total number of changes made to the <A HREF="eval.html#list">list</A>. Every time the <A HREF="#quickfix">quickfix</A>
<A HREF="eval.html#list">list</A> is modified, this <A HREF="intro.html#count">count</A> is incremented. This can be used to perform an
action only when the <A HREF="eval.html#list">list</A> has changed. The <A HREF="eval.html#getqflist()">getqflist()</A> and <A HREF="eval.html#getloclist()">getloclist()</A>
<A HREF="eval.html#functions">functions</A> can be used to query the current value of changedtick. You cannot
change the changedtick variable.
The following <A HREF="#quickfix">quickfix</A> commands can be used. The location <A HREF="eval.html#list">list</A> commands are
similar to the <A HREF="#quickfix">quickfix</A> commands, <A HREF="change.html#replacing">replacing</A> the '<A HREF="change.html#c">c</A>' prefix in the <A HREF="#quickfix">quickfix</A>
command with '<A HREF="motion.html#l">l</A>'.
*<A NAME="E924"></A><B>E924</B>*
If the current <A HREF="windows.html#window">window</A> was closed by an |<A HREF="autocmd.html#autocommand">autocommand</A>| while processing a
location <A HREF="eval.html#list">list</A> command, <A HREF="motion.html#it">it</A> will be aborted.
*<A NAME="E925"></A><B>E925</B>* *<A NAME="E926"></A><B>E926</B>*
If the current <A HREF="#quickfix">quickfix</A> or location <A HREF="eval.html#list">list</A> was changed by an |<A HREF="autocmd.html#autocommand">autocommand</A>| while
processing a <A HREF="#quickfix">quickfix</A> or location <A HREF="eval.html#list">list</A> command, <A HREF="motion.html#it">it</A> will be aborted.
*<A NAME=":cc"></A><B>:cc</B>*
:cc[!] [nr] Display error [nr]. If [nr] is omitted, the same
error is displayed again. Without [!] this doesn't
work when jumping to another buffer, the current buffer
has been changed, there is the only <A HREF="windows.html#window">window</A> for the
buffer and both <A HREF="options.html#'hidden'">'hidden'</A> and <A HREF="options.html#'autowrite'">'autowrite'</A> are off.
When jumping to another buffer with [!] any changes to
the current buffer are lost, unless <A HREF="options.html#'hidden'">'hidden'</A> is set or
there is another <A HREF="windows.html#window">window</A> for this buffer.
The <A HREF="options.html#'switchbuf'">'switchbuf'</A> settings are respected when jumping
to a buffer.
*<A NAME=":ll"></A><B>:ll</B>*
:ll[!] [nr] Same <A HREF="motion.html#as">as</A> "<A HREF="#:cc">:cc</A>", except the location <A HREF="eval.html#list">list</A> for the
current <A HREF="windows.html#window">window</A> is used instead of the <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A>.
*<A NAME=":cn"></A><B>:cn</B>* *<A NAME=":cnext"></A><B>:cnext</B>* *<A NAME="E553"></A><B>E553</B>*
:[count]cn[ext][!] Display the <A HREF="intro.html#[count]">[count]</A> next error in the <A HREF="eval.html#list">list</A> that
includes a file name. If there are no file names at
all, go to the <A HREF="intro.html#[count]">[count]</A> next error. See |<A HREF="#:cc">:cc</A>| for
[!] and <A HREF="options.html#'switchbuf'">'switchbuf'</A>.
*<A NAME=":lne"></A><B>:lne</B>* *<A NAME=":lnext"></A><B>:lnext</B>*
:[count]lne[xt][!] Same <A HREF="motion.html#as">as</A> "<A HREF="#:cnext">:cnext</A>", except the location <A HREF="eval.html#list">list</A> for the
current <A HREF="windows.html#window">window</A> is used instead of the <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A>.
:[count]cN[ext][!] *<A NAME=":cp"></A><B>:cp</B>* *<A NAME=":cprevious"></A><B>:cprevious</B>* *<A NAME=":cN"></A><B>:cN</B>* *<A NAME=":cNext"></A><B>:cNext</B>*
:[count]cp[revious][!] Display the <A HREF="intro.html#[count]">[count]</A> previous error in the <A HREF="eval.html#list">list</A> that
includes a file name. If there are no file names at
all, go to the <A HREF="intro.html#[count]">[count]</A> previous error. See |<A HREF="#:cc">:cc</A>| for
[!] and <A HREF="options.html#'switchbuf'">'switchbuf'</A>.
:[count]lN[ext][!] *<A NAME=":lp"></A><B>:lp</B>* *<A NAME=":lprevious"></A><B>:lprevious</B>* *<A NAME=":lN"></A><B>:lN</B>* *<A NAME=":lNext"></A><B>:lNext</B>*
:[count]lp[revious][!] Same <A HREF="motion.html#as">as</A> "<A HREF="#:cNext">:cNext</A>" and "<A HREF="#:cprevious">:cprevious</A>", except the location
<A HREF="eval.html#list">list</A> for the current <A HREF="windows.html#window">window</A> is used instead of the
<A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A>.
*<A NAME=":cnf"></A><B>:cnf</B>* *<A NAME=":cnfile"></A><B>:cnfile</B>*
:[count]cnf[ile][!] Display the first error in the <A HREF="intro.html#[count]">[count]</A> next file in
the <A HREF="eval.html#list">list</A> that includes a file name. If there are no
file names at all or if there is no next file, go to
the <A HREF="intro.html#[count]">[count]</A> next error. See |<A HREF="#:cc">:cc</A>| for [!] and
<A HREF="options.html#'switchbuf'">'switchbuf'</A>.
*<A NAME=":lnf"></A><B>:lnf</B>* *<A NAME=":lnfile"></A><B>:lnfile</B>*
:[count]lnf[ile][!] Same <A HREF="motion.html#as">as</A> "<A HREF="#:cnfile">:cnfile</A>", except the location <A HREF="eval.html#list">list</A> for the
current <A HREF="windows.html#window">window</A> is used instead of the <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A>.
:[count]cNf[ile][!] *<A NAME=":cpf"></A><B>:cpf</B>* *<A NAME=":cpfile"></A><B>:cpfile</B>* *<A NAME=":cNf"></A><B>:cNf</B>* *<A NAME=":cNfile"></A><B>:cNfile</B>*
:[count]cpf[ile][!] Display the last error in the <A HREF="intro.html#[count]">[count]</A> previous file in
the <A HREF="eval.html#list">list</A> that includes a file name. If there are no
file names at all or if there is no next file, go to
the <A HREF="intro.html#[count]">[count]</A> previous error. See |<A HREF="#:cc">:cc</A>| for [!] and
<A HREF="options.html#'switchbuf'">'switchbuf'</A>.
:[count]lNf[ile][!] *<A NAME=":lpf"></A><B>:lpf</B>* *<A NAME=":lpfile"></A><B>:lpfile</B>* *<A NAME=":lNf"></A><B>:lNf</B>* *<A NAME=":lNfile"></A><B>:lNfile</B>*
:[count]lpf[ile][!] Same <A HREF="motion.html#as">as</A> "<A HREF="#:cNfile">:cNfile</A>" and "<A HREF="#:cpfile">:cpfile</A>", except the location
<A HREF="eval.html#list">list</A> for the current <A HREF="windows.html#window">window</A> is used instead of the
<A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A>.
*<A NAME=":crewind"></A><B>:crewind</B>* *<A NAME=":cr"></A><B>:cr</B>*
:cr[ewind][!] [nr] Display error [nr]. If [nr] is omitted, the FIRST
error is displayed. See |<A HREF="#:cc">:cc</A>|.
*<A NAME=":lrewind"></A><B>:lrewind</B>* *<A NAME=":lr"></A><B>:lr</B>*
:lr[ewind][!] [nr] Same <A HREF="motion.html#as">as</A> "<A HREF="#:crewind">:crewind</A>", except the location <A HREF="eval.html#list">list</A> for the
current <A HREF="windows.html#window">window</A> is used instead of the <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A>.
*<A NAME=":cfirst"></A><B>:cfirst</B>* *<A NAME=":cfir"></A><B>:cfir</B>*
:cfir[st][!] [nr] Same <A HREF="motion.html#as">as</A> "<A HREF="#:crewind">:crewind</A>".
*<A NAME=":lfirst"></A><B>:lfirst</B>* *<A NAME=":lfir"></A><B>:lfir</B>*
:lfir[st][!] [nr] Same <A HREF="motion.html#as">as</A> "<A HREF="#:lrewind">:lrewind</A>".
*<A NAME=":clast"></A><B>:clast</B>* *<A NAME=":cla"></A><B>:cla</B>*
:cla[st][!] [nr] Display error [nr]. If [nr] is omitted, the LAST
error is displayed. See |<A HREF="#:cc">:cc</A>|.
*<A NAME=":llast"></A><B>:llast</B>* *<A NAME=":lla"></A><B>:lla</B>*
:lla[st][!] [nr] Same <A HREF="motion.html#as">as</A> "<A HREF="#:clast">:clast</A>", except the location <A HREF="eval.html#list">list</A> for the
current <A HREF="windows.html#window">window</A> is used instead of the <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A>.
*<A NAME=":cq"></A><B>:cq</B>* *<A NAME=":cquit"></A><B>:cquit</B>*
:cq[uit][!] Quit Vim with an error code, so that the compiler
will not compile the same file again.
WARNING: All changes in files are lost! Also when the
[!] is not used. It works like ":qall!" |<A HREF="editing.html#:qall">:qall</A>|,
except that Vim returns a non-zero exit code.
*<A NAME=":cf"></A><B>:cf</B>* *<A NAME=":cfile"></A><B>:cfile</B>*
:cf[ile][!] [errorfile] Read the error file and jump to the first error.
This is done automatically when Vim is started with
the <A HREF="starting.html#-q">-q</A> option. You can use this command when you
keep Vim running while compiling. If you give the
name of the errorfile, the <A HREF="options.html#'errorfile'">'errorfile'</A> option will
be set to [errorfile]. See |<A HREF="#:cc">:cc</A>| for [!].
If the encoding of the error file differs from the
<A HREF="options.html#'encoding'">'encoding'</A> option, you can use the <A HREF="options.html#'makeencoding'">'makeencoding'</A>
option to specify the encoding.
*<A NAME=":lf"></A><B>:lf</B>* *<A NAME=":lfile"></A><B>:lfile</B>*
:lf[ile][!] [errorfile] Same <A HREF="motion.html#as">as</A> "<A HREF="#:cfile">:cfile</A>", except the location <A HREF="eval.html#list">list</A> for the
current <A HREF="windows.html#window">window</A> is used instead of the <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A>.
You can not use the <A HREF="starting.html#-q">-q</A> command-line option to set
the location <A HREF="eval.html#list">list</A>.
:cg[etfile] [errorfile] *<A NAME=":cg"></A><B>:cg</B>* *<A NAME=":cgetfile"></A><B>:cgetfile</B>*
Read the error file. Just like "<A HREF="#:cfile">:cfile</A>" but don't
jump to the first error.
If the encoding of the error file differs from the
<A HREF="options.html#'encoding'">'encoding'</A> option, you can use the <A HREF="options.html#'makeencoding'">'makeencoding'</A>
option to specify the encoding.
:lg[etfile] [errorfile] *<A NAME=":lg"></A><B>:lg</B>* *<A NAME=":lgetfile"></A><B>:lgetfile</B>*
Same <A HREF="motion.html#as">as</A> "<A HREF="#:cgetfile">:cgetfile</A>", except the location <A HREF="eval.html#list">list</A> for the
current <A HREF="windows.html#window">window</A> is used instead of the <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A>.
*<A NAME=":caddf"></A><B>:caddf</B>* *<A NAME=":caddfile"></A><B>:caddfile</B>*
:caddf[ile] [errorfile] Read the error file and add the <A HREF="message.html#errors">errors</A> from the
errorfile to the current <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A>. If a <A HREF="#quickfix">quickfix</A>
<A HREF="eval.html#list">list</A> is not present, then a new <A HREF="eval.html#list">list</A> is created.
If the encoding of the error file differs from the
<A HREF="options.html#'encoding'">'encoding'</A> option, you can use the <A HREF="options.html#'makeencoding'">'makeencoding'</A>
option to specify the encoding.
*<A NAME=":laddf"></A><B>:laddf</B>* *<A NAME=":laddfile"></A><B>:laddfile</B>*
:laddf[ile] [errorfile] Same <A HREF="motion.html#as">as</A> "<A HREF="#:caddfile">:caddfile</A>", except the location <A HREF="eval.html#list">list</A> for the
current <A HREF="windows.html#window">window</A> is used instead of the <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A>.
*<A NAME=":cb"></A><B>:cb</B>* *<A NAME=":cbuffer"></A><B>:cbuffer</B>* *<A NAME="E681"></A><B>E681</B>*
:cb[uffer][!] [bufnr] Read the error <A HREF="eval.html#list">list</A> from the current buffer.
When [bufnr] is given <A HREF="motion.html#it">it</A> must be the number of a
loaded buffer. That buffer will then be used instead
of the current buffer.
A range can be specified for the lines to be used.
Otherwise all lines in the buffer are used.
See |<A HREF="#:cc">:cc</A>| for [!].
*<A NAME=":lb"></A><B>:lb</B>* *<A NAME=":lbuffer"></A><B>:lbuffer</B>*
:lb[uffer][!] [bufnr] Same <A HREF="motion.html#as">as</A> "<A HREF="#:cbuffer">:cbuffer</A>", except the location <A HREF="eval.html#list">list</A> for the
current <A HREF="windows.html#window">window</A> is used instead of the <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A>.
*<A NAME=":cgetb"></A><B>:cgetb</B>* *<A NAME=":cgetbuffer"></A><B>:cgetbuffer</B>*
:cgetb[uffer] [bufnr] Read the error <A HREF="eval.html#list">list</A> from the current buffer. Just
like "<A HREF="#:cbuffer">:cbuffer</A>" but don't jump to the first error.
*<A NAME=":lgetb"></A><B>:lgetb</B>* *<A NAME=":lgetbuffer"></A><B>:lgetbuffer</B>*
:lgetb[uffer] [bufnr] Same <A HREF="motion.html#as">as</A> "<A HREF="#:cgetbuffer">:cgetbuffer</A>", except the location <A HREF="eval.html#list">list</A> for
the current <A HREF="windows.html#window">window</A> is used instead of the <A HREF="#quickfix">quickfix</A>
<A HREF="eval.html#list">list</A>.
*<A NAME=":cad"></A><B>:cad</B>* *<A NAME=":caddbuffer"></A><B>:caddbuffer</B>*
:cad[dbuffer] [bufnr] Read the error <A HREF="eval.html#list">list</A> from the current buffer and add
the <A HREF="message.html#errors">errors</A> to the current <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A>. If a
<A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A> is not present, then a new <A HREF="eval.html#list">list</A> is
created. Otherwise, same <A HREF="motion.html#as">as</A> "<A HREF="#:cbuffer">:cbuffer</A>".
*<A NAME=":laddb"></A><B>:laddb</B>* *<A NAME=":laddbuffer"></A><B>:laddbuffer</B>*
:laddb[uffer] [bufnr] Same <A HREF="motion.html#as">as</A> "<A HREF="#:caddbuffer">:caddbuffer</A>", except the location <A HREF="eval.html#list">list</A> for
the current <A HREF="windows.html#window">window</A> is used instead of the <A HREF="#quickfix">quickfix</A>
<A HREF="eval.html#list">list</A>.
*<A NAME=":cex"></A><B>:cex</B>* *<A NAME=":cexpr"></A><B>:cexpr</B>* *<A NAME="E777"></A><B>E777</B>*
:cex[pr][!] {expr} Create a <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A> using the result of {expr} and
jump to the first error.
If {expr} is a <A HREF="eval.html#String">String</A>, then each new-line terminated
line in the <A HREF="eval.html#String">String</A> is processed using the global value
of <A HREF="options.html#'errorformat'">'errorformat'</A> and the result is added to the
<A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A>.
If {expr} is a <A HREF="eval.html#List">List</A>, then each <A HREF="eval.html#String">String</A> item in the <A HREF="eval.html#list">list</A>
is processed and added to the <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A>. Non
<A HREF="eval.html#String">String</A> items in the <A HREF="eval.html#List">List</A> are ignored.
See |<A HREF="#:cc">:cc</A>| for [!].
Examples:
<B> :cexpr system('grep -n xyz *')</B>
<B> :cexpr getline(1, '$')</B>
*<A NAME=":lex"></A><B>:lex</B>* *<A NAME=":lexpr"></A><B>:lexpr</B>*
:lex[pr][!] {expr} Same <A HREF="motion.html#as">as</A> |<A HREF="#:cexpr">:cexpr</A>|, except the location <A HREF="eval.html#list">list</A> for the
current <A HREF="windows.html#window">window</A> is used instead of the <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A>.
*<A NAME=":cgete"></A><B>:cgete</B>* *<A NAME=":cgetexpr"></A><B>:cgetexpr</B>*
:cgete[xpr] {expr} Create a <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A> using the result of {expr}.
Just like |<A HREF="#:cexpr">:cexpr</A>|, but don't jump to the first error.
*<A NAME=":lgete"></A><B>:lgete</B>* *<A NAME=":lgetexpr"></A><B>:lgetexpr</B>*
:lgete[xpr] {expr} Same <A HREF="motion.html#as">as</A> |<A HREF="#:cgetexpr">:cgetexpr</A>|, except the location <A HREF="eval.html#list">list</A> for the
current <A HREF="windows.html#window">window</A> is used instead of the <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A>.
*<A NAME=":cadde"></A><B>:cadde</B>* *<A NAME=":caddexpr"></A><B>:caddexpr</B>*
:cadde[xpr] {expr} Evaluate {expr} and add the resulting lines to the
current <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A>. If a <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A> is not
present, then a new <A HREF="eval.html#list">list</A> is created. The current
cursor position will not be changed. See |<A HREF="#:cexpr">:cexpr</A>| for
more information.
Example:
<B> :g/mypattern/caddexpr expand("%") . ":" . line(".") . ":" . getline(".")</B>
*<A NAME=":lad"></A><B>:lad</B>* *<A NAME=":laddexpr"></A><B>:laddexpr</B>*
:lad[dexpr] {expr} Same <A HREF="motion.html#as">as</A> "<A HREF="#:caddexpr">:caddexpr</A>", except the location <A HREF="eval.html#list">list</A> for the
current <A HREF="windows.html#window">window</A> is used instead of the <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A>.
*<A NAME=":cl"></A><B>:cl</B>* *<A NAME=":clist"></A><B>:clist</B>*
:cl[ist] [from] [, [to]]
<A HREF="eval.html#List">List</A> all <A HREF="message.html#errors">errors</A> that are valid |<A HREF="#quickfix-valid">quickfix-valid</A>|.
If numbers [from] and/or [to] are given, the respective
range of <A HREF="message.html#errors">errors</A> is listed. A negative number counts
from the last error backwards, -1 being the last error.
The <A HREF="options.html#'switchbuf'">'switchbuf'</A> settings are respected when jumping
to a buffer.
:cl[ist] +{count} <A HREF="eval.html#List">List</A> the current and next {count} valid <A HREF="message.html#errors">errors</A>. This
is similar to "<A HREF="#:clist">:clist</A> from from+count", where "from"
is the current error position.
:cl[ist]! [from] [, [to]]
<A HREF="eval.html#List">List</A> all <A HREF="message.html#errors">errors</A>.
:cl[ist]! +{count} <A HREF="eval.html#List">List</A> the current and next {count} error lines. This
is useful to see unrecognized lines after the current
one. For example, if "<A HREF="#:clist">:clist</A>" shows:
<B><FONT COLOR="PURPLE"> 8384 testje.java:252: error: cannot find symbol </FONT></B>
Then using ":cl! +3" shows the reason:
<B><FONT COLOR="PURPLE"> 8384 testje.java:252: error: cannot find symbol </FONT></B>
<B><FONT COLOR="PURPLE"> 8385: ZexitCode = Fmainx(); </FONT></B>
<B><FONT COLOR="PURPLE"> 8386: ^ </FONT></B>
<B><FONT COLOR="PURPLE"> 8387: symbol: method Fmainx() </FONT></B>
:lli[st] [from] [, [to]] *<A NAME=":lli"></A><B>:lli</B>* *<A NAME=":llist"></A><B>:llist</B>*
Same <A HREF="motion.html#as">as</A> "<A HREF="#:clist">:clist</A>", except the location <A HREF="eval.html#list">list</A> for the
current <A HREF="windows.html#window">window</A> is used instead of the <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A>.
:lli[st]! [from] [, [to]]
<A HREF="eval.html#List">List</A> all the entries in the location <A HREF="eval.html#list">list</A> for the
current <A HREF="windows.html#window">window</A>.
If you insert or delete lines, mostly the correct error location is still
found because hidden marks are used. Sometimes, when the <A HREF="motion.html#mark">mark</A> has been
deleted for some reason, the message "line changed" is shown to warn you that
the error location may not be correct. If you quit Vim and start again the
marks are lost and the error locations may not be correct anymore.
If vim is built with |<A HREF="various.html#+autocmd">+autocmd</A>| support, two autocommands are available for
running commands before and after a <A HREF="#quickfix">quickfix</A> command (':make', '<A HREF="#:grep">:grep</A>' and so
on) is executed. See |<A HREF="autocmd.html#QuickFixCmdPre">QuickFixCmdPre</A>| and |<A HREF="autocmd.html#QuickFixCmdPost">QuickFixCmdPost</A>| for details.
*<A NAME="QuickFixCmdPost-example"></A><B>QuickFixCmdPost-example</B>*
When <A HREF="options.html#'encoding'">'encoding'</A> differs from the <A HREF="mbyte.html#locale">locale</A>, the error <A HREF="message.html#messages">messages</A> may have a
different encoding from what Vim is using. To convert the <A HREF="message.html#messages">messages</A> you can
use this code:
<B> function QfMakeConv()</B>
<B> let qflist = getqflist()</B>
<B> for i in qflist</B>
<B> let i.text = iconv(i.text, "cp936", "utf-8")</B>
<B> endfor</B>
<B> call setqflist(qflist)</B>
<B> endfunction</B>
<B> au QuickfixCmdPost make call QfMakeConv()</B>
Another option is using <A HREF="options.html#'makeencoding'">'makeencoding'</A>.
*<A NAME="quickfix-title"></A><B>quickfix-title</B>*
Every <A HREF="#quickfix">quickfix</A> and location <A HREF="eval.html#list">list</A> has a title. By default the title is set to
the command that created the list. The |<A HREF="eval.html#getqflist()">getqflist()</A>| and |<A HREF="eval.html#getloclist()">getloclist()</A>|
<A HREF="eval.html#functions">functions</A> can be used to get the title of a <A HREF="#quickfix">quickfix</A> and a location <A HREF="eval.html#list">list</A>
respectively. The |<A HREF="eval.html#setqflist()">setqflist()</A>| and |<A HREF="eval.html#setloclist()">setloclist()</A>| <A HREF="eval.html#functions">functions</A> can be used to
modify the title of a <A HREF="#quickfix">quickfix</A> and location <A HREF="eval.html#list">list</A> respectively. Examples:
<B> call setqflist([], 'a', {'title' : 'Cmd output'})</B>
<B> echo getqflist({'title' : 1})</B>
<B> call setloclist(3, [], 'a', {'title' : 'Cmd output'})</B>
<B> echo getloclist(3, {'title' : 1})</B>
*<A NAME="quickfix-size"></A><B>quickfix-size</B>*
You can get the number of entries (size) in a <A HREF="#quickfix">quickfix</A> and a location <A HREF="eval.html#list">list</A>
using the |<A HREF="eval.html#getqflist()">getqflist()</A>| and |<A HREF="eval.html#getloclist()">getloclist()</A>| <A HREF="eval.html#functions">functions</A> respectively. Examples:
<B> echo getqflist({'size' : 1})</B>
<B> echo getloclist(5, {'size' : 1})</B>
*<A NAME="quickfix-context"></A><B>quickfix-context</B>*
Any Vim type can be associated <A HREF="motion.html#as">as</A> a context with a <A HREF="#quickfix">quickfix</A> or location <A HREF="eval.html#list">list</A>.
The |<A HREF="eval.html#setqflist()">setqflist()</A>| and the |<A HREF="eval.html#setloclist()">setloclist()</A>| <A HREF="eval.html#functions">functions</A> can be used to associate a
context with a <A HREF="#quickfix">quickfix</A> and a location list respectively. The |<A HREF="eval.html#getqflist()">getqflist()</A>|
and the |<A HREF="eval.html#getloclist()">getloclist()</A>| <A HREF="eval.html#functions">functions</A> can be used to retrieve the context of a
<A HREF="#quickfix">quickfix</A> and a location <A HREF="eval.html#list">list</A> respectively. This is useful for a Vim <A HREF="usr_05.html#plugin">plugin</A>
dealing with multiple quickfix/location lists.
Examples:
<B> let somectx = {'name' : 'Vim', 'type' : 'Editor'}</B>
<B> call setqflist([], 'a', {'context' : somectx})</B>
<B> echo getqflist({'context' : 1})</B>
<B> let newctx = ['red', 'green', 'blue']</B>
<B> call setloclist(2, [], 'a', {'id' : qfid, 'context' : newctx})</B>
<B> echo getloclist(2, {'id' : qfid, 'context' : 1})</B>
*<A NAME="quickfix-parse"></A><B>quickfix-parse</B>*
You can parse a <A HREF="eval.html#list">list</A> of lines using <A HREF="options.html#'errorformat'">'errorformat'</A> without creating or
modifying a <A HREF="#quickfix">quickfix</A> list using the |<A HREF="eval.html#getqflist()">getqflist()</A>| function. Examples:
<B> echo getqflist({'lines' : ["F1:10:Line10", "F2:20:Line20"]})</B>
<B> echo getqflist({'lines' : systemlist('grep -Hn quickfix *')})</B>
This returns a dictionary where the 'items' key contains the <A HREF="eval.html#list">list</A> of <A HREF="#quickfix">quickfix</A>
entries parsed from lines. The following shows how to use a custom
<A HREF="options.html#'errorformat'">'errorformat'</A> to parse the lines without modifying the <A HREF="options.html#'errorformat'">'errorformat'</A> option:
<B> echo getqflist({'efm' : '%f#%l#%m', 'lines' : ['F1#10#Line']})</B>
EXECUTE A COMMAND IN ALL THE BUFFERS IN QUICKFIX OR LOCATION LIST:
*<A NAME=":cdo"></A><B>:cdo</B>*
:cdo[!] {cmd} Execute {cmd} in each valid entry in the <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A>.
It works like doing this:
<B> :cfirst</B>
<B> :{cmd}</B>
<B> :cnext</B>
<B> :{cmd}</B>
<B> etc.</B>
When the current file can't be |abandon|ed and the [!]
is not present, the command fails.
When an error is detected execution stops.
The last buffer (or where an error occurred) becomes
the current buffer.
{cmd} can contain '|' to concatenate several commands.
Only valid entries in the <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A> are used.
A range can be used to select entries, e.g.:
<B> :10,$cdo cmd</B>
To skip entries 1 to 9.
Note: While this command is executing, the <A HREF="autocmd.html#Syntax">Syntax</A>
<A HREF="autocmd.html#autocommand">autocommand</A> event is disabled by adding <A HREF="motion.html#it">it</A> to
<A HREF="options.html#'eventignore'">'eventignore'</A>. This considerably speeds up editing
each buffer.
{not in Vi} {not available when compiled without the
|<A HREF="various.html#+listcmds">+listcmds</A>| feature}
Also see |<A HREF="windows.html#:bufdo">:bufdo</A>|, |<A HREF="tabpage.html#:tabdo">:tabdo</A>|, |<A HREF="editing.html#:argdo">:argdo</A>|, |<A HREF="windows.html#:windo">:windo</A>|,
|<A HREF="#:ldo">:ldo</A>|, |<A HREF="#:cfdo">:cfdo</A>| and |<A HREF="#:lfdo">:lfdo</A>|.
*<A NAME=":cfdo"></A><B>:cfdo</B>*
:cfdo[!] {cmd} Execute {cmd} in each file in the <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A>.
It works like doing this:
<B> :cfirst</B>
<B> :{cmd}</B>
<B> :cnfile</B>
<B> :{cmd}</B>
<B> etc.</B>
Otherwise <A HREF="motion.html#it">it</A> works the same <A HREF="motion.html#as">as</A> `:cdo`.
{not in Vi} {not available when compiled without the
|<A HREF="various.html#+listcmds">+listcmds</A>| feature}
*<A NAME=":ldo"></A><B>:ldo</B>*
:ld[o][!] {cmd} Execute {cmd} in each valid entry in the location <A HREF="eval.html#list">list</A>
for the current <A HREF="windows.html#window">window</A>.
It works like doing this:
<B> :lfirst</B>
<B> :{cmd}</B>
<B> :lnext</B>
<B> :{cmd}</B>
<B> etc.</B>
Only valid entries in the location <A HREF="eval.html#list">list</A> are used.
Otherwise <A HREF="motion.html#it">it</A> works the same <A HREF="motion.html#as">as</A> `:cdo`.
{not in Vi} {not available when compiled without the
|<A HREF="various.html#+listcmds">+listcmds</A>| feature}
*<A NAME=":lfdo"></A><B>:lfdo</B>*
:lfdo[!] {cmd} Execute {cmd} in each file in the location <A HREF="eval.html#list">list</A> for
the current <A HREF="windows.html#window">window</A>.
It works like doing this:
<B> :lfirst</B>
<B> :{cmd}</B>
<B> :lnfile</B>
<B> :{cmd}</B>
<B> etc.</B>
Otherwise <A HREF="motion.html#it">it</A> works the same <A HREF="motion.html#as">as</A> `:ldo`.
{not in Vi} {not available when compiled without the
|<A HREF="various.html#+listcmds">+listcmds</A>| feature}
=============================================================================
2. The error <A HREF="windows.html#window">window</A> *<A NAME="quickfix-window"></A><B>quickfix-window</B>*
*<A NAME=":cope"></A><B>:cope</B>* *<A NAME=":copen"></A><B>:copen</B>* *<A NAME="w:quickfix_title"></A><B>w:quickfix_title</B>*
:cope[n] [height] Open a <A HREF="windows.html#window">window</A> to show the current <A HREF="eval.html#list">list</A> of <A HREF="message.html#errors">errors</A>.
When [height] is given, the <A HREF="windows.html#window">window</A> becomes that high
(if there is room). When [height] is omitted the
<A HREF="windows.html#window">window</A> is made ten lines high.
If there already is a <A HREF="#quickfix">quickfix</A> <A HREF="windows.html#window">window</A>, <A HREF="motion.html#it">it</A> will be made
the current <A HREF="windows.html#window">window</A>. It is not possible to open a
second <A HREF="#quickfix">quickfix</A> <A HREF="windows.html#window">window</A>. If [height] is given the
existing <A HREF="windows.html#window">window</A> will be resized to <A HREF="motion.html#it">it</A>.
The <A HREF="windows.html#window">window</A> will contain a special buffer, with
<A HREF="options.html#'buftype'">'buftype'</A> equal to "<A HREF="#quickfix">quickfix</A>". Don't change this!
The <A HREF="windows.html#window">window</A> will have the <A HREF="#w:quickfix_title">w:quickfix_title</A> variable set
which will indicate the command that produced the
<A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A>. This can be used to compose a custom
status line if the value of <A HREF="options.html#'statusline'">'statusline'</A> is adjusted
properly. Whenever this buffer is modified by a
<A HREF="#quickfix">quickfix</A> command or function, the |<A HREF="eval.html#b:changedtick">b:changedtick</A>|
variable is incremented.
*<A NAME=":lop"></A><B>:lop</B>* *<A NAME=":lopen"></A><B>:lopen</B>*
:lop[en] [height] Open a <A HREF="windows.html#window">window</A> to show the location <A HREF="eval.html#list">list</A> for the
current <A HREF="windows.html#window">window</A>. Works only when the location <A HREF="eval.html#list">list</A> for
the current <A HREF="windows.html#window">window</A> is present. You can have more than
one location <A HREF="windows.html#window">window</A> opened at a time. Otherwise, <A HREF="motion.html#it">it</A>
acts the same <A HREF="motion.html#as">as</A> "<A HREF="#:copen">:copen</A>".
*<A NAME=":ccl"></A><B>:ccl</B>* *<A NAME=":cclose"></A><B>:cclose</B>*
:ccl[ose] Close the <A HREF="#quickfix">quickfix</A> <A HREF="windows.html#window">window</A>.
*<A NAME=":lcl"></A><B>:lcl</B>* *<A NAME=":lclose"></A><B>:lclose</B>*
:lcl[ose] Close the <A HREF="windows.html#window">window</A> showing the location <A HREF="eval.html#list">list</A> for the
current <A HREF="windows.html#window">window</A>.
*<A NAME=":cw"></A><B>:cw</B>* *<A NAME=":cwindow"></A><B>:cwindow</B>*
:cw[indow] [height] Open the <A HREF="#quickfix">quickfix</A> <A HREF="windows.html#window">window</A> when there are recognized
<A HREF="message.html#errors">errors</A>. If the <A HREF="windows.html#window">window</A> is already open and there are
no recognized <A HREF="message.html#errors">errors</A>, close the <A HREF="windows.html#window">window</A>.
*<A NAME=":lw"></A><B>:lw</B>* *<A NAME=":lwindow"></A><B>:lwindow</B>*
:lw[indow] [height] Same <A HREF="motion.html#as">as</A> "<A HREF="#:cwindow">:cwindow</A>", except use the <A HREF="windows.html#window">window</A> showing the
location <A HREF="eval.html#list">list</A> for the current <A HREF="windows.html#window">window</A>.
*<A NAME=":cbo"></A><B>:cbo</B>* *<A NAME=":cbottom"></A><B>:cbottom</B>*
:cbo[ttom] Put the cursor in the last line of the <A HREF="#quickfix">quickfix</A> <A HREF="windows.html#window">window</A>
and scroll to make <A HREF="motion.html#it">it</A> visible. This is useful for
when <A HREF="message.html#errors">errors</A> are added by an asynchronous callback.
Only call <A HREF="motion.html#it">it</A> once in a while if there are many
updates to avoid a lot of redrawing.
*<A NAME=":lbo"></A><B>:lbo</B>* *<A NAME=":lbottom"></A><B>:lbottom</B>*
:lbo[ttom] Same <A HREF="motion.html#as">as</A> "<A HREF="#:cbottom">:cbottom</A>", except use the <A HREF="windows.html#window">window</A> showing the
location <A HREF="eval.html#list">list</A> for the current <A HREF="windows.html#window">window</A>.
Normally the <A HREF="#quickfix">quickfix</A> <A HREF="windows.html#window">window</A> is at the bottom of the screen. If there are
vertical splits, it's at the bottom of the rightmost column of <A HREF="windows.html#windows">windows</A>. To
make <A HREF="motion.html#it">it</A> always occupy the full width:
<B> :botright cwindow</B>
You can move the window around with |<A HREF="windows.html#window-moving">window-moving</A>| commands.
For example, to move <A HREF="motion.html#it">it</A> to the top: <A HREF="index.html#CTRL-W">CTRL-W</A> <A HREF="various.html#K">K</A>
The <A HREF="options.html#'winfixheight'">'winfixheight'</A> option will be set, which means that the <A HREF="windows.html#window">window</A> will mostly
keep its height, ignoring <A HREF="options.html#'winheight'">'winheight'</A> and <A HREF="options.html#'equalalways'">'equalalways'</A>. You can change the
height manually (e.g., by dragging the status line above <A HREF="motion.html#it">it</A> with the mouse).
In the <A HREF="#quickfix">quickfix</A> <A HREF="windows.html#window">window</A>, each line is one error. The line number is equal to
the error number. The current entry is highlighted with the QuickFixLine
highlighting. You can change <A HREF="motion.html#it">it</A> to your liking, e.g.:
<B> :hi QuickFixLine ctermbg=Yellow guibg=Yellow</B>
You can use ":.cc" to jump to the error under the cursor.
Hitting the <A HREF="intro.html#<Enter>"><Enter></A> key or double-clicking the mouse on a line has the same
effect. The file containing the error is opened in the <A HREF="windows.html#window">window</A> above the
<A HREF="#quickfix">quickfix</A> <A HREF="windows.html#window">window</A>. If there already is a <A HREF="windows.html#window">window</A> for that file, <A HREF="motion.html#it">it</A> is used
instead. If the buffer in the used <A HREF="windows.html#window">window</A> has changed, and the error is in
another file, jumping to the error will fail. You will first have to make
sure the <A HREF="windows.html#window">window</A> contains a buffer which can be abandoned.
*<A NAME="CTRL-W_<Enter>"></A><B>CTRL-W_<Enter></B>* *<A NAME="CTRL-W_<CR>"></A><B>CTRL-W_<CR></B>*
You can use <A HREF="index.html#CTRL-W">CTRL-W</A> <A HREF="intro.html#<Enter>"><Enter></A> to open a new <A HREF="windows.html#window">window</A> and jump to the error there.
When the <A HREF="#quickfix">quickfix</A> <A HREF="windows.html#window">window</A> has been filled, two <A HREF="autocmd.html#autocommand">autocommand</A> events are
triggered. First the <A HREF="options.html#'filetype'">'filetype'</A> option is set to "qf", which triggers the
<A HREF="autocmd.html#FileType">FileType</A> event. Then the <A HREF="autocmd.html#BufReadPost">BufReadPost</A> event is triggered, using "<A HREF="#quickfix">quickfix</A>" for
the buffer name. This can be used to perform some action on the listed
<A HREF="message.html#errors">errors</A>. Example:
<B> au BufReadPost quickfix setlocal modifiable</B>
<B> \ | silent exe 'g/^/s//\=line(".")." "/'</B>
<B> \ | setlocal nomodifiable</B>
This prepends the line number to each line. Note the use of "\=" in the
substitute <A HREF="eval.html#string">string</A> of the "<A HREF="change.html#:s">:s</A>" command, which is used to evaluate an
<A HREF="eval.html#expression">expression</A>.
The <A HREF="autocmd.html#BufWinEnter">BufWinEnter</A> event is also triggered, again using "<A HREF="#quickfix">quickfix</A>" for the buffer
name.
Note: When adding to an existing <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A> the <A HREF="autocmd.html#autocommand">autocommand</A> are not
triggered.
Note: Making changes in the <A HREF="#quickfix">quickfix</A> <A HREF="windows.html#window">window</A> has no effect on the <A HREF="eval.html#list">list</A> of
<A HREF="message.html#errors">errors</A>. <A HREF="options.html#'modifiable'">'modifiable'</A> is off to avoid making changes. If you delete or insert
lines anyway, the relation between the text and the error number is messed up.
If you really want to <A HREF="diff.html#do">do</A> this, you could write the contents of the <A HREF="#quickfix">quickfix</A>
<A HREF="windows.html#window">window</A> to a file and use "<A HREF="#:cfile">:cfile</A>" to have <A HREF="motion.html#it">it</A> parsed and used <A HREF="motion.html#as">as</A> the new error
<A HREF="eval.html#list">list</A>.
*<A NAME="location-list-window"></A><B>location-list-window</B>*
The location <A HREF="eval.html#list">list</A> <A HREF="windows.html#window">window</A> displays the entries in a location <A HREF="eval.html#list">list</A>. When you
open a location <A HREF="eval.html#list">list</A> <A HREF="windows.html#window">window</A>, <A HREF="motion.html#it">it</A> is created below the current <A HREF="windows.html#window">window</A> and
displays the location <A HREF="eval.html#list">list</A> for the current <A HREF="windows.html#window">window</A>. The location <A HREF="eval.html#list">list</A> <A HREF="windows.html#window">window</A>
is similar to the <A HREF="#quickfix">quickfix</A> <A HREF="windows.html#window">window</A>, except that you can have more than one
location <A HREF="eval.html#list">list</A> <A HREF="windows.html#window">window</A> open at a time. When you use a location <A HREF="eval.html#list">list</A> command in
this <A HREF="windows.html#window">window</A>, the displayed location <A HREF="eval.html#list">list</A> is used.
When you select a file from the location <A HREF="eval.html#list">list</A> <A HREF="windows.html#window">window</A>, the following steps are
used to find a <A HREF="windows.html#window">window</A> to edit the file:
1. If a <A HREF="windows.html#window">window</A> with the location <A HREF="eval.html#list">list</A> displayed in the location <A HREF="eval.html#list">list</A> <A HREF="windows.html#window">window</A> is
present, then the file is opened in that <A HREF="windows.html#window">window</A>.
2. If the above step fails and if the file is already opened in another
<A HREF="windows.html#window">window</A>, then that <A HREF="windows.html#window">window</A> is used.
3. If the above step fails then an existing <A HREF="windows.html#window">window</A> showing a buffer with
<A HREF="options.html#'buftype'">'buftype'</A> not set is used.
4. If the above step fails, then the file is edited in a new <A HREF="windows.html#window">window</A>.
In all of the above cases, if the location <A HREF="eval.html#list">list</A> for the selected <A HREF="windows.html#window">window</A> is not
yet set, then <A HREF="motion.html#it">it</A> is set to the location <A HREF="eval.html#list">list</A> displayed in the location <A HREF="eval.html#list">list</A>
<A HREF="windows.html#window">window</A>.
*<A NAME="quickfix-window-ID"></A><B>quickfix-window-ID</B>*
You can use the |<A HREF="eval.html#getqflist()">getqflist()</A>| and |<A HREF="eval.html#getloclist()">getloclist()</A>| <A HREF="eval.html#functions">functions</A> to obtain the
<A HREF="windows.html#window">window</A> ID of the <A HREF="#quickfix">quickfix</A> <A HREF="windows.html#window">window</A> and location <A HREF="eval.html#list">list</A> <A HREF="windows.html#window">window</A> respectively (if
present). Examples:
<B> echo getqflist({'winid' : 1}).winid</B>
<B> echo getloclist(2, {'winid' : 1}).winid</B>
=============================================================================
3. Using more than one <A HREF="eval.html#list">list</A> of <A HREF="message.html#errors">errors</A> *<A NAME="quickfix-error-lists"></A><B>quickfix-error-lists</B>*
So far has been assumed that there is only one <A HREF="eval.html#list">list</A> of <A HREF="message.html#errors">errors</A>. Actually the
ten last used lists are remembered. When starting a new <A HREF="eval.html#list">list</A>, the previous
ones are automatically kept. Two commands can be used to access older error
lists. They set one of the existing error lists <A HREF="motion.html#as">as</A> the current one.
*<A NAME=":colder"></A><B>:colder</B>* *<A NAME=":col"></A><B>:col</B>* *<A NAME="E380"></A><B>E380</B>*
:col[der] <A HREF="intro.html#[count]">[count]</A> Go to older error <A HREF="eval.html#list">list</A>. When <A HREF="intro.html#[count]">[count]</A> is given, <A HREF="diff.html#do">do</A>
this <A HREF="intro.html#[count]">[count]</A> times. When already at the oldest error
<A HREF="eval.html#list">list</A>, an error message is given.
*<A NAME=":lolder"></A><B>:lolder</B>* *<A NAME=":lol"></A><B>:lol</B>*
:lol[der] <A HREF="intro.html#[count]">[count]</A> Same <A HREF="motion.html#as">as</A> `:colder`, except use the location <A HREF="eval.html#list">list</A> for
the current <A HREF="windows.html#window">window</A> instead of the <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A>.
*<A NAME=":cnewer"></A><B>:cnewer</B>* *<A NAME=":cnew"></A><B>:cnew</B>* *<A NAME="E381"></A><B>E381</B>*
:cnew[er] <A HREF="intro.html#[count]">[count]</A> Go to newer error <A HREF="eval.html#list">list</A>. When <A HREF="intro.html#[count]">[count]</A> is given, <A HREF="diff.html#do">do</A>
this <A HREF="intro.html#[count]">[count]</A> times. When already at the newest error
<A HREF="eval.html#list">list</A>, an error message is given.
*<A NAME=":lnewer"></A><B>:lnewer</B>* *<A NAME=":lnew"></A><B>:lnew</B>*
:lnew[er] <A HREF="intro.html#[count]">[count]</A> Same <A HREF="motion.html#as">as</A> `:cnewer`, except use the location <A HREF="eval.html#list">list</A> for
the current <A HREF="windows.html#window">window</A> instead of the <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A>.
*<A NAME=":chistory"></A><B>:chistory</B>* *<A NAME=":chi"></A><B>:chi</B>*
:chi[story] Show the <A HREF="eval.html#list">list</A> of error lists. The current <A HREF="eval.html#list">list</A> is
marked with "<A HREF="change.html#>">></A>". The output looks like:
<B><FONT COLOR="PURPLE"> error list 1 of 3; 43 errors </FONT></B>
<B><FONT COLOR="PURPLE"> > error list 2 of 3; 0 errors </FONT></B>
<B><FONT COLOR="PURPLE"> error list 3 of 3; 15 errors </FONT></B>
*<A NAME=":lhistory"></A><B>:lhistory</B>* *<A NAME=":lhi"></A><B>:lhi</B>*
:lhi[story] Show the <A HREF="eval.html#list">list</A> of location lists, otherwise like
`:chistory`.
When adding a new error <A HREF="eval.html#list">list</A>, <A HREF="motion.html#it">it</A> becomes the current <A HREF="eval.html#list">list</A>.
When "<A HREF="#:colder">:colder</A>" has been used and "<A HREF="#:make">:make</A>" or "<A HREF="#:grep">:grep</A>" is used to add a new error
<A HREF="eval.html#list">list</A>, one newer <A HREF="eval.html#list">list</A> is overwritten. This is especially useful if you are
browsing with "<A HREF="#:grep">:grep</A>" |<A HREF="#grep">grep</A>|. If you want to keep the more recent error
lists, use "<A HREF="#:cnewer">:cnewer</A> 99" first.
To get the number of lists in the <A HREF="#quickfix">quickfix</A> and location <A HREF="eval.html#list">list</A> stack, you can
use the |<A HREF="eval.html#getqflist()">getqflist()</A>| and |<A HREF="eval.html#getloclist()">getloclist()</A>| <A HREF="eval.html#functions">functions</A> respectively with the list
number set to the special value '<A HREF="motion.html#$">$</A>'. Examples:
<B> echo getqflist({'nr' : '$'}).nr</B>
<B> echo getloclist(3, {'nr' : '$'}).nr</B>
To get the number of the current <A HREF="eval.html#list">list</A> in the stack:
<B> echo getqflist({'nr' : 0}).nr</B>
=============================================================================
4. Using <A HREF="#:make">:make</A> *<A NAME=":make_makeprg"></A><B>:make_makeprg</B>*
*<A NAME=":mak"></A><B>:mak</B>* *<A NAME=":make"></A><B>:make</B>*
:mak[e][!] [arguments] 1. If vim was built with |<A HREF="various.html#+autocmd">+autocmd</A>|, all relevant
|<A HREF="autocmd.html#QuickFixCmdPre">QuickFixCmdPre</A>| autocommands are executed.
2. If the <A HREF="options.html#'autowrite'">'autowrite'</A> option is on, write any changed
<A HREF="windows.html#buffers">buffers</A>
3. An errorfile name is made from <A HREF="options.html#'makeef'">'makeef'</A>. If
<A HREF="options.html#'makeef'">'makeef'</A> doesn't contain "##", and a file with this
name already exists, <A HREF="motion.html#it">it</A> is deleted.
4. The program given with the <A HREF="options.html#'makeprg'">'makeprg'</A> option is
started (default "make") with the optional
[arguments] and the output is saved in the
errorfile (for <A HREF="os_unix.html#Unix">Unix</A> <A HREF="motion.html#it">it</A> is also echoed on the
screen).
5. The errorfile is read using <A HREF="options.html#'errorformat'">'errorformat'</A>.
6. If vim was built with |<A HREF="various.html#+autocmd">+autocmd</A>|, all relevant
|<A HREF="autocmd.html#QuickFixCmdPost">QuickFixCmdPost</A>| autocommands are executed.
See example below.
7. If [!] is not given the first error is jumped to.
8. The errorfile is deleted.
9. You can now move through the <A HREF="message.html#errors">errors</A> with commands
like |<A HREF="#:cnext">:cnext</A>| and |<A HREF="#:cprevious">:cprevious</A>|, see above.
This command does not accept a comment, any "
characters are considered part of the arguments.
If the encoding of the program output differs from the
<A HREF="options.html#'encoding'">'encoding'</A> option, you can use the <A HREF="options.html#'makeencoding'">'makeencoding'</A>
option to specify the encoding.
*<A NAME=":lmak"></A><B>:lmak</B>* *<A NAME=":lmake"></A><B>:lmake</B>*
:lmak[e][!] [arguments]
Same <A HREF="motion.html#as">as</A> "<A HREF="#:make">:make</A>", except the location <A HREF="eval.html#list">list</A> for the
current <A HREF="windows.html#window">window</A> is used instead of the <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A>.
The "<A HREF="#:make">:make</A>" command executes the command given with the <A HREF="options.html#'makeprg'">'makeprg'</A> option.
This is done by passing the command to the shell given with the <A HREF="options.html#'shell'">'shell'</A>
option. This works almost like typing
":!{makeprg} [arguments] {shellpipe} {errorfile}".
{makeprg} is the <A HREF="eval.html#string">string</A> given with the <A HREF="options.html#'makeprg'">'makeprg'</A> option. Any command can be
used, not just "make". Characters '<A HREF="motion.html#%">%</A>' and '<A HREF="pattern.html##">#</A>' are expanded <A HREF="motion.html#as">as</A> usual on a
command-line. You can use "%<" to insert the current file name without
extension, or "#<" to insert the alternate file name without extension, for
example:
<B> :set makeprg=make\ #<.o</B>
[arguments] is anything that is typed after "<A HREF="#:make">:make</A>".
{shellpipe} is the <A HREF="options.html#'shellpipe'">'shellpipe'</A> option.
{errorfile} is the <A HREF="options.html#'makeef'">'makeef'</A> option, with ## replaced to make <A HREF="motion.html#it">it</A> unique.
The placeholder "$*" can be used for the argument <A HREF="eval.html#list">list</A> in {makeprg} if the
command needs some additional characters after its arguments. The $* is
replaced then by all arguments. Example:
<B> :set makeprg=latex\ \\\\nonstopmode\ \\\\input\\{$*}</B>
or simpler
<B> :let &mp = 'latex \\nonstopmode \\input\{$*}'</B>
"$*" can be given multiple times, for example:
<B> :set makeprg=gcc\ -o\ $*\ $*</B>
The <A HREF="options.html#'shellpipe'">'shellpipe'</A> option defaults to "<A HREF="change.html#>">></A>" for the <A HREF="os_amiga.html#Amiga">Amiga</A>, <A HREF="os_msdos.html#MS-DOS">MS-DOS</A> and <A HREF="os_win32.html#Win32">Win32</A>. This
means that the output of the compiler is saved in a file and not shown on the
screen directly. For <A HREF="os_unix.html#Unix">Unix</A> "| tee" is used. The compiler output is shown on
the screen and saved in a file the same time. Depending on the shell used
"|& tee" or "2>&1| tee" is the default, so stderr output will be included.
If <A HREF="options.html#'shellpipe'">'shellpipe'</A> is empty, the {errorfile} part will be omitted. This is useful
for compilers that write to an errorfile themselves (e.g., Manx's <A HREF="os_amiga.html#Amiga">Amiga</A> C).
<B><FONT COLOR="PURPLE">Using QuickFixCmdPost to fix the encoding </FONT></B>
It may be that <A HREF="options.html#'encoding'">'encoding'</A> is set to an encoding that differs from the <A HREF="message.html#messages">messages</A>
your build program produces. This example shows how to fix this after Vim has
read the error <A HREF="message.html#messages">messages</A>:
<B> function QfMakeConv()</B>
<B> let qflist = getqflist()</B>
<B> for i in qflist</B>
<B> let i.text = iconv(i.text, "cp936", "utf-8")</B>
<B> endfor</B>
<B> call setqflist(qflist)</B>
<B> endfunction</B>
<B> au QuickfixCmdPost make call QfMakeConv()</B>
(Example by Faque Cheng)
Another option is using <A HREF="options.html#'makeencoding'">'makeencoding'</A>.
==============================================================================
5. Using <A HREF="#:vimgrep">:vimgrep</A> and <A HREF="#:grep">:grep</A> *<A NAME="grep"></A><B>grep</B>* *<A NAME="lid"></A><B>lid</B>*
Vim has two ways to find matches for a <A HREF="pattern.html#pattern">pattern</A>: Internal and external. The
advantage of the internal <A HREF="#grep">grep</A> is that <A HREF="motion.html#it">it</A> works on all systems and uses the
powerful Vim search patterns. An external <A HREF="#grep">grep</A> program can be used when the
Vim <A HREF="#grep">grep</A> does not <A HREF="diff.html#do">do</A> what you want.
The internal method will be slower, because files are read into memory. The
advantages are:
- Line separators and encoding are automatically recognized, <A HREF="motion.html#as">as</A> if a file is
being edited.
- Uses Vim search patterns. Multi-line patterns can be used.
- When plugins are enabled: compressed and remote files can be searched.
|<A HREF="pi_gzip.html#gzip">gzip</A>| |<A HREF="pi_netrw.html#netrw">netrw</A>|
To be able to <A HREF="diff.html#do">do</A> this Vim loads each file <A HREF="motion.html#as">as</A> if <A HREF="motion.html#it">it</A> is being edited. When
there is no match in the file the associated buffer is wiped out again. The
<A HREF="options.html#'hidden'">'hidden'</A> option is ignored here to avoid running out of memory or file
descriptors when searching many files. However, when the |<A HREF="windows.html#:hide">:hide</A>| command
modifier is used the <A HREF="windows.html#buffers">buffers</A> are kept loaded. This makes following searches
in the same files a lot faster.
Note that |<A HREF="#:copen">:copen</A>| (or |<A HREF="#:lopen">:lopen</A>| for |<A HREF="#:lgrep">:lgrep</A>|) may be used to open a buffer
containing the search results in linked form. The |<A HREF="various.html#:silent">:silent</A>| command may be
used to suppress the default full screen <A HREF="#grep">grep</A> output. The ":grep!" form of
the |<A HREF="#:grep">:grep</A>| command doesn't jump to the first match automatically. These
commands can be combined to create a NewGrep command:
<B> command! -nargs=+ NewGrep execute 'silent grep! <args>' | copen 42</B>
5.1 using Vim's internal <A HREF="#grep">grep</A>
*<A NAME=":vim"></A><B>:vim</B>* *<A NAME=":vimgrep"></A><B>:vimgrep</B>* *<A NAME="E682"></A><B>E682</B>* *<A NAME="E683"></A><B>E683</B>*
:vim[grep][!] /{pattern}/[g][j] <A HREF="editing.html#{file}">{file}</A> <A HREF="eval.html#...">...</A>
Search for {pattern} in the files <A HREF="editing.html#{file}">{file}</A> <A HREF="eval.html#...">...</A> and set
the error <A HREF="eval.html#list">list</A> to the matches. Files matching
<A HREF="options.html#'wildignore'">'wildignore'</A> are ignored; files in <A HREF="options.html#'suffixes'">'suffixes'</A> are
searched last.
Without the '<A HREF="index.html#g">g</A>' flag each line is added only once.
With '<A HREF="index.html#g">g</A>' every match is added.
{pattern} is a Vim search <A HREF="pattern.html#pattern">pattern</A>. Instead of
enclosing <A HREF="motion.html#it">it</A> in / any non-ID character (see
|<A HREF="options.html#'isident'">'isident'</A>|) can be used, so long <A HREF="motion.html#as">as</A> <A HREF="motion.html#it">it</A> does not
appear in {pattern}.
<A HREF="options.html#'ignorecase'">'ignorecase'</A> applies. To overrule <A HREF="motion.html#it">it</A> put |<A HREF="pattern.html#/\c">/\c</A>| in the
<A HREF="pattern.html#pattern">pattern</A> to ignore <A HREF="change.html#case">case</A> or |<A HREF="pattern.html#/\C">/\C</A>| to match <A HREF="change.html#case">case</A>.
<A HREF="options.html#'smartcase'">'smartcase'</A> is not used.
If {pattern} is empty (e.g. <A HREF="version7.html#//">//</A> is specified), the last
used search pattern is used. |<A HREF="pattern.html#last-pattern">last-pattern</A>|
When a number is put before the command this is used
<A HREF="motion.html#as">as</A> the maximum number of matches to find. Use
":1vimgrep <A HREF="pattern.html#pattern">pattern</A> file" to find only the first.
Useful if you only want to check if there is a match
and quit quickly when it's found.
Without the '<A HREF="motion.html#j">j</A>' flag Vim jumps to the first match.
With '<A HREF="motion.html#j">j</A>' only the <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A> is updated.
With the [!] any changes in the current buffer are
abandoned.
Every second or so the searched file name is displayed
to give you an idea of the progress made.
Examples:
<B> :vimgrep /an error/ *.c</B>
<B> :vimgrep /\<FileName\>/ *.h include/*</B>
<B> :vimgrep /myfunc/ **/*.c</B>
For the use of "**" see |<A HREF="editing.html#starstar-wildcard">starstar-wildcard</A>|.
:vim[grep][!] {pattern} <A HREF="editing.html#{file}">{file}</A> <A HREF="eval.html#...">...</A>
Like above, but instead of enclosing the <A HREF="pattern.html#pattern">pattern</A> in a
non-ID character use a white-separated <A HREF="pattern.html#pattern">pattern</A>. The
<A HREF="pattern.html#pattern">pattern</A> must start with an ID character.
Example:
<B> :vimgrep Error *.c</B>
*<A NAME=":lv"></A><B>:lv</B>* *<A NAME=":lvimgrep"></A><B>:lvimgrep</B>*
:lv[imgrep][!] /{pattern}/[g][j] <A HREF="editing.html#{file}">{file}</A> <A HREF="eval.html#...">...</A>
:lv[imgrep][!] {pattern} <A HREF="editing.html#{file}">{file}</A> <A HREF="eval.html#...">...</A>
Same <A HREF="motion.html#as">as</A> "<A HREF="#:vimgrep">:vimgrep</A>", except the location <A HREF="eval.html#list">list</A> for the
current <A HREF="windows.html#window">window</A> is used instead of the <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A>.
*<A NAME=":vimgrepa"></A><B>:vimgrepa</B>* *<A NAME=":vimgrepadd"></A><B>:vimgrepadd</B>*
:vimgrepa[dd][!] /{pattern}/[g][j] <A HREF="editing.html#{file}">{file}</A> <A HREF="eval.html#...">...</A>
:vimgrepa[dd][!] {pattern} <A HREF="editing.html#{file}">{file}</A> <A HREF="eval.html#...">...</A>
Just like "<A HREF="#:vimgrep">:vimgrep</A>", but instead of making a new <A HREF="eval.html#list">list</A>
of <A HREF="message.html#errors">errors</A> the matches are appended to the current
<A HREF="eval.html#list">list</A>.
*<A NAME=":lvimgrepa"></A><B>:lvimgrepa</B>* *<A NAME=":lvimgrepadd"></A><B>:lvimgrepadd</B>*
:lvimgrepa[dd][!] /{pattern}/[g][j] <A HREF="editing.html#{file}">{file}</A> <A HREF="eval.html#...">...</A>
:lvimgrepa[dd][!] {pattern} <A HREF="editing.html#{file}">{file}</A> <A HREF="eval.html#...">...</A>
Same <A HREF="motion.html#as">as</A> "<A HREF="#:vimgrepadd">:vimgrepadd</A>", except the location <A HREF="eval.html#list">list</A> for
the current <A HREF="windows.html#window">window</A> is used instead of the <A HREF="#quickfix">quickfix</A>
<A HREF="eval.html#list">list</A>.
5.2 External <A HREF="#grep">grep</A>
Vim can interface with "<A HREF="#grep">grep</A>" and grep-like programs (such <A HREF="motion.html#as">as</A> the GNU
id-utils) in a similar way to its compiler integration (see |<A HREF="#:make">:make</A>| above).
[Unix trivia: The name for the <A HREF="os_unix.html#Unix">Unix</A> "<A HREF="#grep">grep</A>" command comes from ":g/re/p", where
"re" stands for Regular Expression.]
*<A NAME=":gr"></A><B>:gr</B>* *<A NAME=":grep"></A><B>:grep</B>*
:gr[ep][!] [arguments] Just like "<A HREF="#:make">:make</A>", but use <A HREF="options.html#'grepprg'">'grepprg'</A> instead of
<A HREF="options.html#'makeprg'">'makeprg'</A> and <A HREF="options.html#'grepformat'">'grepformat'</A> instead of <A HREF="options.html#'errorformat'">'errorformat'</A>.
When <A HREF="options.html#'grepprg'">'grepprg'</A> is "internal" this works like
|<A HREF="#:vimgrep">:vimgrep</A>|. Note that the <A HREF="pattern.html#pattern">pattern</A> needs to be
enclosed in separator characters then.
If the encoding of the program output differs from the
<A HREF="options.html#'encoding'">'encoding'</A> option, you can use the <A HREF="options.html#'makeencoding'">'makeencoding'</A>
option to specify the encoding.
*<A NAME=":lgr"></A><B>:lgr</B>* *<A NAME=":lgrep"></A><B>:lgrep</B>*
:lgr[ep][!] [arguments] Same <A HREF="motion.html#as">as</A> "<A HREF="#:grep">:grep</A>", except the location <A HREF="eval.html#list">list</A> for the
current <A HREF="windows.html#window">window</A> is used instead of the <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A>.
*<A NAME=":grepa"></A><B>:grepa</B>* *<A NAME=":grepadd"></A><B>:grepadd</B>*
:grepa[dd][!] [arguments]
Just like "<A HREF="#:grep">:grep</A>", but instead of making a new <A HREF="eval.html#list">list</A> of
<A HREF="message.html#errors">errors</A> the matches are appended to the current <A HREF="eval.html#list">list</A>.
Example:
<B> :call setqflist([])</B>
<B> :bufdo grepadd! something %</B>
The first command makes a new error <A HREF="eval.html#list">list</A> which is
empty. The second command executes "grepadd" for each
listed buffer. Note the use of ! to avoid that
"<A HREF="#:grepadd">:grepadd</A>" jumps to the first error, which is not
allowed with |<A HREF="windows.html#:bufdo">:bufdo</A>|.
An example that uses the argument <A HREF="eval.html#list">list</A> and avoids
<A HREF="message.html#errors">errors</A> for files without matches:
<B> :silent argdo try </B>
<B> \ | grepadd! something %</B>
<B> \ | catch /E480:/</B>
<B> \ | endtry"</B>
If the encoding of the program output differs from the
<A HREF="options.html#'encoding'">'encoding'</A> option, you can use the <A HREF="options.html#'makeencoding'">'makeencoding'</A>
option to specify the encoding.
*<A NAME=":lgrepa"></A><B>:lgrepa</B>* *<A NAME=":lgrepadd"></A><B>:lgrepadd</B>*
:lgrepa[dd][!] [arguments]
Same <A HREF="motion.html#as">as</A> "<A HREF="#:grepadd">:grepadd</A>", except the location <A HREF="eval.html#list">list</A> for the
current <A HREF="windows.html#window">window</A> is used instead of the <A HREF="#quickfix">quickfix</A> <A HREF="eval.html#list">list</A>.
5.3 Setting up external <A HREF="#grep">grep</A>
If you have a standard "<A HREF="#grep">grep</A>" program installed, the <A HREF="#:grep">:grep</A> command may work
well with the defaults. The <A HREF="syntax.html#syntax">syntax</A> is very similar to the standard command:
<B> :grep foo *.c</B>
Will search all files with the .c extension for the substring "foo". The
arguments to <A HREF="#:grep">:grep</A> are passed straight to the "<A HREF="#grep">grep</A>" program, so you can use
whatever <A HREF="options.html#options">options</A> your "<A HREF="#grep">grep</A>" supports.
By default, <A HREF="#:grep">:grep</A> invokes <A HREF="#grep">grep</A> with the <A HREF="starting.html#-n">-n</A> option (show file and line
numbers). You can change this with the <A HREF="options.html#'grepprg'">'grepprg'</A> option. You will need to set
<A HREF="options.html#'grepprg'">'grepprg'</A> if:
<A HREF="motion.html#a)">a)</A> You are using a program that isn't called "<A HREF="#grep">grep</A>"
<A HREF="motion.html#b">b</A>) You have to call <A HREF="#grep">grep</A> with a full path
<A HREF="change.html#c">c</A>) You want to pass other <A HREF="options.html#options">options</A> automatically (e.g. <A HREF="change.html#case">case</A> insensitive
search.)
Once "<A HREF="#grep">grep</A>" has executed, Vim parses the results using the <A HREF="options.html#'grepformat'">'grepformat'</A>
option. This option works in the same way <A HREF="motion.html#as">as</A> the <A HREF="options.html#'errorformat'">'errorformat'</A> option - see
that for details. You may need to change <A HREF="options.html#'grepformat'">'grepformat'</A> from the default if
your <A HREF="#grep">grep</A> outputs in a non-standard format, or you are using some other
program with a special format.
Once the results are parsed, Vim loads the first file containing a match and
jumps to the appropriate line, in the same way that <A HREF="motion.html#it">it</A> jumps to a compiler
error in |<A HREF="#quickfix">quickfix</A>| mode. You can then use the |<A HREF="#:cnext">:cnext</A>|, |<A HREF="#:clist">:clist</A>|, etc.
commands to see the other matches.
5.4 Using <A HREF="#:grep">:grep</A> with id-utils
You can set up <A HREF="#:grep">:grep</A> to work with the GNU id-utils like this:
<B> :set grepprg=lid\ -Rgrep\ -s</B>
<B> :set grepformat=%f:%l:%m</B>
then
<B> :grep (regexp)</B>
works just <A HREF="motion.html#as">as</A> you'd expect.
(provided you remembered to mkid first :)
5.5 Browsing source code with <A HREF="#:vimgrep">:vimgrep</A> or <A HREF="#:grep">:grep</A>
Using the stack of error lists that Vim keeps, you can browse your files to
look for <A HREF="eval.html#functions">functions</A> and the <A HREF="eval.html#functions">functions</A> they call. For example, suppose that you
have to add an argument to the read_file() function. You enter this command:
<B> :vimgrep /\<read_file\>/ *.c</B>
You use "<A HREF="#:cn">:cn</A>" to go along the <A HREF="eval.html#list">list</A> of matches and add the argument. At one
place you have to get the new argument from a higher level function msg(), and
need to change that one too. Thus you use:
<B> :vimgrep /\<msg\>/ *.c</B>
While <A HREF="change.html#changing">changing</A> the msg() <A HREF="eval.html#functions">functions</A>, you find another function that needs to
get the argument from a higher level. You can again use "<A HREF="#:vimgrep">:vimgrep</A>" to find
these <A HREF="eval.html#functions">functions</A>. Once you are finished with one function, you can use
<B> :colder</B>
to go back to the previous one.
This works like browsing a tree: "<A HREF="#:vimgrep">:vimgrep</A>" goes one level deeper, creating a
<A HREF="eval.html#list">list</A> of branches. "<A HREF="#:colder">:colder</A>" goes back to the previous level. You can mix
this use of "<A HREF="#:vimgrep">:vimgrep</A>" and "colder" to browse all the locations in a tree-like
way. If you <A HREF="diff.html#do">do</A> this consistently, you will find all locations without the
need to write down a "<A HREF="todo.html#todo">todo</A>" <A HREF="eval.html#list">list</A>.
=============================================================================
6. Selecting a compiler *<A NAME="compiler-select"></A><B>compiler-select</B>*
*<A NAME=":comp"></A><B>:comp</B>* *<A NAME=":compiler"></A><B>:compiler</B>* *<A NAME="E666"></A><B>E666</B>*
:comp[iler][!] {name} Set <A HREF="options.html#options">options</A> to work with compiler {name}.
Without the "<A HREF="change.html#!">!</A>" <A HREF="options.html#options">options</A> are set for the
current buffer. With "<A HREF="change.html#!">!</A>" global <A HREF="options.html#options">options</A> are
set.
If you use "<A HREF="#:compiler">:compiler</A> foo" in "file.foo" and
then ":compiler! bar" in another buffer, Vim
will keep on using "foo" in "file.foo".
{not available when compiled without the
|<A HREF="various.html#+eval">+eval</A>| feature}
The Vim plugins in the "compiler" directory will set <A HREF="options.html#options">options</A> to use the
selected compiler. For `:compiler` local <A HREF="options.html#options">options</A> are set, for `:compiler!`
global <A HREF="options.html#options">options</A>.
*<A NAME="current_compiler"></A><B>current_compiler</B>*
To support older Vim versions, the plugins always use "<A HREF="#current_compiler">current_compiler</A>" and
not "b:current_compiler". What the command actually does is the following:
- Delete the "<A HREF="#current_compiler">current_compiler</A>" and "b:current_compiler" <A HREF="eval.html#variables">variables</A>.
- Define the "CompilerSet" user command. With "<A HREF="change.html#!">!</A>" <A HREF="motion.html#it">it</A> does "<A HREF="options.html#:set">:set</A>", without "<A HREF="change.html#!">!</A>"
<A HREF="motion.html#it">it</A> does "<A HREF="options.html#:setlocal">:setlocal</A>".
- Execute ":runtime! compiler/{name}.vim". The plugins are expected to set
<A HREF="options.html#options">options</A> with "CompilerSet" and set the "<A HREF="#current_compiler">current_compiler</A>" variable to the
name of the compiler.
- Delete the "CompilerSet" user command.
- Set "b:current_compiler" to the value of "<A HREF="#current_compiler">current_compiler</A>".
- Without "<A HREF="change.html#!">!</A>" the old value of "<A HREF="#current_compiler">current_compiler</A>" is restored.
For <A HREF="editing.html#writing">writing</A> a compiler plugin, see |<A HREF="usr_41.html#write-compiler-plugin">write-compiler-plugin</A>|.
GCC *<A NAME="quickfix-gcc"></A><B>quickfix-gcc</B>* *<A NAME="compiler-gcc"></A><B>compiler-gcc</B>*
There's one variable you can set for the GCC compiler:
g:compiler_gcc_ignore_unmatched_lines
Ignore lines that don't match any patterns
defined for GCC. Useful if output from
commands run from make are generating false
positives.
MANX AZTEC C *<A NAME="quickfix-manx"></A><B>quickfix-manx</B>* *<A NAME="compiler-manx"></A><B>compiler-manx</B>*
To use Vim with Manx's Aztec C compiler on the <A HREF="os_amiga.html#Amiga">Amiga</A> you should <A HREF="diff.html#do">do</A> the
following:
- Set the CCEDIT environment variable with the command:
<B> mset "CCEDIT=vim -q"</B>
- Compile with the <A HREF="starting.html#-qf">-qf</A> option. If the compiler finds any <A HREF="message.html#errors">errors</A>, Vim is
started and the cursor is positioned on the first error. The error message
will be displayed on the last line. You can go to other <A HREF="message.html#errors">errors</A> with the
commands mentioned above. You can fix the <A HREF="message.html#errors">errors</A> and write the file(s).
- If you exit Vim normally the compiler will re-compile the same file. If you
exit with the <A HREF="#:cq">:cq</A> command, the compiler will terminate. Do this if you
cannot fix the error, or if another file needs to be compiled first.
There are some restrictions to the <A HREF="#Quickfix">Quickfix</A> mode on the <A HREF="os_amiga.html#Amiga">Amiga</A>. The
compiler only writes the first 25 <A HREF="message.html#errors">errors</A> to the errorfile (Manx's
documentation does not say how to get more). If you want to find the others,
you will have to fix a few <A HREF="message.html#errors">errors</A> and exit the editor. After recompiling,
up to 25 remaining <A HREF="message.html#errors">errors</A> will be found.
If Vim was started from the compiler, the <A HREF="various.html#:sh">:sh</A> and some <A HREF="various.html#:!">:!</A> commands will not
work, because Vim is then running in the same process <A HREF="motion.html#as">as</A> the compiler and
stdin (standard input) will not be interactive.
PERL *<A NAME="quickfix-perl"></A><B>quickfix-perl</B>* *<A NAME="compiler-perl"></A><B>compiler-perl</B>*
The <A HREF="if_perl.html#Perl">Perl</A> compiler <A HREF="usr_05.html#plugin">plugin</A> doesn't actually compile, but invokes Perl's internal
<A HREF="syntax.html#syntax">syntax</A> checking feature and parses the output for possible <A HREF="message.html#errors">errors</A> so you can
correct them in quick-fix mode.
Warnings are forced regardless of "no warnings" or "$^W = 0" within the file
being checked. To disable this set g:perl_compiler_force_warnings to a zero
value. For example:
<B> let g:perl_compiler_force_warnings = 0</B>
PYUNIT COMPILER *<A NAME="compiler-pyunit"></A><B>compiler-pyunit</B>*
This is not actually a compiler, but a unit <A HREF="eval.html#testing">testing</A> framework for the
<A HREF="if_pyth.html#Python">Python</A> language. It is included into standard <A HREF="if_pyth.html#Python">Python</A> <A HREF="intro.html#distribution">distribution</A>
starting from version 2.0. For older versions, you can get <A HREF="motion.html#it">it</A> from
<A HREF="http://pyunit.sourceforge.net">http://pyunit.sourceforge.net</A>.
When you run your tests with the help of the framework, possible <A HREF="message.html#errors">errors</A>
are parsed by Vim and presented for you in quick-fix mode.
Unfortunately, there is no standard way to run the tests.
The alltests.py <A HREF="usr_41.html#script">script</A> seems to be used quite often, that's all.
Useful values for the <A HREF="options.html#'makeprg'">'makeprg'</A> <A HREF="options.html#options">options</A> therefore are:
setlocal makeprg=./alltests.py " Run a testsuite
setlocal makeprg=python\ <A HREF="cmdline.html#%:S">%:S</A> " Run a single testcase
Also see <A HREF="http://vim.sourceforge.net/tip_view.php?tip_id=280">http://vim.sourceforge.net/tip_view.php?tip_id=280</A>.
TEX COMPILER *<A NAME="compiler-tex"></A><B>compiler-tex</B>*
Included in the <A HREF="intro.html#distribution">distribution</A> compiler for TeX ($VIMRUNTIME/compiler/tex.vim)
uses make command if possible. If the compiler finds a file named "Makefile"
or "makefile" in the current directory, <A HREF="motion.html#it">it</A> supposes that you want to process
your *TeX files with make, and the makefile does the right work. In this <A HREF="change.html#case">case</A>
compiler sets <A HREF="options.html#'errorformat'">'errorformat'</A> for *TeX output and leaves <A HREF="options.html#'makeprg'">'makeprg'</A> untouched. If
neither "Makefile" nor "makefile" is found, the compiler will not use make.
You can force the compiler to ignore makefiles by defining
b:tex_ignore_makefile or g:tex_ignore_makefile variable (they are checked for
existence only).
If the compiler chose not to use make, <A HREF="motion.html#it">it</A> need to choose a right program for
processing your input. If b:tex_flavor or <A HREF="filetype.html#g:tex_flavor">g:tex_flavor</A> (in this precedence)
variable exists, <A HREF="motion.html#it">it</A> defines TeX flavor for <A HREF="#:make">:make</A> (actually, this is the name
of executed command), and if both <A HREF="eval.html#variables">variables</A> <A HREF="diff.html#do">do</A> not exist, <A HREF="motion.html#it">it</A> defaults to
"latex". For example, while editing chapter2.tex \input-ed from mypaper.tex
written in AMS-TeX:
<B> :let b:tex_flavor = 'amstex'</B>
<B> :compiler tex</B>
[editing...]
<B> :make mypaper</B>
Note that you must specify a name of the file to process <A HREF="motion.html#as">as</A> an argument (to
process the right file when editing \input-ed or \include-ed file; portable
solution for substituting <A HREF="motion.html#%">%</A> for no arguments is welcome). This is not in the
semantics of make, where you specify a target, not source, but you may specify
filename without extension ".tex" and mean this <A HREF="motion.html#as">as</A> "make filename.dvi or
filename.pdf or filename.some_result_extension according to compiler".
Note: tex command line <A HREF="syntax.html#syntax">syntax</A> is set to usable both for MikTeX (suggestion
by Srinath Avadhanula) and teTeX (checked by Artem Chuprina). Suggestion
from |<A HREF="#errorformat-LaTeX">errorformat-LaTeX</A>| is too complex to keep <A HREF="motion.html#it">it</A> working for different
shells and OSes and also does not allow to use other available TeX <A HREF="options.html#options">options</A>,
if any. If your TeX doesn't support "-interaction=nonstopmode", please
report <A HREF="motion.html#it">it</A> with different means to express \nonstopmode from the command line.
=============================================================================
7. The error format *<A NAME="error-file-format"></A><B>error-file-format</B>*
*<A NAME="errorformat"></A><B>errorformat</B>* *<A NAME="E372"></A><B>E372</B>* *<A NAME="E373"></A><B>E373</B>* *<A NAME="E374"></A><B>E374</B>*
*<A NAME="E375"></A><B>E375</B>* *<A NAME="E376"></A><B>E376</B>* *<A NAME="E377"></A><B>E377</B>* *<A NAME="E378"></A><B>E378</B>*
The <A HREF="options.html#'errorformat'">'errorformat'</A> option specifies a <A HREF="eval.html#list">list</A> of formats that are recognized. The
first format that matches with an error message is used. You can add several
formats for different <A HREF="message.html#messages">messages</A> your compiler produces, or even entries for
multiple compilers. See |<A HREF="#efm-entries">efm-entries</A>|.
Each entry in <A HREF="options.html#'errorformat'">'errorformat'</A> is a scanf-like <A HREF="eval.html#string">string</A> that describes the format.
First, you need to know how scanf works. Look in the documentation of your
C compiler. Below you find the <A HREF="motion.html#%">%</A> items that Vim understands. Others are
invalid.
<A HREF="eval.html#Special">Special</A> characters in <A HREF="options.html#'errorformat'">'errorformat'</A> are comma and <A HREF="intro.html#backslash">backslash</A>. See
|<A HREF="#efm-entries">efm-entries</A>| for how to deal with them. Note that a literal "<A HREF="motion.html#%">%</A>" is matched
by "%%", thus <A HREF="motion.html#it">it</A> is not escaped with a <A HREF="intro.html#backslash">backslash</A>.
Keep in mind that in the `:make` and `:grep` output all NUL characters are
replaced with SOH (0x01).
Note: By default the difference between upper and <A HREF="change.html#lowercase">lowercase</A> is ignored. If
you want to match <A HREF="change.html#case">case</A>, add "\C" to the <A HREF="pattern.html#pattern">pattern</A> |<A HREF="pattern.html#/\C">/\C</A>|.
Basic items
%f file name (finds a <A HREF="eval.html#string">string</A>)
%l line number (finds a number)
%c column number (finds a number representing character
column of the error, (1 <tab> <A HREF="change.html#==">==</A> 1 character column))
%v virtual column number (finds a number representing
screen column of the error (1 <tab> <A HREF="change.html#==">==</A> 8 screen
columns))
%t error type (finds a single character)
%n error number (finds a number)
%m error message (finds a <A HREF="eval.html#string">string</A>)
%r matches the "rest" of a single-line file message %O/P/Q
%p pointer line (finds a sequence of '<A HREF="motion.html#-">-</A>', '<A HREF="repeat.html#.">.</A>', '' '' or
tabs and uses the length for the column number)
%*{conv} any scanf non-assignable conversion
%% the single '<A HREF="motion.html#%">%</A>' character
%s search text (finds a <A HREF="eval.html#string">string</A>)
The "%f" conversion may depend on the current <A HREF="options.html#'isfname'">'isfname'</A> setting. "~/" is
expanded to the home directory and environment <A HREF="eval.html#variables">variables</A> are expanded.
The "%f" and "%m" conversions have to detect the end of the <A HREF="eval.html#string">string</A>. This
normally happens by matching following characters and items. When nothing is
following the rest of the line is matched. If "%f" is followed by a '<A HREF="motion.html#%">%</A>' or a
<A HREF="intro.html#backslash">backslash</A>, <A HREF="motion.html#it">it</A> will look for a sequence of <A HREF="options.html#'isfname'">'isfname'</A> characters.
On <A HREF="os_msdos.html#MS-DOS">MS-DOS</A>, <A HREF="os_win32.html#MS-Windows">MS-Windows</A> and <A HREF="os_os2.html#OS/2">OS/2</A> a leading "C:" will be included in "%f", even
when using "%f:". This means that a file name which is a single alphabetical
<A HREF="print.html#letter">letter</A> will not be detected.
The "%p" conversion is normally followed by a "<A HREF="motion.html#^">^</A>". It's used for compilers
that output a line like:
<B> ^</B>
or
<B> ---------^</B>
to indicate the column of the error. This is to be used in a multi-line error
message. See |<A HREF="#errorformat-javac">errorformat-javac</A>| for a useful example.
The "%s" conversion specifies the text to search for to locate the error line.
The text is used <A HREF="motion.html#as">as</A> a literal <A HREF="eval.html#string">string</A>. The anchors "<A HREF="motion.html#^">^</A>" and "<A HREF="motion.html#$">$</A>" are added to
the text to locate the error line exactly matching the search text and the
text is prefixed with the "\V" atom to make <A HREF="motion.html#it">it</A> "very nomagic". The "%s"
conversion can be used to locate lines without a line number in the error
output. Like the output of the "<A HREF="#grep">grep</A>" shell command.
When the <A HREF="pattern.html#pattern">pattern</A> is present the line number will not be used.
Changing directory
The following <A HREF="change.html#uppercase">uppercase</A> conversion characters specify the type of special
format strings. At most one of them may be given <A HREF="motion.html#as">as</A> a prefix at the begin
of a single comma-separated format <A HREF="pattern.html#pattern">pattern</A>.
Some compilers produce <A HREF="message.html#messages">messages</A> that consist of directory names that have to
be prepended to each file name read by %f (example: GNU make). The following
codes can be used to scan these directory names; they will be stored in an
internal directory stack. *<A NAME="E379"></A><B>E379</B>*
%D "enter directory" format <A HREF="eval.html#string">string</A>; expects a following
%f that finds the directory name
%X "leave directory" format <A HREF="eval.html#string">string</A>; expects following %f
When defining an "enter directory" or "leave directory" format, the "%D" or
"%X" has to be given at the start of that substring. Vim tracks the directory
changes and prepends the current directory to each erroneous file found with a
relative path. See |<A HREF="#quickfix-directory-stack">quickfix-directory-stack</A>| for details, <A HREF="tips.html#tips">tips</A> and
limitations.
Multi-line <A HREF="message.html#messages">messages</A> *<A NAME="errorformat-multi-line"></A><B>errorformat-multi-line</B>*
It is possible to read the output of programs that produce multi-line
<A HREF="message.html#messages">messages</A>, i.e. error strings that consume more than one line. Possible
prefixes are:
%E start of a multi-line error message
%W start of a multi-line warning message
%I start of a multi-line informational message
%A start of a multi-line message (unspecified type)
%> for next line start with current <A HREF="pattern.html#pattern">pattern</A> again |<A HREF="#efm-%>">efm-%></A>|
%C continuation of a multi-line message
%Z end of a multi-line message
These can be used with '<A HREF="motion.html#+">+</A>' and '-', see |<A HREF="#efm-ignore">efm-ignore</A>| below.
Using "\n" in the <A HREF="pattern.html#pattern">pattern</A> won't work to match multi-line <A HREF="message.html#messages">messages</A>.
Example: Your compiler happens to write out <A HREF="message.html#errors">errors</A> in the following format
(leading line numbers not being part of the actual output):
<B><FONT COLOR="PURPLE"> 1 Error 275 </FONT></B>
<B><FONT COLOR="PURPLE"> 2 line 42 </FONT></B>
<B><FONT COLOR="PURPLE"> 3 column 3 </FONT></B>
<B><FONT COLOR="PURPLE"> 4 ' ' expected after '--' </FONT></B>
The appropriate error format <A HREF="eval.html#string">string</A> has to look like this:
<B> :set efm=%EError\ %n,%Cline\ %l,%Ccolumn\ %c,%Z%m</B>
And the |<A HREF="#:clist">:clist</A>| error message generated for this error is:
1:42 col 3 error 275: '' '' expected after '<A HREF="starting.html#--">--</A>'
Another example: Think of a <A HREF="if_pyth.html#Python">Python</A> interpreter that produces the following
error message (line numbers are not part of the actual output):
1 ==============================================================
2 FAIL: testGetTypeIdCachesResult (dbfacadeTest.DjsDBFacadeTest)
3 --------------------------------------------------------------
4 Traceback (most recent call last):
5 File "unittests/dbfacadeTest.py", line 89, in testFoo
6 self.assertEquals(34, dtid)
7 File "/usr/lib/python2.2/unittest.py", line 286, in
8 failUnlessEqual
9 raise self.failureException, \
10 AssertionError: 34 != 33
11
12 --------------------------------------------------------------
13 Ran 27 tests in 0.063s
Say you want |<A HREF="#:clist">:clist</A>| write the relevant information of this message only,
namely:
5 unittests/dbfacadeTest.py:89: AssertionError: 34 != 33
Then the error format <A HREF="eval.html#string">string</A> could be defined <A HREF="motion.html#as">as</A> follows:
<B> :set efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m</B>
Note that the %C <A HREF="eval.html#string">string</A> is given before the %A here: since the <A HREF="eval.html#expression">expression</A>
'' %.%#' (which stands for the regular <A HREF="eval.html#expression">expression</A> '' .*') matches every line
starting with a space, followed by any characters to the end of the line,
<A HREF="motion.html#it">it</A> also hides line 7 which would trigger a separate error message otherwise.
Error format strings are always parsed <A HREF="pattern.html#pattern">pattern</A> by <A HREF="pattern.html#pattern">pattern</A> until the first
match occurs.
*<A NAME="efm-%>"></A><B>efm-%></B>*
The %> item can be used to avoid trying patterns that appear earlier in
<A HREF="options.html#'errorformat'">'errorformat'</A>. This is useful for patterns that match just about anything.
For example, if the error looks like this:
<B><FONT COLOR="PURPLE"> Error in line 123 of foo.c: </FONT></B>
<B><FONT COLOR="PURPLE"> unknown variable "i" </FONT></B>
This can be found with:
<B> :set efm=xxx,%E%>Error in line %l of %f:,%Z%m</B>
Where "xxx" has a <A HREF="pattern.html#pattern">pattern</A> that would also match the second line.
Important: There is no memory of what part of the <A HREF="#errorformat">errorformat</A> matched before;
every line in the error file gets a complete new run through the error format
lines. For example, if one has:
<B> setlocal efm=aa,bb,cc,dd,ee</B>
Where aa, bb, etc. are error format strings. Each line of the error file will
be matched to the <A HREF="pattern.html#pattern">pattern</A> aa, then bb, then <A HREF="change.html#cc">cc</A>, etc. Just because <A HREF="change.html#cc">cc</A> matched
the previous error line does _not_ mean that <A HREF="change.html#dd">dd</A> will be tried first on the
current line, even if <A HREF="change.html#cc">cc</A> and <A HREF="change.html#dd">dd</A> are multi-line <A HREF="#errorformat">errorformat</A> strings.
Separate file name *<A NAME="errorformat-separate-filename"></A><B>errorformat-separate-filename</B>*
These prefixes are useful if the file name is given once and multiple <A HREF="message.html#messages">messages</A>
follow that refer to this file name.
%O single-line file message: overread the matched part
%P single-line file message: push file %f onto the stack
%Q single-line file message: pop the last file from stack
Example: Given a compiler that produces the following error logfile (without
leading line numbers):
1 [a1.tt]
2 (1,17) error: '<A HREF="motion.html#;">;</A>' missing
3 (21,2) warning: variable '<A HREF="index.html#z">z</A>' not defined
4 (67,3) error: end of file found before <A HREF="eval.html#string">string</A> ended
5
6 [a2.tt]
7
8 [a3.tt]
9 NEW compiler v1.1
10 (2,2) warning: variable '<A HREF="change.html#x">x</A>' not defined
11 (67,3) warning: '<A HREF="change.html#s">s</A>' already defined
This logfile lists several <A HREF="message.html#messages">messages</A> for each file enclosed in [...] which are
properly parsed by an error format like this:
<B> :set efm=%+P[%f],(%l\\,%c)%*[\ ]%t%*[^:]:\ %m,%-Q</B>
A call of |<A HREF="#:clist">:clist</A>| writes them accordingly with their correct filenames:
2 a1.tt:1 col 17 error: '<A HREF="motion.html#;">;</A>' missing
3 a1.tt:21 col 2 warning: variable '<A HREF="index.html#z">z</A>' not defined
4 a1.tt:67 col 3 error: end of file found before <A HREF="eval.html#string">string</A> ended
8 a3.tt:2 col 2 warning: variable '<A HREF="change.html#x">x</A>' not defined
9 a3.tt:67 col 3 warning: '<A HREF="change.html#s">s</A>' already defined
Unlike the other prefixes that all match against whole lines, %P, %Q and %O
can be used to match several patterns in the same line. Thus <A HREF="motion.html#it">it</A> is possible
to parse even nested files like in the following line:
{"file1" {"file2" error1} error2 {"file3" error3 {"file4" error4 error5}}}
The %O then parses over strings that <A HREF="diff.html#do">do</A> not contain any push/pop file name
information. See |<A HREF="#errorformat-LaTeX">errorformat-LaTeX</A>| for an extended example.
Ignoring and using whole <A HREF="message.html#messages">messages</A> *<A NAME="efm-ignore"></A><B>efm-ignore</B>*
The codes '<A HREF="motion.html#+">+</A>' or '<A HREF="motion.html#-">-</A>' can be combined with the <A HREF="change.html#uppercase">uppercase</A> codes above; in that
<A HREF="change.html#case">case</A> they have to precede the <A HREF="print.html#letter">letter</A>, e.g. '%+A' or '%-G':
%- <A HREF="diff.html#do">do</A> not include the matching multi-line in any output
%+ include the whole matching line in the %m error <A HREF="eval.html#string">string</A>
One prefix is only useful in combination with '<A HREF="motion.html#+">+</A>' or '<A HREF="motion.html#-">-</A>', namely %G. It parses
over lines containing general information like compiler version strings or
other headers that can be skipped.
%-G ignore this message
%+G general message
<A HREF="pattern.html#Pattern">Pattern</A> matching
The scanf()-like "%*[]" <A HREF="intro.html#notation">notation</A> is supported for backward-compatibility
with previous versions of Vim. However, <A HREF="motion.html#it">it</A> is also possible to specify
(nearly) any Vim supported regular <A HREF="eval.html#expression">expression</A> in format strings.
Since <A HREF="intro.html#meta">meta</A> characters of the regular <A HREF="eval.html#expression">expression</A> language can be part of
ordinary matching strings or file names (and therefore internally have to
be escaped), <A HREF="intro.html#meta">meta</A> symbols have to be written with leading '<A HREF="motion.html#%">%</A>':
%\ The single '\' character. Note that this has to be
escaped ("%\\") in "<A HREF="options.html#:set">:set</A> <A HREF="options.html#'errorformat'">errorformat</A>=" <A HREF="intro.html#definitions">definitions</A>.
<A HREF="motion.html#%">%</A>. The single '<A HREF="repeat.html#.">.</A>' character.
%# The single '*'(!) character.
%^ The single '<A HREF="motion.html#^">^</A>' character. Note that this is not
useful, the <A HREF="pattern.html#pattern">pattern</A> already matches start of line.
%$ The single '<A HREF="motion.html#$">$</A>' character. Note that this is not
useful, the <A HREF="pattern.html#pattern">pattern</A> already matches end of line.
%[ The single '<A HREF="index.html#[">[</A>' character for a <A HREF="motion.html#[]">[]</A> character range.
%~ The single '<A HREF="change.html#~">~</A>' character.
When using character classes in expressions (see |<A HREF="pattern.html#/\i">/\i</A>| for an overview),
terms containing the "\+" quantifier can be written in the scanf() "%*"
<A HREF="intro.html#notation">notation</A>. Example: "%\\d%\\+" ("\d\+", "any number") is equivalent to "%*\\d".
Important note: The \(...\) grouping of sub-matches can not be used in format
specifications because <A HREF="motion.html#it">it</A> is reserved for internal conversions.
Multiple entries in <A HREF="options.html#'errorformat'">'errorformat'</A> *<A NAME="efm-entries"></A><B>efm-entries</B>*
To be able to detect output from several compilers, several format patterns
may be put in <A HREF="options.html#'errorformat'">'errorformat'</A>, separated by commas (note: blanks after the comma
are ignored). The first <A HREF="pattern.html#pattern">pattern</A> that has a complete match is used. If no
match is found, matching parts from the last one will be used, although the
file name is removed and the error message is set to the whole message. If
there is a <A HREF="pattern.html#pattern">pattern</A> that may match output from several compilers (but not in a
right way), put <A HREF="motion.html#it">it</A> after one that is more restrictive.
To include a comma in a <A HREF="pattern.html#pattern">pattern</A> precede <A HREF="motion.html#it">it</A> with a <A HREF="intro.html#backslash">backslash</A> (you have to type
two in a "<A HREF="options.html#:set">:set</A>" command). To include a <A HREF="intro.html#backslash">backslash</A> itself give two backslashes
(you have to type four in a "<A HREF="options.html#:set">:set</A>" command). You also need to put a <A HREF="intro.html#backslash">backslash</A>
before a space for "<A HREF="options.html#:set">:set</A>".
Valid matches *<A NAME="quickfix-valid"></A><B>quickfix-valid</B>*
If a line does not completely match one of the entries in <A HREF="options.html#'errorformat'">'errorformat'</A>, the
whole line is put in the error message and the entry is marked "not valid"
These lines are skipped with the "<A HREF="#:cn">:cn</A>" and "<A HREF="#:cp">:cp</A>" commands (unless there is
no valid line at all). You can use ":cl!" to display all the error <A HREF="message.html#messages">messages</A>.
If the error format does not contain a file name Vim cannot switch to the
correct file. You will have to <A HREF="diff.html#do">do</A> this by hand.
Examples
The format of the file from the <A HREF="os_amiga.html#Amiga">Amiga</A> Aztec compiler is:
filename>linenumber:columnnumber:errortype:errornumber:errormessage
filename name of the file in which the error was detected
linenumber line number where the error was detected
columnnumber column number where the error was detected
errortype type of the error, normally a single '<A HREF="motion.html#E">E</A>' or '<A HREF="motion.html#W">W</A>'
errornumber number of the error (for lookup in the manual)
errormessage description of the error
This can be matched with this <A HREF="options.html#'errorformat'">'errorformat'</A> entry:
%f>%l:%c:%t:%n:%m
Some examples for C compilers that produce single-line error outputs:
%f:%l:\ %t%*[^0123456789]%n:\ %m for Manx/Aztec C error <A HREF="message.html#messages">messages</A>
(scanf() doesn't understand [0-9])
%f\ %l\ %t%*[^0-9]%n:\ %m for SAS C
\"%f\"\\,%*[^0-9]%l:\ %m for generic C compilers
%f:%l:\ %m for GCC
%f:%l:\ %m,%Dgmake[%*\\d]:\ Entering\ directory\ `%f',
%Dgmake[%*\\d]:\ Leaving\ directory\ `%f'
for GCC with gmake (concat the lines!)
%f(%l)\ :\ %*[^:]:\ %m old SCO C compiler (pre-OS5)
%f(%l)\ :\ %t%*[^0-9]%n:\ %m idem, with error type and number
%f:%l:\ %m,In\ file\ included\ from\ %f:%l:,\^I\^Ifrom\ %f:%l%m
for GCC, with some extras
Extended examples for the handling of multi-line <A HREF="message.html#messages">messages</A> are given below,
see |<A HREF="#errorformat-Jikes">errorformat-Jikes</A>| and |<A HREF="#errorformat-LaTeX">errorformat-LaTeX</A>|.
Note the <A HREF="intro.html#backslash">backslash</A> in front of a space and double <A HREF="change.html#quote.">quote.</A> It is required for
the <A HREF="options.html#:set">:set</A> command. There are two backslashes in front of a comma, one for the
<A HREF="options.html#:set">:set</A> command and one to avoid recognizing the comma <A HREF="motion.html#as">as</A> a separator of error
formats.
Filtering <A HREF="message.html#messages">messages</A>
If you have a compiler that produces error <A HREF="message.html#messages">messages</A> that <A HREF="diff.html#do">do</A> not fit in the
format <A HREF="eval.html#string">string</A>, you could write a program that translates the error <A HREF="message.html#messages">messages</A>
into this format. You can use this program with the "<A HREF="#:make">:make</A>" command by
<A HREF="change.html#changing">changing</A> the <A HREF="options.html#'makeprg'">'makeprg'</A> option. For example:
<B> :set mp=make\ \\\|&\ error_filter</B>
The backslashes before the pipe character are required to avoid <A HREF="motion.html#it">it</A> to be
recognized <A HREF="motion.html#as">as</A> a command separator. The <A HREF="intro.html#backslash">backslash</A> before each space is
required for the set command.
=============================================================================
8. The directory stack *<A NAME="quickfix-directory-stack"></A><B>quickfix-directory-stack</B>*
<A HREF="#Quickfix">Quickfix</A> maintains a stack for saving all used directories parsed from the
make output. For GNU-make this is rather simple, <A HREF="motion.html#as">as</A> <A HREF="motion.html#it">it</A> always prints the
absolute path of all directories <A HREF="motion.html#it">it</A> enters and leaves. Regardless if this is
done via a <A HREF="options.html#'cd'">'cd'</A> command in the makefile or with the parameter "<A HREF="starting.html#-C">-C</A> dir" (change
to directory before reading the makefile). It may be useful to use the switch
"<A HREF="starting.html#-w">-w</A>" to force GNU-make to print out the working directory before and after
processing.
Maintaining the correct directory is more complicated if you don't use
GNU-make. AIX-make for example doesn't print any information about its
working directory. Then you need to enhance the makefile. In the makefile of
LessTif there is a command which echoes "Making {target} in {dir}". The
special problem here is that <A HREF="motion.html#it">it</A> doesn't print information on leaving the
directory and that <A HREF="motion.html#it">it</A> doesn't print the absolute path.
To solve the problem with relative paths and missing "leave directory"
<A HREF="message.html#messages">messages</A> Vim uses following algorithm:
1) Check if the given directory is a subdirectory of the current directory.
If this is true, store <A HREF="motion.html#it">it</A> <A HREF="motion.html#as">as</A> the current directory.
2) If <A HREF="motion.html#it">it</A> is not a subdir of the current directory, try if this is a
subdirectory of one of the upper directories.
3) If the directory still isn't found, <A HREF="motion.html#it">it</A> is assumed to be a subdirectory
of Vim's current directory.
Additionally <A HREF="motion.html#it">it</A> is checked for every file, if <A HREF="motion.html#it">it</A> really exists in the
identified directory. If not, <A HREF="motion.html#it">it</A> is searched in all other directories of the
directory stack (NOT the directory subtree!). If <A HREF="motion.html#it">it</A> is still not found, <A HREF="motion.html#it">it</A> is
assumed that <A HREF="motion.html#it">it</A> is in Vim's current directory.
There are limitations in this algorithm. These examples assume that make just
prints information about entering a directory in the form "Making all in dir".
1) Assume you have following directories and files:
./dir1
./dir1/file1.c
./file1.c
If make processes the directory "./dir1" before the current directory and
there is an error in the file "./file1.c", you will end up with the file
"./dir1/file.c" loaded by Vim.
This can only be solved with a "leave directory" message.
2) Assume you have following directories and files:
./dir1
./dir1/dir2
./dir2
You get the following:
Make output Directory interpreted by Vim
------------------------ ----------------------------
Making all in dir1 ./dir1
Making all in dir2 ./dir1/dir2
Making all in dir2 ./dir1/dir2
This can be solved by <A HREF="print.html#printing">printing</A> absolute directories in the "enter directory"
message or by <A HREF="print.html#printing">printing</A> "leave directory" <A HREF="message.html#messages">messages</A>.
To avoid this problem, ensure to print absolute directory names and "leave
directory" <A HREF="message.html#messages">messages</A>.
Examples for Makefiles:
<A HREF="os_unix.html#Unix">Unix</A>:
libs:
for dn in $(LIBDIRS); <A HREF="diff.html#do">do</A> \
(cd $$dn; echo "Entering dir '$$(pwd)'"'; make); \
echo "Leaving dir"; \
done
Add
%DEntering\ dir\ '%f',%XLeaving\ dir
to your <A HREF="options.html#'errorformat'">'errorformat'</A> to handle the above output.
Note that Vim doesn't check if the directory name in a "leave directory"
<A HREF="message.html#messages">messages</A> is the current directory. This is why you could just use the message
"Leaving dir".
=============================================================================
9. Specific error file formats *<A NAME="errorformats"></A><B>errorformats</B>*
*<A NAME="errorformat-Jikes"></A><B>errorformat-Jikes</B>*
Jikes(TM), a source-to-bytecode Java compiler published by IBM Research,
produces simple multi-line error <A HREF="message.html#messages">messages</A>.
An <A HREF="options.html#'errorformat'">'errorformat'</A> <A HREF="eval.html#string">string</A> matching the produced <A HREF="message.html#messages">messages</A> is shown below.
The following lines can be placed in the user's |<A HREF="starting.html#vimrc">vimrc</A>| to overwrite Vim's
recognized default formats, or see |<A HREF="options.html#:set+=">:set+=</A>| how to <A HREF="usr_90.html#install">install</A> this format
additionally to the default.
<B> :set efm=%A%f:%l:%c:%*\\d:%*\\d:,</B>
<B> \%C%*\\s%trror:%m,</B>
<B> \%+C%*[^:]%trror:%m,</B>
<B> \%C%*\\s%tarning:%m,</B>
<B> \%C%m</B>
Jikes(TM) produces a single-line error message when invoked with the option
"+E", and can be matched with the following:
<B> :setl efm=%f:%l:%v:%*\\d:%*\\d:%*\\s%m</B>
*<A NAME="errorformat-javac"></A><B>errorformat-javac</B>*
This <A HREF="options.html#'errorformat'">'errorformat'</A> has been reported to work well for javac, which outputs a
line with "<A HREF="motion.html#^">^</A>" to indicate the column of the error:
<B> :setl efm=%A%f:%l:\ %m,%-Z%p^,%-C%.%#</B>
or:
<B> :setl efm=%A%f:%l:\ %m,%+Z%p^,%+C%.%#,%-G%.%#</B>
Here is an alternative from Michael <A HREF="motion.html#F">F</A>. Lamb for <A HREF="os_unix.html#Unix">Unix</A> that filters the <A HREF="message.html#errors">errors</A>
first:
<B> :setl errorformat=%Z%f:%l:\ %m,%A%p^,%-G%*[^sl]%.%#</B>
<B> :setl makeprg=javac\ %:S\ 2>&1\ \\\|\ vim-javac-filter</B>
You need to put the following in "vim-javac-filter" somewhere in your path
(e.g., in ~/bin) and make <A HREF="motion.html#it">it</A> executable:
<B> #!/bin/sed -f</B>
<B> /\^$/s/\t/\ /g;/:[0-9]\+:/{h;d};/^[ \t]*\^/G;</B>
In English, that sed <A HREF="usr_41.html#script">script</A>:
- Changes single tabs to single spaces and
- Moves the line with the filename, line number, error message to just after
the pointer line. That way, the unused error text between doesn't break
vim's notion of a "multi-line message" and also doesn't force us to include
<A HREF="motion.html#it">it</A> <A HREF="motion.html#as">as</A> a "continuation of a multi-line message."
*<A NAME="errorformat-ant"></A><B>errorformat-ant</B>*
For ant <A HREF="http://jakarta.apache.org/">http://jakarta.apache.org/</A> the above errorformat has to be modified
to honour the leading [javac] in front of each javac output line:
<B> :set efm=%A\ %#[javac]\ %f:%l:\ %m,%-Z\ %#[javac]\ %p^,%-C%.%#</B>
The <A HREF="options.html#'errorformat'">'errorformat'</A> can also be configured to handle ant together with either
javac or jikes. If you're using jikes, you should tell ant to use jikes' +E
command line switch which forces jikes to generate one-line error <A HREF="message.html#messages">messages</A>.
This is what the second line (of a build.xml file) below does:
<B> <property name = "build.compiler" value = "jikes"/></B>
<B> <property name = "build.compiler.emacs" value = "true"/></B>
The <A HREF="options.html#'errorformat'">'errorformat'</A> which handles ant with both javac and jikes is:
<B> :set efm=\ %#[javac]\ %#%f:%l:%c:%*\\d:%*\\d:\ %t%[%^:]%#:%m,</B>
<B> \%A\ %#[javac]\ %f:%l:\ %m,%-Z\ %#[javac]\ %p^,%-C%.%#</B>
*<A NAME="errorformat-jade"></A><B>errorformat-jade</B>*
parsing jade see <A HREF="http://www.jclark.com/">http://www.jclark.com/</A> errors is simple:
<B> :set efm=jade:%f:%l:%c:%t:%m</B>
*<A NAME="errorformat-LaTeX"></A><B>errorformat-LaTeX</B>*
The following is an example how an <A HREF="options.html#'errorformat'">'errorformat'</A> <A HREF="eval.html#string">string</A> can be specified
for the (La)TeX typesetting system which displays error <A HREF="message.html#messages">messages</A> over
multiple lines. The output of "<A HREF="#:clist">:clist</A>" and "<A HREF="#:cc">:cc</A>" etc. commands displays
multi-lines in a single line, leading white space is removed.
It should be <A HREF="starting.html#easy">easy</A> to adopt the above LaTeX <A HREF="#errorformat">errorformat</A> to any compiler output
consisting of multi-line <A HREF="message.html#errors">errors</A>.
The commands can be placed in a |<A HREF="starting.html#vimrc">vimrc</A>| file or some other Vim <A HREF="usr_41.html#script">script</A> file,
e.g. a <A HREF="usr_41.html#script">script</A> containing LaTeX related stuff which is loaded only when editing
LaTeX sources.
Make sure to copy all lines of the example (in the given order), afterwards
remove the comment lines. For the '\' <A HREF="intro.html#notation">notation</A> at the start of some lines see
|<A HREF="repeat.html#line-continuation">line-continuation</A>|.
First prepare <A HREF="options.html#'makeprg'">'makeprg'</A> such that LaTeX will report multiple
<A HREF="message.html#errors">errors</A>; <A HREF="diff.html#do">do</A> not stop when the first error has occurred:
<B> :set makeprg=latex\ \\\\nonstopmode\ \\\\input\\{$*}</B>
Start of multi-line error <A HREF="message.html#messages">messages</A>:
<B> :set efm=%E!\ LaTeX\ %trror:\ %m,</B>
<B> \%E!\ %m,</B>
Start of multi-line warning <A HREF="message.html#messages">messages</A>; the first two also
include the line number. Meaning of some regular expressions:
- "%.%#" (".*") matches a (possibly empty) <A HREF="eval.html#string">string</A>
- "%*\\d" ("\d\+") matches a number
<B> \%+WLaTeX\ %.%#Warning:\ %.%#line\ %l%.%#,</B>
<B> \%+W%.%#\ at\ lines\ %l--%*\\d,</B>
<B> \%WLaTeX\ %.%#Warning:\ %m,</B>
Possible continuations of error/warning <A HREF="message.html#messages">messages</A>; the first
one also includes the line number:
<B> \%Cl.%l\ %m,</B>
<B> \%+C\ \ %m.,</B>
<B> \%+C%.%#-%.%#,</B>
<B> \%+C%.%#[]%.%#,</B>
<B> \%+C[]%.%#,</B>
<B> \%+C%.%#%[{}\\]%.%#,</B>
<B> \%+C<%.%#>%.%#,</B>
<B> \%C\ \ %m,</B>
Lines that match the following patterns <A HREF="diff.html#do">do</A> not contain any
important information; <A HREF="diff.html#do">do</A> not include them in <A HREF="message.html#messages">messages</A>:
<B> \%-GSee\ the\ LaTeX%m,</B>
<B> \%-GType\ \ H\ <return>%m,</B>
<B> \%-G\ ...%.%#,</B>
<B> \%-G%.%#\ (C)\ %.%#,</B>
<B> \%-G(see\ the\ transcript%.%#),</B>
Generally exclude any empty or whitespace-only line from
being displayed:
<B> \%-G\\s%#,</B>
The LaTeX output log does not specify the names of erroneous
source files per line; rather they are given globally,
enclosed in parentheses.
The following patterns try to match these names and store
them in an internal stack. The patterns possibly scan over
the same input line (one after another), the trailing "%r"
conversion indicates the "rest" of the line that will be
parsed in the next go until the end of line is reached.
Overread a file name enclosed in '('...')'; <A HREF="diff.html#do">do</A> not push <A HREF="motion.html#it">it</A>
on a stack since the file apparently does not contain any
error:
<B> \%+O(%f)%r,</B>
Push a file name onto the stack. The name is given after '<A HREF="motion.html#(">(</A>':
<B> \%+P(%f%r,</B>
<B> \%+P\ %\\=(%f%r,</B>
<B> \%+P%*[^()](%f%r,</B>
<B> \%+P[%\\d%[^()]%#(%f%r,</B>
Pop the last stored file name when a '<A HREF="motion.html#)">)</A>' is scanned:
<B> \%+Q)%r,</B>
<B> \%+Q%*[^()])%r,</B>
<B> \%+Q[%\\d%*[^()])%r</B>
Note that in some cases file names in the LaTeX output log cannot be parsed
properly. The parser might have been messed up by unbalanced parentheses
then. The above example tries to catch the most relevant cases only.
You can customize the given setting to suit your own purposes, for example,
all the annoying "Overfull ..." warnings could be excluded from being
recognized <A HREF="motion.html#as">as</A> an error.
Alternatively to filtering the LaTeX compiler output, <A HREF="motion.html#it">it</A> is also possible
to directly read the *.log file that is produced by the [La]TeX compiler.
This contains even more useful information about possible error causes.
However, to properly parse such a complex file, an external <A HREF="change.html#filter">filter</A> should
be used. See the description further above how to make such a <A HREF="change.html#filter">filter</A> known
by Vim.
*<A NAME="errorformat-Perl"></A><B>errorformat-Perl</B>*
In $VIMRUNTIME/tools you can find the efm_perl.pl <A HREF="usr_41.html#script">script</A>, which filters <A HREF="if_perl.html#Perl">Perl</A>
error <A HREF="message.html#messages">messages</A> into a format that <A HREF="#quickfix">quickfix</A> mode will understand. See the
start of the file about how to use <A HREF="motion.html#it">it</A>. (This <A HREF="usr_41.html#script">script</A> is deprecated, see
|<A HREF="#compiler-perl">compiler-perl</A>|.)
<A HREF="#top">top</A> - <A HREF="index.html">main help file</A>
</PRE>
</BODY>
</HTML>
|