This file is indexed.

/usr/share/doc/zsh-common/html/Completion-System.html is in zsh-doc 5.3.1-4.

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
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.3, http://www.gnu.org/software/texinfo/ -->
<head>
<title>zsh: 20 Completion System</title>

<meta name="description" content="zsh: 20 Completion System">
<meta name="keywords" content="zsh: 20 Completion System">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2any">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>


</head>

<body lang="en">
<a name="Completion-System"></a>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="Completion-Widgets.html#Completion-Widgets" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="Completion-Widgets.html#Completion-Widget-Example" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="index.html#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Description-3" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left">[<a href="Completion-Using-compctl.html#Completion-Using-compctl" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="index.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="zsh_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="Concept-Index.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="zsh_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>

<a name="Completion-System-1"></a>
<h1 class="chapter">20 Completion System</h1>
<p><a name="index-completion-system"></a>
<a name="index-completion_002c-programmable-1"></a>
<a name="index-completion_002c-controlling-1"></a>
</p>
<hr>
<a name="Description-3"></a>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Completion-System" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Completion-System" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Completion-System" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Initialization" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left">[<a href="Completion-Using-compctl.html#Completion-Using-compctl" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="index.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="zsh_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="Concept-Index.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="zsh_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section">20.1 Description</h2>

<p>This describes the shell code for the &lsquo;new&rsquo; completion system, referred
to as <tt>compsys</tt>.  It is written in shell functions based on the
features described in
the previous chapter, <a href="Completion-Widgets.html#Completion-Widgets">Completion Widgets</a>.
</p>
<p>The features are contextual, sensitive to the point at which completion is
started.  Many completions are already provided.
For this reason, a user can perform a great many tasks without
knowing any details beyond how to initialize the system, which is
described
in <a href="#Initialization">Initialization</a>.
</p>
<p>The context that decides what completion is to be performed may be
</p><ul>
<li> an argument or option position: these describe the position on the
command line at which completion is requested.  For example &lsquo;first argument
to rmdir, the word being completed names a directory&rsquo;;

</li><li> a special context, denoting an element in the shell&rsquo;s syntax.  For example
&lsquo;a word in command position&rsquo; or &lsquo;an array subscript&rsquo;.

</li></ul>

<p>A full context specification contains other elements, as we shall describe.
</p>
<p>Besides commands names and contexts, the system employs two more
concepts, <em>styles</em> and <em>tags</em>.  These provide ways for the user
to configure the system&rsquo;s behaviour.
</p>
<p>Tags play a dual role.  They serve as a classification system for
the matches, typically indicating a class of object that the user
may need to distinguish.  For example, when completing arguments of the
<tt>ls</tt> command the user may prefer to try <tt>files</tt> before <tt>directories</tt>,
so both of these are tags.  They also appear as the rightmost
element in a context specification.
</p>
<p>Styles modify various operations of the completion system, such as
output formatting, but also what kinds of completers are used (and in
what order), or which tags are examined.  Styles may accept arguments
and are manipulated using the <tt>zstyle</tt> command described in
<a href="Zsh-Modules.html#The-zsh_002fzutil-Module">The zsh/zutil Module</a>.
</p>
<p>In summary, tags describe <em>what</em> the completion objects are, and style
<tt>how</tt> they are to be completed.  At various points of execution, the
completion system checks what styles and/or tags are defined for the
current context, and uses that to modify its behavior.  The full
description of context handling, which determines how tags and other
elements of the context influence the behaviour of styles, is described
in <a href="#Completion-System-Configuration">Completion System Configuration</a>.
</p>
<p>When a completion is requested, a dispatcher function is called;
see the description of <tt>_main_complete</tt> in the list of control functions
below. This dispatcher decides which function should
be called to produce the completions, and calls it. The result is
passed to one or more <em>completers</em>, functions that implement
individual completion strategies: simple completion, error correction,
completion with error correction, menu selection, etc.
</p>
<p>More generally, the shell functions contained in the completion system are
of two types:
</p><ul>
<li> those beginning &lsquo;<tt>comp</tt>&rsquo; are to be called directly; there are only
a few of these;

</li><li> those beginning &lsquo;<tt>_</tt>&rsquo; are called by the
completion code.  The shell functions of this set, which implement
completion behaviour and may be bound to keystrokes, are referred to
as &lsquo;widgets&rsquo;.  These proliferate as new completions are required.

</li></ul>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Initialization">20.2 Initialization</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#Completion-System-Configuration">20.3 Completion System Configuration</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#Control-Functions">20.4 Control Functions</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#Bindable-Commands">20.5 Bindable Commands</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#Completion-Functions">20.6 Utility Functions</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#Completion-Directories">20.8 Completion Directories</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#Completion-System-Variables">20.7 Completion System Variables</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Initialization"></a>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Completion-System" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Description-3" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Completion-System" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Use-of-compinit" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left">[<a href="Completion-Using-compctl.html#Completion-Using-compctl" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="index.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="zsh_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="Concept-Index.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="zsh_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>

<a name="Initialization-1"></a>
<h2 class="section">20.2 Initialization</h2>
<p><a name="index-compinstall"></a>
<a name="index-completion-system_002c-installing"></a>
</p>
<p>If the system was installed completely, it should be enough to
call the shell function <tt>compinit</tt> from your initialization file; see the
next section.  However, the function <tt>compinstall</tt> can be run by a user
to configure various aspects of the completion system.
</p>
<p>Usually, <tt>compinstall</tt> will insert code into <tt>.zshrc</tt>, although if
that is not writable it will save it in another file and tell you that
file&rsquo;s location.  Note that it is up to you to make sure that the lines
added to <tt>.zshrc</tt> are actually run; you may, for example, need to move
them to an earlier place in the file if <tt>.zshrc</tt> usually returns early.
So long as you keep them all together (including the comment lines at the
start and finish), you can rerun <tt>compinstall</tt> and it will correctly
locate and modify these lines.  Note, however, that any code you add to
this section by hand is likely to be lost if you rerun <tt>compinstall</tt>,
although lines using the command &lsquo;<tt>zstyle</tt>&rsquo; should be gracefully handled.
</p>
<p>The new code will take effect next time you start the shell, or run
<tt>.zshrc</tt> by hand; there is also an option to make them take effect
immediately.  However, if <tt>compinstall</tt> has removed definitions, you will
need to restart the shell to see the changes.
</p>
<p>To run <tt>compinstall</tt> you will need to make sure it is in a directory
mentioned in your <tt>fpath</tt> parameter, which should already be the case if
zsh was properly configured as long as your startup files do not remove the
appropriate directories from <tt>fpath</tt>.  Then it must be autoloaded
(&lsquo;<tt>autoload -U compinstall</tt>&rsquo; is recommended).  You can abort the
installation any time you are being prompted for information, and your
<tt>.zshrc</tt> will not be altered at all; changes only take place right at the
end, where you are specifically asked for confirmation.
</p>

<hr>
<a name="Use-of-compinit"></a>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Completion-System" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Initialization" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Initialization" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Autoloaded-files" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left">[<a href="Completion-Using-compctl.html#Completion-Using-compctl" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="index.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="zsh_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="Concept-Index.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="zsh_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h3 class="subsection">20.2.1 Use of compinit</h3>
<p><a name="index-compinit"></a>
<a name="index-completion-system_002c-initializing"></a>
</p>
<p>This section describes the use of <tt>compinit</tt> to initialize completion for
the current session when called directly; if you have run
<tt>compinstall</tt> it will be called automatically from your <tt>.zshrc</tt>.
</p>
<p>To initialize the system, the function <tt>compinit</tt> should be in a
directory mentioned in the <tt>fpath</tt> parameter, and should be autoloaded
(&lsquo;<tt>autoload -U compinit</tt>&rsquo; is recommended), and then run simply as
&lsquo;<tt>compinit</tt>&rsquo;.  This will define a
few utility functions, arrange for all the necessary shell functions to be
autoloaded, and will then re-define all widgets that do completion to use the
new system.  If you use the <tt>menu-select</tt> widget, which is part of the
<tt>zsh/complist</tt> module, you should make sure that that module is loaded
before the call to <tt>compinit</tt> so that that widget is also
re-defined.  If completion styles (see below) are set up to perform
expansion as well as completion by default, and the TAB key is bound to
<tt>expand-or-complete</tt>, <tt>compinit</tt> will rebind it to <tt>complete-word</tt>;
this is necessary to use the correct form of expansion.
</p>
<p>Should you need to use the original completion commands, you can still
bind keys to the old widgets by putting a &lsquo;<tt>.</tt>&rsquo; in front of the
widget name, e.g. &lsquo;<tt>.expand-or-complete</tt>&rsquo;.
</p>
<p>To speed up the running of <tt>compinit</tt>, it can be made to produce a dumped
configuration that will be read in on future invocations; this is the
default, but can be turned off by calling <tt>compinit</tt> with the
option <tt>-D</tt>.  The dumped file is <tt>.zcompdump</tt> in the same
directory as the startup files (i.e. <tt>$ZDOTDIR</tt> or <tt>$HOME</tt>);
alternatively, an explicit file name can be given by &lsquo;<tt>compinit -d</tt>
<var>dumpfile</var>&rsquo;.  The next invocation of <tt>compinit</tt> will read the dumped
file instead of performing a full initialization.
</p>
<p>If the number of completion files changes, <tt>compinit</tt> will recognise this
and produce a new dump file.  However, if the name of a function or the
arguments in the first line of a <tt>#compdef</tt> function (as described below)
change, it is easiest to delete the dump file by hand so that
<tt>compinit</tt> will re-create it the next time it is run.  The check
performed to see if there are new functions can be omitted by giving
the option <tt>-C</tt>.  In this case the dump file will only be created if
there isn&rsquo;t one already.
</p>
<p>The dumping is actually done by another function, <tt>compdump</tt>, but you
will only need to run this yourself if you change the configuration
(e.g. using <tt>compdef</tt>) and then want to dump the new one.  The name of
the old dumped file will be remembered for this purpose.
</p>
<p>If the parameter <tt>_compdir</tt> is set, <tt>compinit</tt> uses it as a directory
where completion functions can be found; this is only necessary if they are
not already in the function search path.
</p>
<p>For security reasons <tt>compinit</tt> also checks if the completion system
would use files not owned by root or by the current user, or files in
directories that are world- or group-writable or that are not owned by 
root or by the current user.  If such files or directories are found,
<tt>compinit</tt> will ask if the completion system should really be used.  To
avoid these tests and make all files found be used without asking, use the
option <tt>-u</tt>, and to make <tt>compinit</tt> silently ignore all insecure files
and directories use the option <tt>-i</tt>.  This security check is skipped
entirely when the <tt>-C</tt> option is given.
</p>
<p><a name="index-compaudit"></a>
The security check can be retried at any time by running the function
<tt>compaudit</tt>.  This is the same check used by <tt>compinit</tt>, but when it
is executed directly any changes to <tt>fpath</tt> are made local to the
function so they do not persist.  The directories to be checked may be
passed as arguments; if none are given, <tt>compaudit</tt> uses <tt>fpath</tt> and
<tt>_compdir</tt> to find completion system directories, adding missing ones
to <tt>fpath</tt> as necessary.  To force a check of exactly the directories
currently named in <tt>fpath</tt>, set <tt>_compdir</tt> to an empty string before
calling <tt>compaudit</tt> or <tt>compinit</tt>.
</p>
<p><a name="index-bashcompinit"></a>
The function <tt>bashcompinit</tt> provides compatibility with bash&rsquo;s programmable
completion system.  When run it will define the functions, <tt>compgen</tt> and
<tt>complete</tt> which correspond to the bash builtins with the same names.
It will then be possible to use completion specifications and functions
written for bash.
</p>

<hr>
<a name="Autoloaded-files"></a>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Completion-System" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Use-of-compinit" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Initialization" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Functions-2" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left">[<a href="Completion-Using-compctl.html#Completion-Using-compctl" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="index.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="zsh_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="Concept-Index.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="zsh_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h3 class="subsection">20.2.2 Autoloaded files</h3>
<p><a name="index-completion-system_002c-autoloaded-functions"></a>
</p>
<p>The convention for autoloaded functions used in completion is that they
start with an underscore; as already mentioned, the <tt>fpath/FPATH</tt>
parameter must contain the directory in which they are stored.  If <tt>zsh</tt>
was properly installed on your system, then <tt>fpath/FPATH</tt> automatically
contains the required directories for the standard functions.
</p>
<p>For incomplete installations, if <tt>compinit</tt> does not find enough files
beginning with an underscore (fewer than twenty) in the search path, it
will try to find more by adding the directory <tt>_compdir</tt> to the search
path.  If that directory has a subdirectory named <tt>Base</tt>, all
subdirectories will be added to the path.  Furthermore, if the subdirectory
<tt>Base</tt> has a subdirectory named <tt>Core</tt>, <tt>compinit</tt> will add all
subdirectories of the subdirectories to the path: this allows
the functions to be in the same format as in the <tt>zsh</tt> source
distribution.
</p>
<p><a name="index-compdef_002c-use-of-by-compinit"></a>
When <tt>compinit</tt> is run, it searches all such files accessible via
<tt>fpath/FPATH</tt> and reads the first line of each of them.  This line should
contain one of the tags described below.  Files whose first line does not
start with one of these tags are not considered to be part of the
completion system and will not be treated specially.
</p>
<p>The tags are:
</p>
<dl compact="compact">
<dt><tt>#compdef</tt> <var>name</var> ... [ <tt>-</tt>{<tt>p</tt>|<tt>P</tt>} <var>pattern</var> ... [ <tt>-N</tt> <var>name</var> ... ] ]</dt>
<dd><p>The file will be made autoloadable and the function defined 
in it will be called when completing <var>name</var>s, each of which is
either the name of a command whose arguments are to be completed or one of
a number of special contexts in the form <tt>-</tt><var>context</var><tt>-</tt> described
below.
</p>
<p>Each <var>name</var> may also be of the form &lsquo;<var>cmd</var><tt>=</tt><var>service</var>&rsquo;.
When completing the command <var>cmd</var>, the function typically behaves as
if the command (or special context) <var>service</var> was being completed
instead.  This provides a way of altering the behaviour of functions
that can perform many different completions.  It is implemented
by setting the parameter <tt>$service</tt> when calling the function;
the function may choose to interpret this how it wishes, and simpler
functions will probably ignore it.
</p>
<p>If the <tt>#compdef</tt> line contains one of the options <tt>-p</tt> or <tt>-P</tt>,
the words following are taken to be patterns.  The function will be
called when completion is attempted for a command or context that matches
one of the patterns.  The options <tt>-p</tt> and <tt>-P</tt> are used to specify
patterns to be tried before or after other completions respectively.
Hence <tt>-P</tt> may be used to specify default actions.
</p>
<p>The option <tt>-N</tt> is used after a list following <tt>-p</tt> or <tt>-P</tt>; it
specifies that remaining words no longer define patterns.  It is
possible to toggle between the three options as many times as necessary.
</p>
</dd>
<dt><tt>#compdef -k</tt> <var>style key-sequence</var> ...</dt>
<dd><p>This option creates a widget behaving like the
builtin widget <var>style</var> and binds it to the given <var>key-sequence</var>s,
if any.  The <var>style</var> must be one of the builtin widgets that perform
completion, namely <tt>complete-word</tt>, <tt>delete-char-or-list</tt>,
<tt>expand-or-complete</tt>, <tt>expand-or-complete-prefix</tt>, <tt>list-choices</tt>,
<tt>menu-complete</tt>, <tt>menu-expand-or-complete</tt>, or
<tt>reverse-menu-complete</tt>.  If the <tt>zsh/complist</tt> module is loaded (see
<a href="Zsh-Modules.html#The-zsh_002fcomplist-Module">The zsh/complist Module</a>) the widget <tt>menu-select</tt> is also available.
</p>
<p>When one of the <var>key-sequence</var>s is typed, the function in the file will
be invoked to generate the matches.  Note that a key will not be re-bound
if it already was (that is, was bound to something other than
<tt>undefined-key</tt>).  The widget created has the same name as the file and
can be bound to any other keys using <tt>bindkey</tt> as usual.
</p>
</dd>
<dt><tt>#compdef -K</tt> <var>widget-name</var> <var>style</var> <var>key-sequence</var> [ <var>name</var> <var>style</var> <var>seq</var> ... ]</dt>
<dd><p>This is similar to <tt>-k</tt> except that only one <var>key-sequence</var>
argument may be given for each <var>widget-name</var> <var>style</var> pair.
However, the entire set of three arguments may be repeated with a
different set of arguments.  Note in particular that the
<var>widget-name</var> must be distinct in each set.  If it does not begin with
&lsquo;<tt>_</tt>&rsquo; this will be added.  The <var>widget-name</var> should not clash with
the name of any existing widget: names based on the name of the function
are most useful.  For example,
</p>
<div class="example">
<pre class="example">#compdef -K _foo_complete complete-word &quot;^X^C&quot; \ 
  _foo_list list-choices &quot;^X^D&quot;
</pre></div>

<p>(all on one line) defines a widget <tt>_foo_complete</tt> for completion, bound
to &lsquo;<tt>^X^C</tt>&rsquo;, and a widget <tt>_foo_list</tt> for listing, bound to &lsquo;<tt>^X^D</tt>&rsquo;.
</p>
</dd>
<dt><tt>#autoload</tt> [ <var>options</var> ]</dt>
<dd><p>Functions with the <tt>#autoload</tt> tag are marked for autoloading but
are not otherwise treated specially.  Typically they are to be called
from within one of the completion functions.  Any <var>options</var> supplied
will be passed to the <tt>autoload</tt> builtin; a typical use is <tt>+X</tt> to
force the function to be loaded immediately.  Note that the <tt>-U</tt> and
<tt>-z</tt> flags are always added implicitly.
</p>
</dd>
</dl>

<p>The <tt>#</tt> is part of the tag name and no white space is allowed after it.
The <tt>#compdef</tt> tags use the <tt>compdef</tt> function described below; the
main difference is that the name of the function is supplied implicitly.
</p>
<p>The special contexts for which completion functions can be defined are:
</p>
<dl compact="compact">
<dd><a name="index-_002darray_002dvalue_002d_002c-completion-context"></a>
</dd>
<dt><tt>-array-value-</tt></dt>
<dd><p>The right hand side of an array-assignment
(&lsquo;<var>name</var><tt>=(</tt><var>...</var><tt>)</tt>&rsquo;)
</p>
<a name="index-_002dbrace_002dparameter_002d_002c-completion-context"></a>
</dd>
<dt><tt>-brace-parameter-</tt></dt>
<dd><p>The name of a parameter expansion within braces (&lsquo;<tt>${</tt><var>...</var><tt>}</tt>&rsquo;)
</p>
<a name="index-_002dassign_002dparameter_002d_002c-completion-context"></a>
</dd>
<dt><tt>-assign-parameter-</tt></dt>
<dd><p>The name of a parameter in an assignment, i.e. on the left hand side of
an &lsquo;<tt>=</tt>&rsquo;
</p>
<a name="index-_002dcommand_002d_002c-completion-context"></a>
</dd>
<dt><tt>-command-</tt></dt>
<dd><p>A word in command position
</p>
<a name="index-_002dcondition_002d_002c-completion-context"></a>
</dd>
<dt><tt>-condition-</tt></dt>
<dd><p>A word inside a condition (&lsquo;<tt>[[</tt><var>...</var><tt>]]</tt>&rsquo;)
</p>
<a name="index-_002ddefault_002d_002c-completion-context"></a>
</dd>
<dt><tt>-default-</tt></dt>
<dd><p>Any word for which no other completion is defined
</p>
<a name="index-_002dequal_002d_002c-completion-context"></a>
</dd>
<dt><tt>-equal-</tt></dt>
<dd><p>A word beginning with an equals sign
</p>
<a name="index-_002dfirst_002d_002c-completion-context"></a>
</dd>
<dt><tt>-first-</tt></dt>
<dd><p>This is tried before any other completion function.  The function called
may set the <tt>_compskip</tt> parameter to one of various values: 
<tt>all</tt>: no further completion is attempted; a string
containing the substring <tt>patterns</tt>: no pattern completion functions
will be called; a string containing <tt>default</tt>: the
function for the &lsquo;<tt>-default-</tt>&rsquo; context will not be called, but
functions defined for commands will be.
</p>
<a name="index-_002dmath_002d_002c-completion-context"></a>
</dd>
<dt><tt>-math-</tt></dt>
<dd><p>Inside mathematical contexts, such as
&lsquo;<tt>((</tt><var>...</var><tt>))</tt>&rsquo;
</p>
<a name="index-_002dparameter_002d_002c-completion-context"></a>
</dd>
<dt><tt>-parameter-</tt></dt>
<dd><p>The name of a parameter expansion (&lsquo;<tt>$</tt><var>...</var>&rsquo;)
</p>
<a name="index-_002dredirect_002d_002c-completion-context"></a>
</dd>
<dt><tt>-redirect-</tt></dt>
<dd><p>The word after a redirection operator.
</p>
<a name="index-_002dsubscript_002d_002c-completion-context"></a>
</dd>
<dt><tt>-subscript-</tt></dt>
<dd><p>The contents of a parameter subscript.
</p>
<a name="index-_002dtilde_002d_002c-completion-context"></a>
</dd>
<dt><tt>-tilde-</tt></dt>
<dd><p>After an initial tilde (&lsquo;<tt>~</tt>&rsquo;), but before the first slash
in the word.
</p>
<a name="index-_002dvalue_002d_002c-completion-context"></a>
</dd>
<dt><tt>-value-</tt></dt>
<dd><p>On the right hand side of an assignment.
</p>
</dd>
</dl>

<p>Default implementations are supplied for each of these
contexts.  In most cases the context <tt>-</tt><var>context</var><tt>-</tt> is
implemented by a corresponding function <tt>_</tt><var>context</var>, for example
the context &lsquo;<tt>-tilde-</tt>&rsquo; and the function &lsquo;<tt>_tilde</tt>&rsquo;).
</p>
<p>The contexts <tt>-redirect-</tt> and <tt>-value-</tt> allow extra context-specific
information.  (Internally, this is handled by the functions for each
context calling the function <tt>_dispatch</tt>.)  The extra
information is added separated by commas.
</p>
<p>For the <tt>-redirect-</tt> context, the extra information is in the form
&lsquo;<tt>-redirect-,</tt><var>op</var><tt>,</tt><var>command</var>&rsquo;, where <var>op</var> is the
redirection operator and <var>command</var> is the name of the command on
the line.  If there is no command on the line yet, the <var>command</var>
field will be empty.
</p>
<p>For the <tt>-value-</tt> context, the form is
&lsquo;<tt>-value-,</tt><var>name</var><tt>,</tt><var>command</var>&rsquo;, where <var>name</var> is the name of
the parameter on the left hand side of the assignment.
In the case of elements of an associative array, for
example &lsquo;<tt>assoc=(key &lt;TAB&gt;</tt>&rsquo;, <var>name</var> is expanded to
&lsquo;<var>name</var><tt>-</tt><var>key</var>&rsquo;.  In certain special contexts, such as
completing after &lsquo;<tt>make CFLAGS=</tt>&rsquo;, the <var>command</var> part gives the
name of the command, here <tt>make</tt>; otherwise it is empty.
</p>
<p>It is not necessary to define fully specific completions as the
functions provided will try to generate completions by progressively
replacing the elements with &lsquo;<tt>-default-</tt>&rsquo;.  For example, when
completing after &lsquo;<tt>foo=&lt;TAB&gt;</tt>&rsquo;, <tt>_value</tt> will try the names
&lsquo;<tt>-value-,foo,</tt>&rsquo; (note the empty <var>command</var> part),
&lsquo;<tt>-value-,foo,-default-</tt>&rsquo; and&lsquo;<tt>-value-,-default-,-default-</tt>&rsquo;, in
that order, until it finds a function to handle the context.
</p>
<p>As an example:
</p>
<div class="example">
<pre class="example">compdef '_files -g &quot;*.log&quot;' '-redirect-,2&gt;,-default-'
</pre></div>

<p>completes files matching &lsquo;<tt>*.log</tt>&rsquo; after &lsquo;<tt>2&gt; &lt;TAB&gt;</tt>&rsquo; for any
command with no more specific handler defined.
</p>
<p>Also:
</p>
<div class="example">
<pre class="example">compdef _foo -value-,-default-,-default-
</pre></div>

<p>specifies that <tt>_foo</tt> provides completions for the values of
parameters for which no special function has been defined.  This is
usually handled by the function <tt>_value</tt> itself.
</p>
<p>The same lookup rules are used when looking up styles (as described
below); for example
</p>
<div class="example">
<pre class="example">zstyle ':completion:*:*:-redirect-,2&gt;,*:*' file-patterns '*.log'
</pre></div>

<p>is another way to make completion after &lsquo;<tt>2&gt; &lt;TAB&gt;</tt>&rsquo; complete files
matching &lsquo;<tt>*.log</tt>&rsquo;.
</p>

<hr>
<a name="Functions-2"></a>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Completion-System" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Autoloaded-files" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Initialization" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Completion-System-Configuration" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left">[<a href="Completion-Using-compctl.html#Completion-Using-compctl" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="index.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="zsh_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="Concept-Index.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="zsh_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h3 class="subsection">20.2.3 Functions</h3>

<p>The following function is defined by <tt>compinit</tt> and may be called
directly.
</p>
<p><a name="index-compdef"></a>
<a name="index-completion-system_002c-adding-definitions"></a>
</p><dl compact="compact">
<dt><tt>compdef</tt> [ <tt>-ane</tt> ] <var>function name</var> ... [ <tt>-</tt>{<tt>p</tt>|<tt>P</tt>} <var>pattern</var> ... [ <tt>-N</tt> <var>name</var> ...]]</dt>
<dt><tt>compdef -d</tt> <var>name</var> ...</dt>
<dt><tt>compdef -k</tt> [ <tt>-an</tt> ] <var>function style key-sequence</var> [ <var>key-sequence</var> ... ]</dt>
<dt><tt>compdef -K</tt> [ <tt>-an</tt> ] <var>function name style key-seq</var> [ <var>name style seq</var> ... ]</dt>
<dd><p>The first form defines the <var>function</var> to call for completion in the
given contexts as described for the <tt>#compdef</tt> tag above.
</p>
<p>Alternatively, all the arguments may have the form
&lsquo;<var>cmd</var><tt>=</tt><var>service</var>&rsquo;.  Here <var>service</var> should already have been
defined by &lsquo;<var>cmd1</var><tt>=</tt><var>service</var>&rsquo; lines in <tt>#compdef</tt> files, as
described above.  The argument for <var>cmd</var> will be completed in the
same way as <var>service</var>.
</p>
<p>The <var>function</var> argument may alternatively be a string containing
almost any shell code.  If the string contains an equal sign, the above
will take precedence.  The option <tt>-e</tt> may be used to specify the first
argument is to be evaluated as shell code even if it contains an equal
sign.  The string will be executed using the <tt>eval</tt> builtin command to
generate completions.  This provides a way of avoiding having to define
a new completion function.  For example, to complete files ending in
&lsquo;<tt>.h</tt>&rsquo; as arguments to the command <tt>foo</tt>:
</p>
<div class="example">
<pre class="example">compdef '_files -g &quot;*.h&quot;' foo
</pre></div>

<p>The option <tt>-n</tt> prevents any completions already defined for the
command or context from being overwritten.
</p>
<p>The option <tt>-d</tt> deletes any completion defined for the command or
contexts listed.
</p>
<p>The <var>name</var>s may also contain <tt>-p</tt>, <tt>-P</tt> and <tt>-N</tt> options as
described for the <tt>#compdef</tt> tag.  The effect on the argument list is
identical, switching between definitions of patterns tried initially,
patterns tried finally, and normal commands and contexts.
</p>
<p>The parameter <tt>$_compskip</tt> may be set by any function defined for a
pattern context.  If it is set to a value containing the substring
&lsquo;<tt>patterns</tt>&rsquo; none of the pattern-functions will be called; if it is
set to a value containing the substring &lsquo;<tt>all</tt>&rsquo;, no other function
will be called.
</p>
<p>The form with <tt>-k</tt> defines a widget with the same name as the <var>function</var>
that will be called for each of the <var>key-sequence</var>s; this is like the
<tt>#compdef -k</tt> tag.  The function should generate the completions needed
and will otherwise behave like the builtin widget whose name is given as
the <var>style</var> argument.  The widgets usable for this are:
<tt>complete-word</tt>, <tt>delete-char-or-list</tt>, <tt>expand-or-complete</tt>,
<tt>expand-or-complete-prefix</tt>, <tt>list-choices</tt>, <tt>menu-complete</tt>,
<tt>menu-expand-or-complete</tt>, and <tt>reverse-menu-complete</tt>, as well as
<tt>menu-select</tt> if the <tt>zsh/complist</tt> module is loaded.  The option <tt>-n</tt>
prevents the key being bound if it is already to bound to something other
than <tt>undefined-key</tt>.
</p>
<p>The form with <tt>-K</tt> is similar and defines multiple widgets based on the
same <var>function</var>, each of which requires the set of three arguments
<var>name</var>, <var>style</var> and <var>key-seq</var>uence, where the latter two are as
for <tt>-k</tt> and the first must be a unique widget name beginning with an
underscore.
</p>
<p>Wherever applicable, the <tt>-a</tt> option makes the <var>function</var>
autoloadable, equivalent to <tt>autoload -U </tt><var>function</var>.
</p>
</dd>
</dl>

<p>The function <tt>compdef</tt> can be used to associate existing completion
functions with new commands.  For example,
</p>
<div class="example">
<pre class="example">compdef _pids foo
</pre></div>

<p>uses the function <tt>_pids</tt> to complete process IDs for the command <tt>foo</tt>.
</p>
<p>Note also the <tt>_gnu_generic</tt> function described below, which can be
used to complete options for commands that understand the
&lsquo;<tt>-</tt><tt>-help</tt>&rsquo; option.
</p>
<hr>
<a name="Completion-System-Configuration"></a>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Completion-System" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Functions-2" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Completion-System" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Overview-2" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left">[<a href="Completion-Using-compctl.html#Completion-Using-compctl" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="index.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="zsh_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="Concept-Index.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="zsh_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>

<a name="Completion-System-Configuration-1"></a>
<h2 class="section">20.3 Completion System Configuration</h2>
<p><a name="index-completion-system_002c-configuration"></a>
</p>
<p>This section gives a short overview of how the completion system works,
and then more detail on how users can configure how and when matches are
generated.
</p>

<hr>
<a name="Overview-2"></a>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Completion-System" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Completion-System-Configuration" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Completion-System-Configuration" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Standard-Tags" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left">[<a href="Completion-Using-compctl.html#Completion-Using-compctl" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="index.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="zsh_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="Concept-Index.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="zsh_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h3 class="subsection">20.3.1 Overview</h3>

<p>When completion is attempted somewhere on the command line the
completion system begins building the context.  The context represents
everything that the shell knows about the meaning of the command line
and the significance of the cursor position.  This takes account of a
number of things including the command word (such as &lsquo;<tt>grep</tt>&rsquo; or
&lsquo;<tt>zsh</tt>&rsquo;) and options to which the current word may be an argument
(such as the &lsquo;<tt>-o</tt>&rsquo; option to <tt>zsh</tt> which takes a shell option as an
argument).
</p>
<p>The context starts out very generic (&quot;we are beginning a completion&quot;)
and becomes more specific as more is learned (&quot;the current word is in a
position that is usually a command name&quot; or &quot;the current word might be a
variable name&quot; and so on).  Therefore the context will vary during the
same call to the completion system.
</p>
<p>This context information is condensed into a string consisting of multiple
fields separated by colons, referred to simply as &lsquo;the context&rsquo; in the
remainder of the documentation.  Note that a user of the completion system
rarely needs to compose a context string, unless for example a new
function is being written to perform completion for a new command.  What a
user may need to do is compose a <em>style</em> pattern, which is matched
against a context when needed to look up context-sensitive options that
configure the completion system.
</p>
<p>The next few paragraphs explain how a context is composed within the
completion function suite.  Following that is discussion of how <em>styles</em>
are defined.  Styles determine such things as how the matches are
generated, similarly to shell options but with much more control.  They
are defined with the <tt>zstyle</tt> builtin command (<a href="Zsh-Modules.html#The-zsh_002fzutil-Module">The zsh/zutil Module</a>).
</p>
<p>The context string always consists of a fixed set of fields, separated
by colons and with a leading colon before the first.  Fields which are
not yet known are left empty, but the surrounding colons appear anyway.
The fields are always in the order
<tt>:completion:</tt><var>function</var><tt>:</tt><var>completer</var><tt>:</tt><var>command</var><tt>:</tt><var>argument</var><tt>:</tt><var>tag</var>.  These have the following meaning:
</p>
<ul>
<li> The literal string <tt>completion</tt>, saying that this style is used by
the completion system.  This distinguishes the context from those used
by, for example, zle widgets and ZFTP functions.

</li><li> The <var>function</var>, if completion is called from a named widget rather
than through the normal completion system.  Typically this is blank, but
it is set by special widgets such as <tt>predict-on</tt> and the various
functions in the <tt>Widget</tt> directory of the distribution to the name of
that function, often in an abbreviated form.

</li><li> The <var>completer</var> currently active, the name of the function without the
leading underscore and with other underscores converted to hyphens.  A
&lsquo;completer&rsquo; is in overall control of how completion is to be performed;
&lsquo;<tt>complete</tt>&rsquo; is the simplest, but other completers exist to perform
related tasks such as correction, or to modify the behaviour of a later
completer.  See
<a href="#Control-Functions">Control Functions</a> 
for more information.  

</li><li> The <var>command</var> or a special <tt>-</tt><var>context</var><tt>-</tt>, just at it appears
following the <tt>#compdef</tt> tag or the <tt>compdef</tt> function.  Completion
functions for commands that have sub-commands usually modify this field
to contain the name of the command followed by a minus sign and the
sub-command.  For example, the completion function for the <tt>cvs</tt>
command sets this field to <tt>cvs-add</tt> when completing arguments to
the <tt>add</tt> subcommand.

</li><li> The <var>argument</var>; this indicates which command line or option argument
we are completing.  For command arguments this generally takes the form
<tt>argument-</tt><var>n</var>, where <var>n</var> is the number of the argument,
and for arguments to options the form <tt>option-</tt><var>opt</var><tt>-</tt><var>n</var>
where <var>n</var> is the number of the argument to option <var>opt</var>.  However,
this is only the case if the command line is parsed with standard
UNIX-style options and arguments, so many completions do not set this.

</li><li> The <var>tag</var>.  As described previously, tags are used to discriminate between
the types of matches a completion function can generate in a certain context.
Any completion function may use any tag name it likes, but a list of the
more common ones is given below.

</li></ul>

<p>The context is gradually put together as the functions are executed, starting
with the main entry point, which adds <tt>:completion:</tt> and the <var>function</var>
element if necessary.  The completer then adds the <var>completer</var> element.
The contextual completion adds the <var>command</var> and <var>argument</var> options.
Finally, the <var>tag</var> is added when the types of completion are known.
For example, the context name
</p>
<div class="example">
<pre class="example"><tt>:completion::complete:dvips:option-o-1:files</tt>
</pre></div>

<p>says that normal completion was attempted as the first argument to the
option <tt>-o</tt> of the command <tt>dvips</tt>:
</p>
<div class="example">
<pre class="example"><tt>dvips -o ...</tt>
</pre></div>

<p>and the completion function will generate filenames.
</p>
<p>Usually completion will be tried for all possible tags in an order given
by the completion function.  However, this can be altered by using the
<tt>tag-order</tt> style.  Completion is then restricted to the list of given
tags in the given order.
</p>
<p>The <tt>_complete_help</tt> bindable command shows all the contexts and tags
available for completion at a particular point.  This provides an easy
way of finding information for <tt>tag-order</tt> and other styles.  It is
described in
<a href="#Bindable-Commands">Bindable Commands</a>.
</p>
<p>When looking up styles the completion system uses full context names,
including the tag.  Looking up the value of a style therefore consists of
two things: the context, which is matched to the most specific (best
fitting) style pattern, and the name of the style itself, which must be
matched exactly.  The following examples demonstrate that style patterns
may be loosely defined for styles that apply broadly, or as tightly
defined as desired for styles that apply in narrower circumstances.
</p>
<p>For example, many completion functions can generate matches in a
simple and a verbose form and use the <tt>verbose</tt> style to decide
which form should be used.  To make all such functions use the verbose form,
put
</p>
<div class="example">
<pre class="example">zstyle ':completion:*' verbose yes
</pre></div>

<p>in a startup file (probably <tt>.zshrc</tt>).
This gives the <tt>verbose</tt> style the value <tt>yes</tt> in every
context inside the completion system, unless that context has a more
specific definition.  It is best to avoid giving the context as &lsquo;<tt>*</tt>&rsquo;
in case the style has some meaning outside the completion system.
</p>
<p>Many such general purpose styles can be configured simply by using the
<tt>compinstall</tt> function.
</p>
<p>A more specific example of the use of the <tt>verbose</tt> style is by the
completion for the <tt>kill</tt> builtin.  If the style is set, the builtin
lists full job texts and process command lines; otherwise it shows the
bare job numbers and PIDs.  To turn the style off for this use only:
</p>
<div class="example">
<pre class="example">zstyle ':completion:*:*:kill:*:*' verbose no
</pre></div>

<p>For even more control, the style can use one of the tags &lsquo;<tt>jobs</tt>&rsquo; or
&lsquo;<tt>processes</tt>&rsquo;.  To turn off verbose display only for jobs:
</p>
<div class="example">
<pre class="example">zstyle ':completion:*:*:kill:*:jobs' verbose no
</pre></div>

<p>The <tt>-e</tt> option to <tt>zstyle</tt> even allows completion function code to
appear as the argument to a style; this requires some understanding of
the internals of completion functions (see
<a href="Completion-Widgets.html#Completion-Widgets">Completion Widgets</a>)).  For example,
</p>
<div class="example">
<pre class="example"><tt>zstyle -e ':completion:*' hosts 'reply=($myhosts)'</tt>
</pre></div>

<p>This forces the value of the <tt>hosts</tt> style to be read from the
variable <tt>myhosts</tt> each time a host name is needed; this is useful
if the value of <tt>myhosts</tt> can change dynamically.
For another useful example, see the example in the description of the
<tt>file-list</tt> style below.  This form can be
slow and should be avoided for commonly examined styles such
as <tt>menu</tt> and <tt>list-rows-first</tt>.
</p>
<p>Note that the order in which styles are <em>defined</em> does not matter; the
style mechanism uses the most specific possible match for a particular
style to determine the set of values.  More precisely, strings are
preferred over patterns (for example, &lsquo;<tt>:completion::complete:::foo</tt>&rsquo; is
more specific than &lsquo;<tt>:completion::complete:::*'</tt>), and longer patterns are
preferred over shorter patterns.
</p>
<p>A good rule of thumb is that any completion style pattern that needs to
include more than one wildcard (<tt>*</tt>) and that does not end in a tag
name, should include all six colons (<tt>:</tt>), possibly surrounding
additional wildcards.
</p>
<p>Style names like those of tags are arbitrary and depend on the completion
function.  However, the following two sections list some of the most
common tags and styles.
</p>

<hr>
<a name="Standard-Tags"></a>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Completion-System" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Overview-2" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Completion-System-Configuration" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Standard-Styles" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left">[<a href="Completion-Using-compctl.html#Completion-Using-compctl" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="index.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="zsh_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="Concept-Index.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="zsh_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h3 class="subsection">20.3.2 Standard Tags</h3>
<p><a name="index-completion-system_002c-tags"></a>
</p>
<p>Some of the following are only used when looking up particular styles
and do not refer to a type of match.
</p>
<dl compact="compact">
<dd><a name="index-accounts_002c-completion-tag"></a>
</dd>
<dt><tt>accounts</tt></dt>
<dd><p>used to look up the <tt>users-hosts</tt> style
</p>
<a name="index-all_002dexpansions_002c-completion-tag"></a>
</dd>
<dt><tt>all-expansions</tt></dt>
<dd><p>used by the <tt>_expand</tt> completer when adding the single string containing
all possible expansions
</p>
<a name="index-all_002dfiles_002c-completion-tag"></a>
</dd>
<dt><tt>all-files</tt></dt>
<dd><p>for the names of all files (as distinct from a particular subset, see the
<tt>globbed-files</tt> tag).
</p>
<a name="index-arguments_002c-completion-tag"></a>
</dd>
<dt><tt>arguments</tt></dt>
<dd><p>for arguments to a command
</p>
<a name="index-arrays_002c-completion-tag"></a>
</dd>
<dt><tt>arrays</tt></dt>
<dd><p>for names of array parameters
</p>
<a name="index-association_002dkeys_002c-completion-tag"></a>
</dd>
<dt><tt>association-keys</tt></dt>
<dd><p>for keys of associative arrays; used when completing inside a
subscript to a parameter of this type
</p>
<a name="index-bookmarks_002c-completion-tag"></a>
</dd>
<dt><tt>bookmarks</tt></dt>
<dd><p>when completing bookmarks (e.g. for URLs and the <tt>zftp</tt> function suite)
</p>
<a name="index-builtins_002c-completion-tag"></a>
</dd>
<dt><tt>builtins</tt></dt>
<dd><p>for names of builtin commands
</p>
<a name="index-characters_002c-completion-tag"></a>
</dd>
<dt><tt>characters</tt></dt>
<dd><p>for single characters in arguments of commands such as <tt>stty</tt>.   Also used
when completing character classes after an opening bracket
</p>
<a name="index-colormapids_002c-completion-tag"></a>
</dd>
<dt><tt>colormapids</tt></dt>
<dd><p>for X colormap ids
</p>
<a name="index-colors_002c-completion-tag"></a>
</dd>
<dt><tt>colors</tt></dt>
<dd><p>for color names
</p>
<a name="index-commands_002c-completion-tag"></a>
</dd>
<dt><tt>commands</tt></dt>
<dd><p>for names of external commands.  Also used by complex commands such as
<tt>cvs</tt> when completing names subcommands.
</p>
<a name="index-contexts_002c-completion-tag"></a>
</dd>
<dt><tt>contexts</tt></dt>
<dd><p>for contexts in arguments to the <tt>zstyle</tt> builtin command
</p>
<a name="index-corrections_002c-completion-tag"></a>
</dd>
<dt><tt>corrections</tt></dt>
<dd><p>used by the <tt>_approximate</tt> and <tt>_correct</tt> completers for possible
corrections
</p>
<a name="index-cursors_002c-completion-tag"></a>
</dd>
<dt><tt>cursors</tt></dt>
<dd><p>for cursor names used by X programs
</p>
<a name="index-default_002c-completion-tag"></a>
</dd>
<dt><tt>default</tt></dt>
<dd><p>used in some contexts to provide a way of supplying a default when more
specific tags are also valid.  Note that this tag is
used when only the <var>function</var> field of the context name is set
</p>
<a name="index-descriptions_002c-completion-tag"></a>
</dd>
<dt><tt>descriptions</tt></dt>
<dd><p>used when looking up the value of the <tt>format</tt> style to generate
descriptions for types of matches
</p>
<a name="index-devices_002c-completion-tag"></a>
</dd>
<dt><tt>devices</tt></dt>
<dd><p>for names of device special files
</p>
<a name="index-directories_002c-completion-tag"></a>
</dd>
<dt><tt>directories</tt></dt>
<dd><p>for names of directories &mdash; <tt>local-directories</tt> is used instead
when completing arguments of <tt>cd</tt> and related builtin commands when
the <tt>cdpath</tt> array is set
</p>
<a name="index-directory_002dstack_002c-completion-tag"></a>
</dd>
<dt><tt>directory-stack</tt></dt>
<dd><p>for entries in the directory stack
</p>
<a name="index-displays_002c-completion-tag"></a>
</dd>
<dt><tt>displays</tt></dt>
<dd><p>for X display names
</p>
<a name="index-domains_002c-completion-tag"></a>
</dd>
<dt><tt>domains</tt></dt>
<dd><p>for network domains
</p>
<a name="index-email_002d_002a_002c-completion-tag"></a>
</dd>
<dt><tt>email-</tt><var>plugin</var></dt>
<dd><p>for email addresses from the &lsquo;<tt>_email-</tt><var>plugin</var>&rsquo; backend of <tt>_email_addresses</tt>
</p>
<a name="index-expansions_002c-completion-tag"></a>
</dd>
<dt><tt>expansions</tt></dt>
<dd><p>used by the <tt>_expand</tt> completer for individual words (as opposed to
the complete set of expansions) resulting from the expansion of a word
on the command line
</p>
<a name="index-extensions_002c-completion-tag"></a>
</dd>
<dt><tt>extensions</tt></dt>
<dd><p>for X server extensions
</p>
<a name="index-file_002ddescriptors_002c-completion-tag"></a>
</dd>
<dt><tt>file-descriptors</tt></dt>
<dd><p>for numbers of open file descriptors
</p>
<a name="index-files_002c-completion-tag"></a>
</dd>
<dt><tt>files</tt></dt>
<dd><p>the generic file-matching tag used by functions completing filenames
</p>
<a name="index-fonts_002c-completion-tag"></a>
</dd>
<dt><tt>fonts</tt></dt>
<dd><p>for X font names
</p>
<a name="index-fstypes_002c-completion-tag"></a>
</dd>
<dt><tt>fstypes</tt></dt>
<dd><p>for file system types (e.g. for the <tt>mount</tt> command)
</p>
<a name="index-functions_002c-completion-tag"></a>
</dd>
<dt><tt>functions</tt></dt>
<dd><p>names of functions &mdash; normally shell functions, although certain
commands may understand other kinds of function
</p>
<a name="index-globbed_002dfiles_002c-completion-tag"></a>
</dd>
<dt><tt>globbed-files</tt></dt>
<dd><p>for filenames when the name has been generated by pattern matching
</p>
<a name="index-groups_002c-completion-tag"></a>
</dd>
<dt><tt>groups</tt></dt>
<dd><p>for names of user groups
</p>
<a name="index-history_002dwords_002c-completion-tag"></a>
</dd>
<dt><tt>history-words</tt></dt>
<dd><p>for words from the history
</p>
<a name="index-hosts_002c-completion-tag"></a>
</dd>
<dt><tt>hosts</tt></dt>
<dd><p>for hostnames
</p>
<a name="index-indexes_002c-completion-tag"></a>
</dd>
<dt><tt>indexes</tt></dt>
<dd><p>for array indexes
</p>
<a name="index-jobs_002c-completion-tag"></a>
</dd>
<dt><tt>jobs</tt></dt>
<dd><p>for jobs (as listed by the &lsquo;<tt>jobs</tt>&rsquo; builtin)
</p>
<a name="index-interfaces_002c-completion-tag"></a>
</dd>
<dt><tt>interfaces</tt></dt>
<dd><p>for network interfaces
</p>
<a name="index-keymaps_002c-completion-tag"></a>
</dd>
<dt><tt>keymaps</tt></dt>
<dd><p>for names of zsh keymaps
</p>
<a name="index-keysyms_002c-completion-tag"></a>
</dd>
<dt><tt>keysyms</tt></dt>
<dd><p>for names of X keysyms
</p>
<a name="index-libraries_002c-completion-tag"></a>
</dd>
<dt><tt>libraries</tt></dt>
<dd><p>for names of system libraries
</p>
<a name="index-limits_002c-completion-tag"></a>
</dd>
<dt><tt>limits</tt></dt>
<dd><p>for system limits
</p>
<a name="index-local_002ddirectories_002c-completion-tag"></a>
</dd>
<dt><tt>local-directories</tt></dt>
<dd><p>for names of directories that are subdirectories of the current working
directory when completing arguments of <tt>cd</tt> and related builtin
commands (compare <tt>path-directories</tt>) &mdash; when the <tt>cdpath</tt>
array is unset, <tt>directories</tt> is used instead
</p>
<a name="index-manuals_002c-completion-tag"></a>
</dd>
<dt><tt>manuals</tt></dt>
<dd><p>for names of manual pages
</p>
<a name="index-mailboxes_002c-completion-tag"></a>
</dd>
<dt><tt>mailboxes</tt></dt>
<dd><p>for e-mail folders
</p>
<a name="index-maps_002c-completion-tag"></a>
</dd>
<dt><tt>maps</tt></dt>
<dd><p>for map names (e.g. NIS maps)
</p>
<a name="index-messages_002c-completion-tag"></a>
</dd>
<dt><tt>messages</tt></dt>
<dd><p>used to look up the <tt>format</tt> style for messages
</p>
<a name="index-modifiers_002c-completion-tag"></a>
</dd>
<dt><tt>modifiers</tt></dt>
<dd><p>for names of X modifiers
</p>
<a name="index-modules_002c-completion-tag"></a>
</dd>
<dt><tt>modules</tt></dt>
<dd><p>for modules (e.g. <tt>zsh</tt> modules)
</p>
<a name="index-my_002daccounts_002c-completion-tag"></a>
</dd>
<dt><tt>my-accounts</tt></dt>
<dd><p>used to look up the <tt>users-hosts</tt> style
</p>
<a name="index-named_002ddirectories_002c-completion-tag"></a>
</dd>
<dt><tt>named-directories</tt></dt>
<dd><p>for named directories (you wouldn&rsquo;t have guessed that, would you?)
</p>
<a name="index-names_002c-completion-tag"></a>
</dd>
<dt><tt>names</tt></dt>
<dd><p>for all kinds of names
</p>
<a name="index-newsgroups_002c-completion-tag"></a>
</dd>
<dt><tt>newsgroups</tt></dt>
<dd><p>for USENET groups
</p>
<a name="index-nicknames_002c-completion-tag"></a>
</dd>
<dt><tt>nicknames</tt></dt>
<dd><p>for nicknames of NIS maps
</p>
<a name="index-options_002c-completion-tag"></a>
</dd>
<dt><tt>options</tt></dt>
<dd><p>for command options
</p>
<a name="index-original_002c-completion-tag"></a>
</dd>
<dt><tt>original</tt></dt>
<dd><p>used by the <tt>_approximate</tt>, <tt>_correct</tt> and <tt>_expand</tt> completers when
offering the original string as a match
</p>
<a name="index-other_002daccounts_002c-completion-tag"></a>
</dd>
<dt><tt>other-accounts</tt></dt>
<dd><p>used to look up the <tt>users-hosts</tt> style
</p>
<a name="index-other_002dfiles_002c-completion-tag"></a>
</dd>
<dt><tt>other-files</tt></dt>
<dd><p>for the names of any non-directory files.  This is used instead
of <tt>all-files</tt> when the <tt>list-dirs-first</tt> style is in effect.
</p>
<a name="index-packages_002c-completion-tag"></a>
</dd>
<dt><tt>packages</tt></dt>
<dd><p>for packages (e.g. <tt>rpm</tt> or installed <tt>Debian</tt> packages)
</p>
<a name="index-parameters_002c-completion-tag"></a>
</dd>
<dt><tt>parameters</tt></dt>
<dd><p>for names of parameters
</p>
<a name="index-path_002ddirectories_002c-completion-tag"></a>
</dd>
<dt><tt>path-directories</tt></dt>
<dd><p>for names of directories found by searching the <tt>cdpath</tt> array when
completing arguments of <tt>cd</tt> and related builtin commands (compare
<tt>local-directories</tt>)
</p>
<a name="index-paths_002c-completion-tag"></a>
</dd>
<dt><tt>paths</tt></dt>
<dd><p>used to look up the values of the <tt>expand</tt>, <tt>ambiguous</tt> and
<tt>special-dirs</tt> styles
</p>
<a name="index-pods_002c-completion-tag"></a>
</dd>
<dt><tt>pods</tt></dt>
<dd><p>for perl pods (documentation files)
</p>
<a name="index-ports_002c-completion-tag"></a>
</dd>
<dt><tt>ports</tt></dt>
<dd><p>for communication ports
</p>
<a name="index-prefixes_002c-completion-tag"></a>
</dd>
<dt><tt>prefixes</tt></dt>
<dd><p>for prefixes (like those of a URL)
</p>
<a name="index-printers_002c-completion-tag"></a>
</dd>
<dt><tt>printers</tt></dt>
<dd><p>for print queue names
</p>
<a name="index-processes_002c-completion-tag"></a>
</dd>
<dt><tt>processes</tt></dt>
<dd><p>for process identifiers
</p>
<a name="index-processes_002dnames_002c-completion-tag"></a>
</dd>
<dt><tt>processes-names</tt></dt>
<dd><p>used to look up the <tt>command</tt> style when generating the names of
processes for <tt>killall</tt>
</p>
<a name="index-sequences_002c-completion-tag"></a>
</dd>
<dt><tt>sequences</tt></dt>
<dd><p>for sequences (e.g. <tt>mh</tt> sequences)
</p>
<a name="index-sessions_002c-completion-tag"></a>
</dd>
<dt><tt>sessions</tt></dt>
<dd><p>for sessions in the <tt>zftp</tt> function suite
</p>
<a name="index-signals_002c-completion-tag"></a>
</dd>
<dt><tt>signals</tt></dt>
<dd><p>for signal names
</p>
<a name="index-strings_002c-completion-tag"></a>
</dd>
<dt><tt>strings</tt></dt>
<dd><p>for strings (e.g. the replacement strings for the <tt>cd</tt> builtin
command)
</p>
<a name="index-styles_002c-completion-tag"></a>
</dd>
<dt><tt>styles</tt></dt>
<dd><p>for styles used by the zstyle builtin command
</p>
<a name="index-suffixes_002c-completion-tag"></a>
</dd>
<dt><tt>suffixes</tt></dt>
<dd><p>for filename extensions
</p>
<a name="index-tags_002c-completion-tag"></a>
</dd>
<dt><tt>tags</tt></dt>
<dd><p>for tags (e.g. <tt>rpm</tt> tags)
</p>
<a name="index-targets_002c-completion-tag"></a>
</dd>
<dt><tt>targets</tt></dt>
<dd><p>for makefile targets
</p>
<a name="index-time_002dzones_002c-completion-tag"></a>
</dd>
<dt><tt>time-zones</tt></dt>
<dd><p>for time zones (e.g. when setting the <tt>TZ</tt> parameter)
</p>
<a name="index-types_002c-completion-tag"></a>
</dd>
<dt><tt>types</tt></dt>
<dd><p>for types of whatever (e.g. address types for the <tt>xhost</tt> command)
</p>
<a name="index-urls_002c-completion-tag"></a>
</dd>
<dt><tt>urls</tt></dt>
<dd><p>used to look up the <tt>urls</tt> and <tt>local</tt> styles when completing URLs
</p>
<a name="index-users_002c-completion-tag"></a>
</dd>
<dt><tt>users</tt></dt>
<dd><p>for usernames
</p>
<a name="index-values_002c-completion-tag"></a>
</dd>
<dt><tt>values</tt></dt>
<dd><p>for one of a set of values in certain lists
</p>
<a name="index-variant_002c-completion-tag"></a>
</dd>
<dt><tt>variant</tt></dt>
<dd><p>used by <tt>_pick_variant</tt> to look up the command to run when determining
what program is installed for a particular command name.
</p>
<a name="index-visuals_002c-completion-tag"></a>
</dd>
<dt><tt>visuals</tt></dt>
<dd><p>for X visuals
</p>
<a name="index-warnings_002c-completion-tag"></a>
</dd>
<dt><tt>warnings</tt></dt>
<dd><p>used to look up the <tt>format</tt> style for warnings
</p>
<a name="index-widgets_002c-completion-tag"></a>
</dd>
<dt><tt>widgets</tt></dt>
<dd><p>for zsh widget names
</p>
<a name="index-windows_002c-completion-tag"></a>
</dd>
<dt><tt>windows</tt></dt>
<dd><p>for IDs of X windows
</p>
<a name="index-zsh_002doptions_002c-completion-tag"></a>
</dd>
<dt><tt>zsh-options</tt></dt>
<dd><p>for shell options
</p>
</dd>
</dl>


<hr>
<a name="Standard-Styles"></a>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Completion-System" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Standard-Tags" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Completion-System-Configuration" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Control-Functions" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left">[<a href="Completion-Using-compctl.html#Completion-Using-compctl" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="index.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="zsh_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="Concept-Index.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="zsh_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h3 class="subsection">20.3.3 Standard Styles</h3>
<p><a name="index-completion-system_002c-styles"></a>
</p>
<p>Note that the values of several of these styles represent boolean
values.  Any of the strings &lsquo;<tt>true</tt>&rsquo;, &lsquo;<tt>on</tt>&rsquo;,
&lsquo;<tt>yes</tt>&rsquo;, and &lsquo;<tt>1</tt>&rsquo; can be used for the value &lsquo;true&rsquo; and
any of the strings &lsquo;<tt>false</tt>&rsquo;, &lsquo;<tt>off</tt>&rsquo;, &lsquo;<tt>no</tt>&rsquo;, and &lsquo;<tt>0</tt>&rsquo; for
the value &lsquo;false&rsquo;.  The behavior for any other value is undefined 
except where explicitly mentioned.  The default value may
be either &lsquo;true&rsquo; or &lsquo;false&rsquo; if the style is not set.
</p>
<p>Some of these styles are tested first for every possible tag
corresponding to a type of match, and if no style was found, for the
<tt>default</tt> tag.  The most notable styles of this type are <tt>menu</tt>, 
<tt>list-colors</tt> and styles controlling completion listing such as 
<tt>list-packed</tt> and <tt>last-prompt</tt>.  When tested for the <tt>default</tt>
tag, only the <var>function</var> field of the context will be set so that
a style using the <tt>default</tt> tag will normally be defined along the lines of:
</p>
<div class="example">
<pre class="example">zstyle ':completion:*:default' menu ...
</pre></div>

<dl compact="compact">
<dd><a name="index-accept_002dexact_002c-completion-style"></a>
</dd>
<dt><tt>accept-exact</tt></dt>
<dd><p>This is tested for the <tt>default</tt> tag in addition to the tags valid for
the current context.  If it is set to &lsquo;true&rsquo; and any of the trial
matches is the same as the string on the command line, this match will
immediately be accepted (even if it would otherwise be considered
ambiguous).
</p>
<p>When completing pathnames (where the tag used is &lsquo;<tt>paths</tt>&rsquo;)
this style accepts any number of patterns as the value in addition to
the boolean values.  Pathnames matching one of these
patterns will be accepted immediately even if the command line contains
some more partially typed pathname components and these match no file
under the directory accepted.
</p>
<p>This style is also used by the <tt>_expand</tt> completer to decide if
words beginning with a tilde or parameter expansion should be
expanded.  For example, if there are parameters
<tt>foo</tt> and <tt>foobar</tt>, the string &lsquo;<tt>$foo</tt>&rsquo; will only be expanded if 
<tt>accept-exact</tt> is set to &lsquo;true&rsquo;; otherwise the completion system will
be allowed to complete <tt>$foo</tt> to <tt>$foobar</tt>. If the style is set to
&lsquo;<tt>continue</tt>&rsquo;, <tt>_expand</tt> will add the expansion as a match and the completion
system will also be allowed to continue.
</p>
<a name="index-accept_002dexact_002ddirs_002c-completion-style"></a>
</dd>
<dt><tt>accept-exact-dirs</tt></dt>
<dd><p>This is used by filename completion.  Unlike <tt>accept-exact</tt> it is
a boolean.  By default, filename completion examines all components
of a path to see if there are completions of that component, even if
the component matches an existing directory.  For example, when
completion after <tt>/usr/bin/</tt>, the function examines possible
completions to <tt>/usr</tt>.
</p>
<p>When this style is &lsquo;true&rsquo;, any prefix of a path that matches an existing
directory is accepted without any attempt to complete it further.
Hence, in the given example, the path <tt>/usr/bin/</tt> is accepted
immediately and completion tried in that directory.
</p>
<p>If you wish to inhibit this behaviour entirely, set the <tt>path-completion</tt>
style (see below) to &lsquo;false&rsquo;.
</p>
<a name="index-add_002dspace_002c-completion-style"></a>
</dd>
<dt><tt>add-space</tt></dt>
<dd><p>This style is used by the <tt>_expand</tt> completer.  If it is &lsquo;true&rsquo; (the
default), a space will be inserted after all words resulting from the 
expansion, or a slash in the case of directory names.  If the value
is &lsquo;<tt>file</tt>&rsquo;, the completer will only add a space
to names of existing files.  Either a boolean &lsquo;true&rsquo; or the value
&lsquo;<tt>file</tt>&rsquo; may be combined with &lsquo;<tt>subst</tt>&rsquo;, in which case the completer
will not add a space to words generated from the expansion of a
substitution of the form &lsquo;<tt>$(</tt><var>...</var><tt>)</tt>&rsquo; or &lsquo;<tt>${</tt><var>...</var><tt>}</tt>&rsquo;.
</p>
<p>The <tt>_prefix</tt> completer uses this style as a simple boolean value
to decide if a space should be inserted before the suffix.
</p>
<a name="index-ambiguous_002c-completion-style"></a>
</dd>
<dt><tt>ambiguous</tt></dt>
<dd><p>This applies when completing non-final components of filename paths, in
other words those with a trailing slash.  If it is set, the cursor is
left after the first ambiguous component, even if menu completion is in
use.  The style is always tested with the <tt>paths</tt> tag.
</p>
<a name="index-assign_002dlist_002c-completion-style"></a>
</dd>
<dt><tt>assign-list</tt></dt>
<dd><p>When completing after an equals sign that is being treated as an
assignment, the completion system normally completes only one filename.
In some cases the value  may be a list of filenames separated by colons,
as with <tt>PATH</tt> and similar parameters.  This style can be set to a
list of patterns matching the names of such parameters.
</p>
<p>The default is to complete lists when the word on the line already
contains a colon.
</p>
<a name="index-auto_002ddescription_002c-completion-style"></a>
</dd>
<dt><tt>auto-description</tt></dt>
<dd><p>If set, this style&rsquo;s value will be used as the description for options that
are not described by the completion functions, but that have exactly
one argument.  The sequence &lsquo;<tt>%d</tt>&rsquo; in the value will be replaced by
the description for this argument.  Depending on personal preferences,
it may be useful to set this style to something like &lsquo;<tt>specify: %d</tt>&rsquo;. 
Note that this may not work for some commands.
</p>
<a name="index-avoid_002dcompleter_002c-completion-style"></a>
</dd>
<dt><tt>avoid-completer</tt></dt>
<dd><p>This is used by the <tt>_all_matches</tt> completer to decide if the string 
consisting of all matches should be added to the list currently being
generated.  Its value is a list of names of completers.  If any of
these is the name of the completer that generated the matches in this
completion, the string will not be added.
</p>
<p>The default value for this style is &lsquo;<tt>_expand _old_list _correct
_approximate</tt>&rsquo;, i.e. it contains the completers for which a string
with all matches will almost never be wanted.
</p>
<a name="index-cache_002dpath_002c-completion-style"></a>
</dd>
<dt><tt>cache-path</tt></dt>
<dd><p>This style defines the path where any cache files containing dumped
completion data are stored.  It defaults to &lsquo;<tt>$ZDOTDIR/.zcompcache</tt>&rsquo;, or
&lsquo;<tt>$HOME/.zcompcache</tt>&rsquo; if <tt>$ZDOTDIR</tt> is not defined.  The completion
cache will not be used unless the <tt>use-cache</tt> style is set.
</p>
<a name="index-cache_002dpolicy_002c-completion-style"></a>
</dd>
<dt><tt>cache-policy</tt></dt>
<dd><p>This style defines the function that will be used to determine whether
a cache needs rebuilding.  See the section on the <tt>_cache_invalid</tt>
function below.
</p>
<a name="index-call_002dcommand_002c-completion-style"></a>
</dd>
<dt><tt>call-command</tt></dt>
<dd><p>This style is used in the function for commands such as <tt>make</tt> and
<tt>ant</tt> where calling the command directly to generate matches suffers
problems such as being slow or, as in the case of <tt>make</tt> can
potentially cause actions in the makefile to be executed. If it is set
to &lsquo;true&rsquo; the command is called to generate matches. The default value
of this style is &lsquo;false&rsquo;.
</p>
<a name="index-command_002c-completion-style"></a>
</dd>
<dt><tt>command</tt></dt>
<dd><p>In many places, completion functions need to call external commands to
generate the list of completions.  This style can be used to override the
command that is called in some such cases.  The elements of the value are
joined with spaces to form a command line to execute.  The value can also
start with a hyphen, in which case the usual command will be added to the
end; this is most useful for putting &lsquo;<tt>builtin</tt>&rsquo; or &lsquo;<tt>command</tt>&rsquo; in
front to make sure the appropriate version of a command is called, for
example to avoid calling a shell function with the same name as an external
command.
</p>
<p>As an example, the completion function for process IDs uses this
style with the <tt>processes</tt> tag to generate the IDs to complete and
the list of processes to display (if the <tt>verbose</tt> style is &lsquo;true&rsquo;).
The list produced by the command should look like the output of the
<tt>ps</tt> command.  The first line is not displayed, but is searched for
the string &lsquo;<tt>PID</tt>&rsquo; (or &lsquo;<tt>pid</tt>&rsquo;) to find the position of the
process IDs in the following lines.  If the line does not contain
&lsquo;<tt>PID</tt>&rsquo;, the first numbers in each of the other lines are taken as the 
process IDs to complete.
</p>
<p>Note that the completion function generally has to call the specified
command for each attempt to generate the completion list.  Hence
care should be taken to specify only commands that take a short
time to run, and in particular to avoid any that may never terminate.
</p>
<a name="index-command_002dpath_002c-completion-style"></a>
</dd>
<dt><tt>command-path</tt></dt>
<dd><p>This is a list of directories to search for commands to complete.  The
default for this style is the value of the special parameter <tt>path</tt>.
</p>
<a name="index-commands_002c-completion-style"></a>
</dd>
<dt><tt>commands</tt></dt>
<dd><p>This is used by the function completing sub-commands for the system
initialisation scripts (residing in <tt>/etc/init.d</tt> or somewhere not
too far away from that).  Its values give the default commands to
complete for those commands for which the completion function isn&rsquo;t
able to find them out automatically.  The default for this style are
the two strings &lsquo;<tt>start</tt>&rsquo; and &lsquo;<tt>stop</tt>&rsquo;.
</p>
<a name="index-complete_002c-completion-style"></a>
</dd>
<dt><tt>complete</tt></dt>
<dd><p>This is used by the <tt>_expand_alias</tt> function when invoked as a
bindable command.  If set to &lsquo;true&rsquo; and the word on the command
line is not the name of an alias, matching alias names will be
completed.
</p>
<a name="index-complete_002doptions_002c-completion-style"></a>
</dd>
<dt><tt>complete-options</tt></dt>
<dd><p>This is used by the completer for <tt>cd</tt>, <tt>chdir</tt> and <tt>pushd</tt>.
For these commands a <tt>-</tt> is used to introduce a directory stack entry
and completion of these is far more common than completing options.
Hence unless the value of this style is &lsquo;true&rsquo; options will not be
completed, even after an initial <tt>-</tt>.  If it is &lsquo;true&rsquo;, options will
be completed after an initial <tt>-</tt> unless there is a preceding
<tt>-</tt><tt>-</tt> on the command line.
</p>
<a name="index-completer_002c-completion-style"></a>
</dd>
<dt><tt>completer</tt></dt>
<dd><p>The strings given as the value of this style provide the names of the
completer functions to use. The available completer functions are
described in
<a href="#Control-Functions">Control Functions</a>.
</p>
<p>Each string may be either the name of a completer function or a string
of the form &lsquo;<var>function</var><tt>:</tt><var>name</var>&rsquo;.  In the first case the
<var>completer</var> field of the context will contain the name of the
completer without the leading underscore and with all other
underscores replaced by hyphens.  In the second case the
<var>function</var> is the name of the completer to call, but the context
will contain the user-defined <var>name</var> in the <var>completer</var> field of
the context.  If the <var>name</var> starts with a hyphen, the string for the
context will be build from the name of the completer function as in
the first case with the <var>name</var> appended to it.  For example: 
</p>
<div class="example">
<pre class="example">zstyle ':completion:*' completer _complete _complete:-foo
</pre></div>

<p>Here, completion will call the <tt>_complete</tt> completer twice, once
using &lsquo;<tt>complete</tt>&rsquo; and once using &lsquo;<tt>complete-foo</tt>&rsquo; in the
<var>completer</var> field of the context.  Normally, using the same
completer more than once only makes sense when used with the
&lsquo;<var>functions</var><tt>:</tt><var>name</var>&rsquo; form, because otherwise the context
name will be the same in all calls to the completer; possible
exceptions to this rule are the <tt>_ignored</tt> and <tt>_prefix</tt>
completers.
</p>
<p>The default value for this style is &lsquo;<tt>_complete _ignored</tt>&rsquo;:
only completion will be done, first using the <tt>ignored-patterns</tt> style
and the <tt>$fignore</tt> array and then without ignoring matches.
</p>
<a name="index-condition_002c-completion-style"></a>
</dd>
<dt><tt>condition</tt></dt>
<dd><p>This style is used by the <tt>_list</tt> completer function to decide if
insertion of matches should be delayed unconditionally. The default is 
&lsquo;true&rsquo;.
</p>
<a name="index-delimiters_002c-completion-style"></a>
</dd>
<dt><tt>delimiters</tt></dt>
<dd><p>This style is used when adding a delimiter for use with history
modifiers or glob qualifiers that have delimited arguments.  It is
an array of preferred delimiters to add.  Non-special characters are
preferred as the completion system may otherwise become confused.
The default list is <tt>:</tt>, <tt>+</tt>, <tt>/</tt>, <tt>-</tt>, <tt>%</tt>.  The list
may be empty to force a delimiter to be typed.
</p>
<a name="index-disabled_002c-completion-style"></a>
</dd>
<dt><tt>disabled</tt></dt>
<dd><p>If this is set to &lsquo;true&rsquo;, the <tt>_expand_alias</tt> completer and bindable 
command will try to expand disabled aliases, too.  The default is
&lsquo;false&rsquo;.
</p>
<a name="index-domains_002c-completion-style"></a>
</dd>
<dt><tt>domains</tt></dt>
<dd><p>A list of names of network domains for completion.
If this is not set, domain names will be taken from
the file <tt>/etc/resolv.conf</tt>.
</p>
<a name="index-environ_002c-completion-style"></a>
</dd>
<dt><tt>environ</tt></dt>
<dd><p>The environ style is used when completing for &lsquo;<tt>sudo</tt>&rsquo;.  It is set to an
array of &lsquo;<var>VAR</var><tt>=</tt><var>value</var>&rsquo; assignments to be exported into the
local environment before the completion for the target command is invoked.
</p><div class="example">
<pre class="example">zstyle ':completion:*:sudo::' environ \ 
  PATH=&quot;/sbin:/usr/sbin:$PATH&quot; HOME=&quot;/root&quot;
</pre></div>

<a name="index-expand_002c-completion-style"></a>
</dd>
<dt><tt>expand</tt></dt>
<dd><p>This style is used when completing strings consisting of multiple
parts, such as path names.
</p>
<p>If one of its values is the string &lsquo;<tt>prefix</tt>&rsquo;, the partially typed
word from the line will be expanded as far as possible even if trailing
parts cannot be completed.
</p>
<p>If one of its values is the string &lsquo;<tt>suffix</tt>&rsquo;, matching names for
components after the first ambiguous one will also be added.  This means
that the resulting string is the longest unambiguous string possible.
However, menu completion can be used to cycle through all matches.
</p>
<a name="index-fake_002c-completion-style"></a>
</dd>
<dt><tt>fake</tt></dt>
<dd><p>This style may be set for any completion context.  It
specifies additional strings that will always be completed in that
context.  The form of each string is &lsquo;<var>value</var><tt>:</tt><var>description</var>&rsquo;; 
the colon and description may be omitted, but any literal colons in
<var>value</var> must be quoted with a backslash.  Any <var>description</var>
provided is shown alongside the value in completion listings.
</p>
<p>It is important to use a sufficiently restrictive context when specifying
fake strings.  Note that the styles <tt>fake-files</tt> and <tt>fake-parameters</tt>
provide additional features when completing files or parameters.
</p>
<a name="index-fake_002dalways_002c-completion-style"></a>
</dd>
<dt><tt>fake-always</tt></dt>
<dd><p>This works identically to the <tt>fake</tt> style except that
the <tt>ignored-patterns</tt> style is not applied to it.  This makes it
possible to override a set of matches completely by setting the
ignored patterns to &lsquo;<tt>*</tt>&rsquo;.
</p>
<p>The following shows a way of supplementing any tag with arbitrary data, but
having it behave for display purposes like a separate tag.  In this example
we use the features of the <tt>tag-order</tt> style to divide the
<tt>named-directories</tt> tag into two when performing completion with
the standard completer <tt>complete</tt> for arguments of <tt>cd</tt>.  The tag
<tt>named-directories-normal</tt> behaves as normal, but the tag
<tt>named-directories-mine</tt> contains a fixed set of directories.
This has the effect of adding the match group &lsquo;<tt>extra directories</tt>&rsquo; with
the given completions.
</p>
<div class="example">
<pre class="example">zstyle ':completion::complete:cd:*' tag-order \ 
  'named-directories:-mine:extra\ directories
  named-directories:-normal:named\ directories *'
zstyle ':completion::complete:cd:*:named-directories-mine' \ 
  fake-always mydir1 mydir2
zstyle ':completion::complete:cd:*:named-directories-mine' \ 
  ignored-patterns '*'
</pre></div>

<a name="index-fake_002dfiles_002c-completion-style"></a>
</dd>
<dt><tt>fake-files</tt></dt>
<dd><p>This style is used when completing files and looked up 
without a tag.  Its values are of the form
&lsquo;<var>dir</var><tt>:</tt><var>names...</var>&rsquo;.  This will add the <var>names</var> (strings
separated by spaces) as
possible matches when completing in the directory <var>dir</var>, even if no 
such files really exist.  The dir may be a pattern; pattern characters
or colons in <var>dir</var> should be quoted with a backslash to be treated
literally.
</p>
<p>This can be useful on systems that support special file systems whose
top-level pathnames can not be listed or generated with glob patterns.
It can also be used for directories for which one does not have read
permission.
</p>
<p>The pattern form can be used to add a certain &lsquo;magic&rsquo; entry
to all directories on a particular file system.
</p>
<a name="index-fake_002dparameters_002c-completion-style"></a>
</dd>
<dt><tt>fake-parameters</tt></dt>
<dd><p>This is used by the completion function for parameter names.
Its values are names of parameters that might not yet be
set but should be completed nonetheless.  Each name may also be 
followed by a colon and a string specifying the type of the parameter
(like &lsquo;<tt>scalar</tt>&rsquo;, &lsquo;<tt>array</tt>&rsquo; or &lsquo;<tt>integer</tt>&rsquo;).  If the type is
given, the name will only be completed if parameters of that type are
required in the particular context.  Names for which no type is
specified will always be completed.
</p>
<a name="index-file_002dlist_002c-completion-style"></a>
</dd>
<dt><tt>file-list</tt></dt>
<dd><p>This style controls whether files completed using the standard builtin
mechanism are to be listed with a long list similar to <tt>ls -l</tt>.
Note that this feature uses the shell module
<tt>zsh/stat</tt> for file information; this loads the builtin <tt>stat</tt>
which will replace any external <tt>stat</tt> executable.  To avoid
this the following code can be included in an initialization file:
</p>
<div class="example">
<pre class="example">zmodload -i zsh/stat
disable stat
</pre></div>

<p>The style may either be set to a &lsquo;true&rsquo; value (or &lsquo;<tt>all</tt>&rsquo;), or
one of the values &lsquo;<tt>insert</tt>&rsquo; or &lsquo;<tt>list</tt>&rsquo;, indicating that files
are to be listed in long format in all circumstances, or when
attempting to insert a file name, or when listing file names
without attempting to insert one.
</p>
<p>More generally, the value may be an array of any of the above values,
optionally followed by <tt>=</tt><var>num</var>.  If <var>num</var> is present it
gives the maximum number of matches for which long listing style
will be used.  For example,
</p>
<div class="example">
<pre class="example">zstyle ':completion:*' file-list list=20 insert=10
</pre></div>

<p>specifies that long format will be used when listing up to 20 files
or inserting a file with up to 10 matches (assuming a listing
is to be shown at all, for example on an ambiguous completion), else short
format will be used.
</p>
<div class="example">
<pre class="example">zstyle -e ':completion:*' file-list \ 
       '(( ${+NUMERIC} )) &amp;&amp; reply=(true)'
</pre></div>

<p>specifies that long format will be used any time a numeric argument is
supplied, else short format.
</p>
<a name="index-file_002dpatterns_002c-completion-style"></a>
</dd>
<dt><tt>file-patterns</tt></dt>
<dd><p>This is used by the standard function for completing filenames,
<tt>_files</tt>.  If the style is unset up to three tags are offered,
&lsquo;<tt>globbed-files</tt>&rsquo;,&lsquo;<tt>directories</tt>&rsquo; and &lsquo;<tt>all-files</tt>&rsquo;, depending on
the types of files  expected by the caller of <tt>_files</tt>.  The first two
(&lsquo;<tt>globbed-files</tt>&rsquo; and &lsquo;<tt>directories</tt>&rsquo;) are normally offered
together to make it easier to complete files in sub-directories.
</p>
<p>The <tt>file-patterns</tt> style provides alternatives to the default tags,
which are not used.  Its value consists of elements of the form
&lsquo;<var>pattern</var><tt>:</tt><var>tag</var>&rsquo;; each string may contain any number of
such specifications separated by spaces.
</p>
<p>The <var>pattern</var> is a pattern that is to be used to generate filenames.
Any occurrence of the sequence &lsquo;<tt>%p</tt>&rsquo; is replaced by any
pattern(s)
passed by the function calling <tt>_files</tt>.  Colons in the pattern must
be preceded by a backslash to make them distinguishable from the colon
before the <var>tag</var>.  If more than one pattern is needed, the patterns
can be given inside braces, separated by commas.
</p>
<p>The <var>tag</var>s of all strings in the value will be offered by <tt>_files</tt>
and used when looking up other styles.  Any <var>tag</var>s in the same
word will be offered at the same time and before later words.
If no &lsquo;<tt>:</tt><var>tag</var>&rsquo; is given the &lsquo;<tt>files</tt>&rsquo; tag will be used.
</p>
<p>The <var>tag</var> may also be followed by an optional second colon and a
description, which will be used for the &lsquo;<tt>%d</tt>&rsquo; in the value of
the <tt>format</tt> style (if that is set) instead of the default
description supplied by the completion function.  If the description
given here contains itself a &lsquo;<tt>%d</tt>&rsquo;, that is replaced with the
description supplied by the completion function.
</p>
<p>For example, to make the <tt>rm</tt> command first complete only names of
object files and then the names of all files if there is no matching
object file:
</p>
<div class="example">
<pre class="example">zstyle ':completion:*:*:rm:*:*' file-patterns \ 
    '*.o:object-files' '%p:all-files'
</pre></div>

<p>To alter the default behaviour of file completion &mdash; offer files
matching a pattern and directories on the first attempt, then all files
&mdash; to offer only matching files on the first attempt, then directories,
and finally all files:
</p>
<div class="example">
<pre class="example">zstyle ':completion:*' file-patterns \ 
    '%p:globbed-files' '*(-/):directories' '*:all-files'
</pre></div>

<p>This works even where there is no special pattern: <tt>_files</tt> matches
all files using the pattern &lsquo;<tt>*</tt>&rsquo; at the first step and stops when it
sees this pattern.  Note also it will never try a pattern more than once
for a single completion attempt.
</p>
<p>During the execution of completion functions, the <tt>EXTENDED_GLOB</tt>
option is in effect, so the characters &lsquo;<tt>#</tt>&rsquo;, &lsquo;<tt>~</tt>&rsquo; and &lsquo;<tt>^</tt>&rsquo; have
special meanings in the patterns.
</p>
<a name="index-file_002dsort_002c-completion-style"></a>
</dd>
<dt><tt>file-sort</tt></dt>
<dd><p>The standard filename completion function uses this style without a tag
to determine in which order the names should be listed; menu completion
will cycle through them in the same order.  The possible
values are: &lsquo;<tt>size</tt>&rsquo; to sort by the size of the file;
&lsquo;<tt>links</tt>&rsquo; to sort by the number of links to the file;
&lsquo;<tt>modification</tt>&rsquo; (or &lsquo;<tt>time</tt>&rsquo; or &lsquo;<tt>date</tt>&rsquo;) to sort by the last
modification time; &lsquo;<tt>access</tt>&rsquo; to sort by the last access time; and
&lsquo;<tt>inode</tt>&rsquo; (or &lsquo;<tt>change</tt>&rsquo;) to sort by the last inode change
time.  If the style is set to any other value, or is unset, files will be
sorted alphabetically by name.  If the value contains the string
&lsquo;<tt>reverse</tt>&rsquo;, sorting is done in the opposite order.  If the value
contains the string &lsquo;<tt>follow</tt>&rsquo;, timestamps are associated with the
targets of symbolic links; the default is to use the timestamps
of the links themselves.
</p>
<a name="index-filter_002c-completion-style"></a>
</dd>
<dt><tt>filter</tt></dt>
<dd><p>The <tt>ldap</tt> plugin of email address completion (see <tt>_email_addresses</tt>) uses
this style to specify
the attributes to match against when filtering entries.  So for example, if
the style is set to &lsquo;<tt>sn</tt>&rsquo;, matching is done against surnames.  Standard
LDAP filtering is used so normal completion matching is bypassed.  If this
style is not set, the LDAP plugin is skipped.  You may also need to set the
<tt>command</tt> style to specify how to connect to your LDAP server.
</p>
<a name="index-force_002dlist_002c-completion-style"></a>
</dd>
<dt><tt>force-list</tt></dt>
<dd><p>This forces a list of completions to be shown at any point where listing is
done, even in cases where the list would usually be suppressed.
For example, normally the list is only shown if
there are at least two different matches.  By setting this style to
&lsquo;<tt>always</tt>&rsquo;, the list will always be shown, even if there is only a
single match that will immediately be accepted.  The style may also
be set to a number.  In this case the list will be shown if there are
at least that many matches, even if they would all insert the same
string.
</p>
<p>This style is tested for the default tag as well as for each tag valid
for the current completion.  Hence the listing can be forced only for
certain types of match.
</p>
<a name="index-format_002c-completion-style"></a>
</dd>
<dt><tt>format</tt></dt>
<dd><p>If this is set for the <tt>descriptions</tt> tag, its value is used as a
string to display above matches in completion lists.  The sequence
&lsquo;<tt>%d</tt>&rsquo; in this string will be replaced with a short description of
what these matches are.  This string may also contain the following
sequences to specify output attributes
(see <a href="Prompt-Expansion.html#Prompt-Expansion">Prompt Expansion</a>):
&lsquo;<tt>%B</tt>&rsquo;, &lsquo;<tt>%S</tt>&rsquo;, &lsquo;<tt>%U</tt>&rsquo;, &lsquo;<tt>%F</tt>&rsquo;, &lsquo;<tt>%K</tt>&rsquo; and their lower case
counterparts, as well as &lsquo;<tt>%{</tt>...<tt>%}</tt>&rsquo;.  &lsquo;<tt>%F</tt>&rsquo;, &lsquo;<tt>%K</tt>&rsquo; and
&lsquo;<tt>%{</tt>...<tt>%}</tt>&rsquo; take arguments in the same form as prompt
expansion.  Note that the sequence &lsquo;<tt>%G</tt>&rsquo; is not available; an argument
to &lsquo;<tt>%{</tt>&rsquo; should be used instead.
</p>
<p>The style is tested with each tag valid for the current completion
before it is tested for the <tt>descriptions</tt> tag.  Hence different format 
strings can be defined for different types of match.
</p>
<p>Note also that some completer functions define additional
&lsquo;<tt>%</tt>&rsquo;-sequences.  These are described for the completer functions that 
make use of them.
</p>
<p>Some completion functions display messages that may be customised by
setting this style for the <tt>messages</tt> tag.  Here, the &lsquo;<tt>%d</tt>&rsquo; is
replaced with a message given by the completion function.
</p>
<p>Finally, the format string is looked up with the <tt>warnings</tt> tag, 
for use when no matches could be generated at all.  In this case the
&lsquo;<tt>%d</tt>&rsquo; is replaced with the descriptions for the matches that were
expected separated by spaces.  The sequence &lsquo;<tt>%D</tt>&rsquo; is replaced with
the same descriptions separated by newlines.
</p>
<p>It is possible to use printf-style field width specifiers with &lsquo;<tt>%d</tt>&rsquo;
and similar escape sequences.  This is handled by the <tt>zformat</tt>
builtin command from the <tt>zsh/zutil</tt> module, see
<a href="Zsh-Modules.html#The-zsh_002fzutil-Module">The zsh/zutil Module</a>.
</p>
<a name="index-glob_002c-completion-style"></a>
</dd>
<dt><tt>glob</tt></dt>
<dd><p>This is used by the <tt>_expand</tt> completer.  If
it is set to &lsquo;true&rsquo; (the default), globbing will be attempted on the
words resulting from a previous substitution (see the <tt>substitute</tt>
style) or else the original string from the line.
</p>
<a name="index-global_002c-completion-style"></a>
</dd>
<dt><tt>global</tt></dt>
<dd><p>If this is set to &lsquo;true&rsquo; (the default), the <tt>_expand_alias</tt>
completer and bindable command will try to expand global aliases.
</p>
<a name="index-group_002dname_002c-completion-style"></a>
</dd>
<dt><tt>group-name</tt></dt>
<dd><p>The completion system can group different types of matches, which appear
in separate lists.  This style can be used to give the names of groups
for particular tags.  For example, in command position the completion
system generates names of builtin and external commands, names of
aliases, shell functions and parameters and reserved words as possible
completions.  To have the external commands and shell functions listed
separately:
</p>
<div class="example">
<pre class="example">zstyle ':completion:*:*:-command-:*:commands' \ 
       group-name commands
zstyle ':completion:*:*:-command-:*:functions' \ 
       group-name functions
</pre></div>

<p>As a consequence, any match with the same tag will be displayed in the
same group.
</p>
<p>If the name given is the empty string the name of the tag for
the matches will be used as the name of the group.  So, to have all
different types of matches displayed separately, one can just set:
</p>
<div class="example">
<pre class="example">zstyle ':completion:*' group-name ''
</pre></div>

<p>All matches for which no group name is defined will be put in a group
named <tt>-default-</tt>.
</p>
<a name="index-group_002dorder_002c-completion-style"></a>
</dd>
<dt><tt>group-order</tt></dt>
<dd><p>This style is additional to the <tt>group-name</tt> style to specify the
order for display of the groups defined by that style (compare <tt>tag-order</tt>,
which determines which completions appear at all).  The groups named
are shown in the given order; any other groups
are shown in the order defined by the completion function.
</p>
<p>For example, to have names of builtin commands, shell functions and
external commands appear in that order when completing in command
position:
</p>
<div class="example">
<pre class="example">zstyle ':completion:*:*:-command-:*:*' group-order \ 
       builtins functions commands
</pre></div>

<a name="index-groups_002c-completion-style"></a>
</dd>
<dt><tt>groups</tt></dt>
<dd><p>A list of names of UNIX groups.  If this is not set,
group names are taken from the YP database or the file &lsquo;<tt>/etc/group</tt>&rsquo;.
</p>
<a name="index-hidden_002c-completion-style"></a>
</dd>
<dt><tt>hidden</tt></dt>
<dd><p>If this is set to &lsquo;true&rsquo;, matches for the given context
will not be listed, although
any description for the matches set with the <tt>format</tt> style will be
shown.  If it is set to &lsquo;<tt>all</tt>&rsquo;, not even the description will be
displayed.
</p>
<p>Note that the matches will still be completed; they are just not shown 
in the list.  To avoid having matches considered as possible
completions at all, the <tt>tag-order</tt> style can be modified as described
below.
</p>
<a name="index-hosts_002c-completion-style"></a>
</dd>
<dt><tt>hosts</tt></dt>
<dd><p>A list of names of hosts that should be completed.  If this is not set,
hostnames are taken from the file &lsquo;<tt>/etc/hosts</tt>&rsquo;.
</p>
<a name="index-hosts_002dports_002c-completion-style"></a>
</dd>
<dt><tt>hosts-ports</tt></dt>
<dd><p>This style is used by commands that need or accept hostnames and
network ports.  The strings in the value should be of the form
&lsquo;<var>host</var><tt>:</tt><var>port</var>&rsquo;.  Valid ports are determined by the presence
of hostnames; multiple ports for the same host may appear.
</p>
<a name="index-ignore_002dline_002c-completion-style"></a>
</dd>
<dt><tt>ignore-line</tt></dt>
<dd><p>This is tested for each tag valid for the current completion.  If
it is set to &lsquo;true&rsquo;, none of the words that are already on the line
will be considered as possible completions.  If it is set to
&lsquo;<tt>current</tt>&rsquo;, the word the cursor is on will not be considered as a
possible completion.  The value &lsquo;<tt>current-shown</tt>&rsquo; is similar but only
applies if the list of completions is currently shown on the screen.
Finally, if the style is set to &lsquo;<tt>other</tt>&rsquo;, all words on the line except
for the current one will be excluded from the possible completions.
</p>
<p>The values &lsquo;<tt>current</tt>&rsquo; and &lsquo;<tt>current-shown</tt>&rsquo; are a bit like the
opposite of the <tt>accept-exact</tt> style:  only strings with
missing characters will be completed.
</p>
<p>Note that you almost certainly don&rsquo;t want to set this to &lsquo;true&rsquo; or
&lsquo;<tt>other</tt>&rsquo; for a general
context such as &lsquo;<tt>:completion:*</tt>&rsquo;.  This is because it would disallow
completion of, for example, options multiple times even if the command
in question accepts the option more than once.
</p>
<a name="index-ignore_002dparents_002c-completion-style"></a>
</dd>
<dt><tt>ignore-parents</tt></dt>
<dd><p>The style is tested without a tag by the function completing pathnames
in order to determine whether to ignore
the names of directories already mentioned in the current word, or the
name of the current working directory.  The value must include one or both
of the following strings:
</p>
<dl compact="compact">
<dt><tt>parent</tt></dt>
<dd><p>The name of any directory whose path is already contained in the word on
the line is ignored.  For example, when completing after <tt>foo/../</tt>, the
directory <tt>foo</tt> will not be considered a valid completion.
</p>
</dd>
<dt><tt>pwd</tt></dt>
<dd><p>The name of the current working directory will not be completed; hence,
for example, completion after <tt>../</tt> will not use the name of the current
directory.
</p>
</dd>
</dl>

<p>In addition, the value may include one or both of:
</p>
<dl compact="compact">
<dt><tt>..</tt></dt>
<dd><p>Ignore the specified directories only when the word on the line contains
the substring &lsquo;<tt>../</tt>&rsquo;.
</p>
</dd>
<dt><tt>directory</tt></dt>
<dd><p>Ignore the specified directories only when names of directories are
completed, not when completing names of files.
</p>
</dd>
</dl>

<p>Excluded values act in a similar fashion to values of the
<tt>ignored-patterns</tt> style, so they can be restored to consideration by
the <tt>_ignored</tt> completer.
</p>
<a name="index-extra_002dverbose_002c-completion-style"></a>
</dd>
<dt><tt>extra-verbose</tt></dt>
<dd><p>If set, the completion listing is more verbose at the cost of
a probable decrease in completion speed.  Completion performance
will suffer if this style is set to &lsquo;true&rsquo;.
</p>
<a name="index-ignored_002dpatterns_002c-completion-style"></a>
</dd>
<dt><tt>ignored-patterns</tt></dt>
<dd><p>A list of patterns; any trial completion matching one of the patterns
will be excluded from consideration.  The
<tt>_ignored</tt> completer can appear in the list of completers to
restore the ignored matches.  This is a more configurable
version of the shell parameter <tt>$fignore</tt>.
</p>
<p>Note that the
<tt>EXTENDED_GLOB</tt> option is set during the execution of completion
functions, so the characters &lsquo;<tt>#</tt>&rsquo;, &lsquo;<tt>~</tt>&rsquo; and &lsquo;<tt>^</tt>&rsquo; have special
meanings in the patterns.
</p>
<a name="index-insert_002c-completion-style"></a>
</dd>
<dt><tt>insert</tt></dt>
<dd><p>This style is used by the <tt>_all_matches</tt> completer to decide whether to
insert the list of all matches unconditionally instead of adding the
list as another match.
</p>
<a name="index-insert_002dids_002c-completion-style"></a>
</dd>
<dt><tt>insert-ids</tt></dt>
<dd><p>When completing process IDs, for example as arguments to the <tt>kill</tt> and
<tt>wait</tt> builtins the name of a
command may be converted to the appropriate process ID.  A problem
arises when the process name typed is not unique.  By default (or if this
style is set explicitly to &lsquo;<tt>menu</tt>&rsquo;) the name will be converted
immediately to a set of possible IDs, and menu completion will be started
to cycle through them.
</p>
<p>If the value of the style is &lsquo;<tt>single</tt>&rsquo;,
the shell will wait until the user has typed enough to make the command
unique before converting the name to an ID; attempts at completion will
be unsuccessful until that point.  If the value is any other
string, menu completion will be started when the string typed by the
user is longer than the common prefix to the corresponding IDs.
</p>
<a name="index-insert_002dtab_002c-completion-style"></a>
</dd>
<dt><tt>insert-tab</tt></dt>
<dd><p>If this is set to &lsquo;true&rsquo;, the completion system will
insert a TAB character (assuming that was used to start completion) instead
of performing completion when there is no non-blank character to the left
of the cursor.  If it is set to &lsquo;false&rsquo;, completion will be done even there.
</p>
<p>The value may also contain the substrings &lsquo;<tt>pending</tt>&rsquo; or
&lsquo;<tt>pending=</tt><var>val</var>&rsquo;.  In this case, the typed character will be
inserted instead of starting completion when there is unprocessed input
pending.  If a <var>val</var> is given, completion will not be done if there
are at least that many characters of unprocessed input.  This is often
useful when pasting characters into a terminal.  Note
however, that it relies on the <tt>$PENDING</tt> special parameter from the
<tt>zsh/zle</tt> module being set properly which is not guaranteed on all
platforms.
</p>
<p>The default value of this style is &lsquo;true&rsquo; except for completion within
<tt>vared</tt> builtin command where it is &lsquo;false&rsquo;.
</p>
<a name="index-insert_002dunambiguous_002c-completion-style"></a>
</dd>
<dt><tt>insert-unambiguous</tt></dt>
<dd><p>This is used by the <tt>_match</tt> and <tt>_approximate</tt> completers.
These completers are often used with menu completion since the word typed
may bear little resemblance to the final completion.
However, if this style is &lsquo;true&rsquo;, the completer will start menu
completion only if it could find no unambiguous initial string at
least as long as the original string typed by the user.
</p>
<p>In the case of the <tt>_approximate</tt> completer, the completer
field in the context will already have been set to one of
<tt>correct-</tt><var>num</var> or <tt>approximate-</tt><var>num</var>, where <var>num</var> is the
number of errors that were accepted.
</p>
<p>In the case of the <tt>_match</tt> completer, the style may also be set to
the string &lsquo;<tt>pattern</tt>&rsquo;.  Then the pattern on the line is left
unchanged if it does not match unambiguously.
</p>
<a name="index-gain_002dprivileges_002c-completion-style"></a>
</dd>
<dt><tt>gain-privileges</tt></dt>
<dd><p>If set to <tt>true</tt>, this style enables the use of commands like <tt>sudo</tt>
or <tt>doas</tt> to gain extra privileges when retrieving information for
completion. This is only done when a command such as <tt>sudo</tt> appears on
the command-line. To force the use of, e.g. <tt>sudo</tt> or to override any
prefix that might be added due to <tt>gain-privileges</tt>, the <tt>command</tt>
style can be used with a value that begins with a hyphen.
</p>
<a name="index-keep_002dprefix_002c-completion-style"></a>
</dd>
<dt><tt>keep-prefix</tt></dt>
<dd><p>This style is used by the <tt>_expand</tt> completer.  If it is &lsquo;true&rsquo;, the
completer will try to keep a prefix containing a tilde or parameter
expansion.  Hence, for example, the string &lsquo;<tt>~/f*</tt>&rsquo; would be expanded to
&lsquo;<tt>~/foo</tt>&rsquo; instead of &lsquo;<tt>/home/user/foo</tt>&rsquo;.  If the style is set to
&lsquo;<tt>changed</tt>&rsquo; (the default), the prefix will only be left unchanged if
there were other changes between the expanded words and the original
word from the command line.  Any other value forces the prefix to be
expanded unconditionally.
</p>
<p>The behaviour of <tt>_expand</tt> when this style is &lsquo;true&rsquo; is to cause <tt>_expand</tt>
to give up when a single expansion with the restored prefix is the same
as the original; hence any remaining completers may be called.
</p>
<a name="index-last_002dprompt_002c-completion-style"></a>
</dd>
<dt><tt>last-prompt</tt></dt>
<dd><p>This is a more flexible form of the <tt>ALWAYS_LAST_PROMPT</tt> option.
If it is &lsquo;true&rsquo;, the completion system will try to return the cursor to
the previous command line after displaying a completion list.  It is
tested for all tags valid for the current completion, then the
<tt>default</tt> tag.  The cursor will be moved back to the
previous line if this style is &lsquo;true&rsquo; for all types of match.  Note
that unlike the <tt>ALWAYS_LAST_PROMPT</tt> option this is independent of the
numeric argument.
</p>
<a name="index-known_002dhosts_002dfiles"></a>
</dd>
<dt><tt>known-hosts-files</tt></dt>
<dd><p>This style should contain a list of files to search for host names and
(if the <tt>use-ip</tt> style is set) IP addresses in a format compatible with
ssh <tt>known_hosts</tt> files.  If it is not set, the files
<tt>/etc/ssh/ssh_known_hosts</tt> and <tt>~/.ssh/known_hosts</tt> are used.
</p>
<a name="index-list_002c-completion-style"></a>
</dd>
<dt><tt>list</tt></dt>
<dd><p>This style is used by the <tt>_history_complete_word</tt> bindable command.
If it is set to &lsquo;true&rsquo; it has no effect.  If it is set to &lsquo;false&rsquo;
matches will not be listed.  This overrides the setting of the options
controlling listing behaviour, in particular <tt>AUTO_LIST</tt>.  The context
always starts with &lsquo;<tt>:completion:history-words</tt>&rsquo;.
</p>
<a name="index-list_002dcolors_002c-completion-style"></a>
</dd>
<dt><tt>list-colors</tt></dt>
<dd><p>If the <tt>zsh/complist</tt> module is loaded, this style can be used to set
color specifications.  This mechanism replaces the use of the
<tt>ZLS_COLORS</tt> and <tt>ZLS_COLOURS</tt> parameters described in
<a href="Zsh-Modules.html#The-zsh_002fcomplist-Module">The zsh/complist Module</a>, but the syntax is the same.
</p>
<p>If this style is set for the <tt>default</tt> tag, the strings in the value 
are taken as specifications that are to be used everywhere.  If it is
set for other tags, the specifications are used only for matches of
the type described by the tag.  For this to work best, the <tt>group-name</tt>
style must be set to an empty string.  
</p>
<p>In addition to setting styles for specific tags, it is also possible to
use group names specified explicitly by the <tt>group-name</tt> tag together
with the &lsquo;<tt>(group)</tt>&rsquo; syntax allowed by the <tt>ZLS_COLORS</tt> and
<tt>ZLS_COLOURS</tt> parameters and simply using the <tt>default</tt> tag.
</p>
<p>It is possible to use any color specifications already set up for the GNU
version of the <tt>ls</tt> command:
</p>
<div class="example">
<pre class="example">zstyle ':completion:*:default' list-colors \ 
       ${(s.:.)LS_COLORS}
</pre></div>

<p>The default colors are the same as for the GNU <tt>ls</tt> command and can be
obtained by setting the style to an empty string (i.e. <tt>''</tt>).
</p>
<a name="index-list_002ddirs_002dfirst_002c-completion-style"></a>
</dd>
<dt><tt>list-dirs-first</tt></dt>
<dd><p>This is used by file completion.  If set, directories to be completed
are listed separately from and before completion for other files,
regardless of tag ordering.  In addition, the tag <tt>other-files</tt>
is used in place of <tt>all-files</tt> for the remaining files, to indicate
that no directories are presented with that tag.
</p>
<a name="index-list_002dgrouped_002c-completion-style"></a>
</dd>
<dt><tt>list-grouped</tt></dt>
<dd><p>If this style is &lsquo;true&rsquo; (the default), the completion system will try to
make certain completion listings more compact by grouping matches.
For example, options for commands that have the same description (shown
when the <tt>verbose</tt> style is set to &lsquo;true&rsquo;) will appear as a single
entry.  However, menu selection can be used to cycle through all the
matches.
</p>
<a name="index-list_002dpacked_002c-completion-style"></a>
</dd>
<dt><tt>list-packed</tt></dt>
<dd><p>This is tested for each tag valid in the current context as well as the
<tt>default</tt> tag.  If it is set to &lsquo;true&rsquo;, the corresponding matches
appear in listings as if the <tt>LIST_PACKED</tt> option were set.  If it is
set to &lsquo;false&rsquo;, they are listed normally.
</p>
<a name="index-list_002dprompt_002c-completion-style"></a>
</dd>
<dt><tt>list-prompt</tt></dt>
<dd><p>If this style is set for the <tt>default</tt> tag,
completion lists that don&rsquo;t fit on the screen can be scrolled (see
<a href="Zsh-Modules.html#The-zsh_002fcomplist-Module">The zsh/complist Module</a>).  The value, if not the empty string, will be displayed after every
screenful and the shell will prompt for a key press; if the style is
set to the empty string,
a default prompt will be used.
</p>
<p>The value may contain the escape sequences:
&lsquo;<tt>%l</tt>&rsquo; or &lsquo;<tt>%L</tt>&rsquo;, which will be replaced by the number of the last line
displayed and the total number of lines; &lsquo;<tt>%m</tt>&rsquo; or &lsquo;<tt>%M</tt>&rsquo;, 
the number of the  last match shown and the total number of
matches; and &lsquo;<tt>%p</tt>&rsquo; and &lsquo;<tt>%P</tt>&rsquo;, &lsquo;<tt>Top</tt>&rsquo;
when at the beginning of the list, &lsquo;<tt>Bottom</tt>&rsquo; when at the end and the
position shown as a percentage of the total length otherwise.  In each
case the form with the uppercase letter will be replaced by a string of fixed
width, padded to the  right with spaces, while the lowercase form will
be replaced by a variable width string.  As in other prompt strings, the
escape sequences &lsquo;<tt>%S</tt>&rsquo;, &lsquo;<tt>%s</tt>&rsquo;, &lsquo;<tt>%B</tt>&rsquo;, &lsquo;<tt>%b</tt>&rsquo;, &lsquo;<tt>%U</tt>&rsquo;,
&lsquo;<tt>%u</tt>&rsquo; for entering and leaving the display modes
standout, bold and underline, and &lsquo;<tt>%F</tt>&rsquo;, &lsquo;<tt>%f</tt>&rsquo;, &lsquo;<tt>%K</tt>&rsquo;, &lsquo;<tt>%k</tt>&rsquo; for
changing the foreground background colour, are also available, as is the form
&lsquo;<tt>%{</tt>...<tt>%}</tt>&rsquo; for enclosing escape sequences which display with zero
(or, with a numeric argument, some other) width.
</p>
<p>After deleting this prompt the variable <tt>LISTPROMPT</tt> should be unset for
the removal to take effect.
</p>
<a name="index-list_002drows_002dfirst_002c-completion-style"></a>
</dd>
<dt><tt>list-rows-first</tt></dt>
<dd><p>This style is tested in the same way as the <tt>list-packed</tt> style and
determines whether matches are to be listed in a rows-first fashion as
if the <tt>LIST_ROWS_FIRST</tt> option were set.
</p>
<a name="index-list_002dsuffixes_002c-completion-style"></a>
</dd>
<dt><tt>list-suffixes</tt></dt>
<dd><p>This style is used by the function that completes filenames.  If it is
&lsquo;true&rsquo;, and completion is attempted on a string containing multiple partially
typed pathname components, all ambiguous components will be shown.
Otherwise, completion stops at the first ambiguous component.
</p>
<a name="index-list_002dseparator_002c-completion-style"></a>
</dd>
<dt><tt>list-separator</tt></dt>
<dd><p>The value of this style is used in completion listing to separate the
string to complete from a description when possible (e.g. when
completing options).  It defaults to &lsquo;<tt>-</tt><tt>-</tt>&rsquo; (two hyphens).
</p>
<a name="index-local_002c-completion-style"></a>
</dd>
<dt><tt>local</tt></dt>
<dd><p>This is for use with functions that complete URLs for which the
corresponding files are available directly from the file system.
Its value should consist of three strings: a
hostname, the path to the default web pages for the server, and the
directory name used by a user placing web pages within their home
area.
</p>
<p>For example:
</p>
<div class="example">
<pre class="example">zstyle ':completion:*' local toast \ 
    /var/http/public/toast public_html
</pre></div>

<p>Completion after &lsquo;<tt>http://toast/stuff/</tt>&rsquo; will look for files in the
directory <tt>/var/http/public/toast/stuff</tt>,  while completion after
&lsquo;<tt>http://toast/~yousir/</tt>&rsquo; will look for files in the directory
<tt>~yousir/public_html</tt>.
</p>
<a name="index-mail_002ddirectory_002c-completion-style"></a>
</dd>
<dt><tt>mail-directory</tt></dt>
<dd><p>If set, zsh will assume that mailbox files can be found in
the directory specified.  It defaults to &lsquo;<tt>~/Mail</tt>&rsquo;.
</p>
<a name="index-match_002doriginal_002c-completion-style"></a>
</dd>
<dt><tt>match-original</tt></dt>
<dd><p>This is used by the <tt>_match</tt> completer.  If it is set to
<tt>only</tt>, <tt>_match</tt> will try to generate matches without inserting a
&lsquo;<tt>*</tt>&rsquo; at the cursor position.  If set to any other non-empty value,
it will first try to generate matches without inserting the &lsquo;<tt>*</tt>&rsquo;
and if that yields no matches, it will try again with the &lsquo;<tt>*</tt>&rsquo;
inserted.  If it is unset or set to the empty string, matching will
only be performed with the &lsquo;<tt>*</tt>&rsquo; inserted.
</p>
<a name="index-matcher_002c-completion-style"></a>
</dd>
<dt><tt>matcher</tt></dt>
<dd><p>This style is tested separately for each tag valid in the current
context.  Its value is placed before any match specifications given by the
<tt>matcher-list</tt> style so can override them via the use of an <tt>x:</tt>
specification.  The value should be in the form described in
<a href="Completion-Widgets.html#Completion-Matching-Control">Completion Matching Control</a>.  For examples of this, see the description of the <tt>tag-order</tt> style.
</p>
<a name="index-matcher_002dlist_002c-completion-style"></a>
</dd>
<dt><tt>matcher-list</tt></dt>
<dd><p>This style can be set to a list of match specifications that are to
be applied everywhere. Match specifications are described in
<a href="Completion-Widgets.html#Completion-Matching-Control">Completion Matching Control</a>.
The completion system will try them one after another for each completer
selected.  For example, to try first simple completion and, if that
generates no matches, case-insensitive completion:
</p>
<div class="example">
<pre class="example">zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}'
</pre></div>

<p>By default each specification replaces the previous one; however, if a
specification is prefixed with <tt>+</tt>, it is added to the existing list.
Hence it is possible to create increasingly general specifications
without repetition:
</p>
<div class="example">
<pre class="example">zstyle ':completion:*' matcher-list \ 
       '' '+m:{a-z}={A-Z}' '+m:{A-Z}={a-z}'
</pre></div>

<p>It is possible to create match specifications valid for particular
completers by using the third field of the context.  This applies only
to completers that override the global matcher-list, which as of this
writing includes only <tt>_prefix</tt> and <tt>_ignored</tt>.  For example, to
use the completers <tt>_complete</tt> and <tt>_prefix</tt> but allow
case-insensitive completion only with <tt>_complete</tt>:
</p>
<div class="example">
<pre class="example">zstyle ':completion:*' completer _complete _prefix
zstyle ':completion:*:complete:*:*:*' matcher-list \ 
       '' 'm:{a-zA-Z}={A-Za-z}'
</pre></div>

<p>User-defined names, as explained for the <tt>completer</tt> style, are
available.  This makes it possible to try the same completer more than
once with different match specifications each time.  For example, to try
normal completion without a match specification, then normal completion
with case-insensitive matching, then correction, and finally
partial-word completion:
</p>
<div class="example">
<pre class="example">zstyle ':completion:*' completer \ 
    _complete _correct _complete:foo
zstyle ':completion:*:complete:*:*:*' matcher-list \ 
    '' 'm:{a-zA-Z}={A-Za-z}'
zstyle ':completion:*:foo:*:*:*' matcher-list \ 
    'm:{a-zA-Z}={A-Za-z} r:|[-_./]=* r:|=*'
</pre></div>

<p>If the style is unset in any context no match specification is applied.
Note also that some completers such as <tt>_correct</tt> and <tt>_approximate</tt>
do not use the match specifications at all, though these completers will
only ever be called once even if the <tt>matcher-list</tt> contains more than
one element.
</p>
<p>Where multiple specifications are useful, note that the <em>entire</em>
completion is done for each element of <tt>matcher-list</tt>, which can
quickly reduce the shell&rsquo;s performance.  As a rough rule of thumb,
one to three strings will give acceptable performance.  On the other
hand, putting multiple space-separated values into the same string does
not have an appreciable impact on performance.
</p>
<p>If there is no current matcher or it is empty, and the option
<tt>NO_CASE_GLOB</tt> is in effect, the matching for files is performed
case-insensitively in any case.  However, any matcher must
explicitly specify case-insensitive matching if that is required.
</p>
<a name="index-max_002derrors_002c-completion-style"></a>
</dd>
<dt><tt>max-errors</tt></dt>
<dd><p>This is used by the <tt>_approximate</tt> and <tt>_correct</tt> completer functions
to determine the maximum number of errors to allow.  The completer will try
to generate completions by first allowing one error, then two errors, and
so on, until either a match or matches were found or the maximum number of
errors given by this style has been reached.
</p>
<p>If the value for this style contains the string &lsquo;<tt>numeric</tt>&rsquo;, the 
completer function will take any numeric argument as the
maximum number of errors allowed. For example, with
</p>
<div class="example">
<pre class="example">zstyle ':completion:*:approximate:::' max-errors 2 numeric
</pre></div>

<p>two errors are allowed if no numeric argument is given, but with
a numeric argument of six (as in &lsquo;<tt>ESC-6 TAB</tt>&rsquo;), up to six
errors are accepted.  Hence with a value of &lsquo;<tt>0 numeric</tt>&rsquo;, no correcting
completion will be attempted unless a numeric argument is given.
</p>
<p>If the value contains the string &lsquo;<tt>not-numeric</tt>&rsquo;, the completer
will <em>not</em> try to generate corrected
completions when given a numeric argument, so in this case the number given
should be greater than zero.  For example, &lsquo;<tt>2 not-numeric</tt>&rsquo; specifies that
correcting completion with two errors will usually be performed, but if a
numeric argument is given, correcting completion will not be
performed.
</p>
<p>The default value for this style is &lsquo;<tt>2 numeric</tt>&rsquo;.
</p>
<a name="index-max_002dmatches_002dwidth_002c-completion-style"></a>
</dd>
<dt><tt>max-matches-width</tt></dt>
<dd><p>This style is used to determine the trade off between the width of the
display used for matches and the width used for their descriptions when
the <tt>verbose</tt> style is in effect.  The value gives the number of
display columns to reserve for the matches.  The default is half the
width of the screen.
</p>
<p>This has the most impact when several matches have the
same description and so will be grouped together.  Increasing the style
will allow more matches to be grouped together; decreasing it will allow
more of the description to be visible.
</p>
<a name="index-menu_002c-completion-style"></a>
</dd>
<dt><tt>menu</tt></dt>
<dd><p>If this is &lsquo;true&rsquo; in the context of any of the tags defined
for the current completion menu completion will be used.  The value for
a specific tag will take precedence over that for the &lsquo;<tt>default</tt>&rsquo; tag.
</p>
<p>If none of the values found in this way is &lsquo;true&rsquo; but at least
one is set to &lsquo;<tt>auto</tt>&rsquo;, the shell behaves as if the <tt>AUTO_MENU</tt>
option is set.
</p>
<p>If one of the values is explicitly set to &lsquo;false&rsquo;, menu
completion will be explicitly turned off, overriding the
<tt>MENU_COMPLETE</tt> option and other settings.
</p>
<p>In the form &lsquo;<tt>yes=</tt><var>num</var>&rsquo;, where &lsquo;<tt>yes</tt>&rsquo; may be any of the
&lsquo;true&rsquo; values (&lsquo;<tt>yes</tt>&rsquo;, &lsquo;<tt>true</tt>&rsquo;, &lsquo;<tt>on</tt>&rsquo; and &lsquo;<tt>1</tt>&rsquo;),
menu completion will be turned on if there are at least <var>num</var> matches.
In the form &lsquo;<tt>yes=long</tt>&rsquo;, menu completion will be turned on
if the list does not fit on the screen.  This does not activate menu
completion if the widget normally only lists completions, but menu
completion can be activated in that case with the value &lsquo;<tt>yes=long-list</tt>&rsquo;
(Typically, the value &lsquo;<tt>select=long-list</tt>&rsquo; described later is more
useful as it provides control over scrolling.)
</p>
<p>Similarly, with any of the &lsquo;false&rsquo; values (as in &lsquo;<tt>no=10</tt>&rsquo;), menu
completion will <em>not</em> be used if there are <var>num</var> or more matches.  
</p>
<p>The value of this widget also controls menu selection, as implemented by
the <tt>zsh/complist</tt> module.  The following values may appear either
alongside or instead of the values above.
</p>
<p>If the value contains the string &lsquo;<tt>select</tt>&rsquo;, menu selection
will be started unconditionally.
</p>
<p>In the form &lsquo;<tt>select=</tt><var>num</var>&rsquo;, menu selection will only be started if
there are at least <var>num</var> matches.  If the values for more than one
tag provide a number, the smallest number is taken.
</p>
<p>Menu selection can be turned off explicitly by defining a value
containing the string&lsquo;<tt>no-select</tt>&rsquo;.
</p>
<p>It is also possible to start menu selection only if the list of
matches does not fit on the screen by using the value
&lsquo;<tt>select=long</tt>&rsquo;.  To start menu selection even if the current widget
only performs listing, use the value &lsquo;<tt>select=long-list</tt>&rsquo;.
</p>
<p>To turn on menu completion or menu selection when a there are a certain
number of matches <em>or</em> the list of matches does not fit on the
screen, both of &lsquo;<tt>yes=</tt>&rsquo; and &lsquo;<tt>select=</tt>&rsquo; may be given twice, once
with a number and once with &lsquo;<tt>long</tt>&rsquo; or &lsquo;<tt>long-list</tt>&rsquo;.
</p>
<p>Finally, it is possible to activate two special modes of menu selection.
The word &lsquo;<tt>interactive</tt>&rsquo; in the value causes interactive mode
to be entered immediately when menu selection is started; see
<a href="Zsh-Modules.html#The-zsh_002fcomplist-Module">The zsh/complist Module</a>
for a description of interactive mode.  Including the string
&lsquo;<tt>search</tt>&rsquo; does the same for incremental search mode.  To select backward
incremental search, include the string &lsquo;<tt>search-backward</tt>&rsquo;.
</p>
<a name="index-muttrc_002c-completion-style"></a>
</dd>
<dt><tt>muttrc</tt></dt>
<dd><p>If set, gives the location of the mutt configuration file.  It defaults
to &lsquo;<tt>~/.muttrc</tt>&rsquo;.
</p>
<a name="index-numbers_002c-completion-style"></a>
</dd>
<dt><tt>numbers</tt></dt>
<dd><p>This is used with the <tt>jobs</tt> tag.  If it is &lsquo;true&rsquo;, the shell will
complete job numbers instead of the shortest unambiguous prefix
of the job command text.  If the value is a number, job numbers will
only be used if that many words from the job descriptions are required to
resolve ambiguities.  For example, if the value is &lsquo;<tt>1</tt>&rsquo;, strings will
only be used if all jobs differ in the first word on their command lines.
</p>
<a name="index-old_002dlist_002c-completion-style"></a>
</dd>
<dt><tt>old-list</tt></dt>
<dd><p>This is used by the <tt>_oldlist</tt> completer.  If it is set to &lsquo;<tt>always</tt>&rsquo;,
then standard widgets which perform listing will retain the current list of
matches, however they were generated; this can be turned off explicitly
with the value &lsquo;<tt>never</tt>&rsquo;, giving the behaviour without the <tt>_oldlist</tt>
completer.  If the style is unset, or any other value, then the existing
list of completions is displayed if it is not already; otherwise, the
standard completion list is generated; this is the default behaviour of
<tt>_oldlist</tt>.  However, if there is an old list and this style contains
the name of the completer function that generated the list, then the
old list will be used even if it was generated by a widget which does
not do listing.
</p>
<p>For example, suppose you type <tt>^Xc</tt> to use the <tt>_correct_word</tt>
widget, which generates a list of corrections for the word under the
cursor.  Usually, typing <tt>^D</tt> would generate a standard list of
completions for the word on the command line, and show that.  With
<tt>_oldlist</tt>, it will instead show the list of corrections already
generated.
</p>
<p>As another example consider the <tt>_match</tt> completer: with the
<tt>insert-unambiguous</tt> style set to &lsquo;true&rsquo; it inserts only a common prefix
string, if there is any.  However, this may remove parts of the original
pattern, so that further completion could produce more matches than on the
first attempt.  By using the <tt>_oldlist</tt> completer and setting this style
to <tt>_match</tt>, the list of matches generated on the first attempt will be
used again.
</p>
<a name="index-old_002dmatches_002c-completion-style"></a>
</dd>
<dt><tt>old-matches</tt></dt>
<dd><p>This is used by the <tt>_all_matches</tt> completer to decide if an old
list of matches should be used if one exists.  This is selected by one of
the &lsquo;true&rsquo; values or by the string &lsquo;<tt>only</tt>&rsquo;.  If
the value is &lsquo;<tt>only</tt>&rsquo;, <tt>_all_matches</tt> will only use an old list
and won&rsquo;t have any effect on the list of matches currently being
generated.
</p>
<p>If this style is set it is generally unwise to call the <tt>_all_matches</tt>
completer unconditionally.  One possible use is for either this style or
the <tt>completer</tt> style to be defined with the <tt>-e</tt> option to
<tt>zstyle</tt> to make the style conditional.
</p>
<a name="index-old_002dmenu_002c-completion-style"></a>
</dd>
<dt><tt>old-menu</tt></dt>
<dd><p>This is used by the <tt>_oldlist</tt> completer.  It controls how menu
completion behaves when a completion has already been inserted and the
user types a standard completion key such as <tt>TAB</tt>.  The default
behaviour of <tt>_oldlist</tt> is that menu completion always continues
with the existing list of completions.  If this style is set to
&lsquo;false&rsquo;, however, a new completion is started if the old list was
generated by a different completion command; this is the behaviour without
the <tt>_oldlist</tt> completer.
</p>
<p>For example, suppose you type <tt>^Xc</tt> to generate a list of corrections,
and menu completion is started in one of the usual ways.  Usually, or with
this style set to &lsquo;false&rsquo;, typing <tt>TAB</tt> at this point would start
trying to complete the line as it now appears.  With <tt>_oldlist</tt>, it
instead continues to cycle through the list of corrections.
</p>
<a name="index-original_002c-completion-style"></a>
</dd>
<dt><tt>original</tt></dt>
<dd><p>This is used by the <tt>_approximate</tt> and <tt>_correct</tt>
completers to decide if the original string should be added as
a possible completion.  Normally, this is done only if there are
at least two possible corrections, but if this style is set to &lsquo;true&rsquo;, it
is always added.  Note that the style will be examined with the
completer field in the context name set to <tt>correct-</tt><var>num</var> or
<tt>approximate-</tt><var>num</var>, where <var>num</var> is the number of errors that
were accepted.
</p>
<a name="index-packageset_002c-completion-style"></a>
</dd>
<dt><tt>packageset</tt></dt>
<dd><p>This style is used when completing arguments of the Debian &lsquo;<tt>dpkg</tt>&rsquo;
program.  It contains an override for the default package set
for a given context.  For example,
</p>
<div class="example">
<pre class="example">zstyle ':completion:*:complete:dpkg:option--status-1:*' \ 
               packageset avail
</pre></div>

<p>causes available packages, rather than only installed packages,
to be completed for &lsquo;<tt>dpkg -</tt><tt>-status</tt>&rsquo;.
</p>
<a name="index-path_002c-completion-style"></a>
</dd>
<dt><tt>path</tt></dt>
<dd><p>The function that completes color names uses this style with the 
<tt>colors</tt> tag.  The value should be the pathname of a file
containing color names in the format of an X11 <tt>rgb.txt</tt> file.  If
the style is not set but this file is found in one of various standard
locations it will be used as the default.
</p>
<a name="index-path_002dcompletion_002c-completion-style"></a>
</dd>
<dt><tt>path-completion</tt></dt>
<dd><p>This is used by filename completion.  By default, filename completion
examines all components of a path to see if there are completions of
that component.  For example, <tt>/u/b/z</tt> can be completed to
<tt>/usr/bin/zsh</tt>.  Explicitly setting this style to &lsquo;false&rsquo; inhibits this
behaviour for path components up to the <tt>/</tt> before the cursor; this
overrides the setting of <tt>accept-exact-dirs</tt>.
</p>
<p>Even with the style set to &lsquo;false&rsquo;, it is still possible to complete
multiple paths by setting the option <tt>COMPLETE_IN_WORD</tt> and moving the
cursor back to the first component in the path to be completed.  For
example, <tt>/u/b/z</tt> can be completed to <tt>/usr/bin/zsh</tt> if the cursor is
after the <tt>/u</tt>.
</p>
<a name="index-pine_002ddirectory_002c-completion-style"></a>
</dd>
<dt><tt>pine-directory</tt></dt>
<dd><p>If set, specifies the directory containing PINE mailbox files.  There
is no default, since recursively searching this directory is inconvenient
for anyone who doesn&rsquo;t use PINE.
</p>
<a name="index-ports_002c-completion-style"></a>
</dd>
<dt><tt>ports</tt></dt>
<dd><p>A list of Internet service names (network ports) to complete.  If this is
not set, service names are taken from the file &lsquo;<tt>/etc/services</tt>&rsquo;.
</p>
<a name="index-prefix_002dhidden_002c-completion-style"></a>
</dd>
<dt><tt>prefix-hidden</tt></dt>
<dd><p>This is used for certain completions which share a common prefix, for
example command options beginning with dashes.  If it is &lsquo;true&rsquo;, the
prefix will not be shown in the list of matches.
</p>
<p>The default value for this style is &lsquo;false&rsquo;.
</p>
<a name="index-prefix_002dneeded_002c-completion-style"></a>
</dd>
<dt><tt>prefix-needed</tt></dt>
<dd><p>This style is also relevant for matches with a common prefix.  If it is
set to &lsquo;true&rsquo; this common prefix must be typed by the user to generate
the matches.
</p>
<p>The style is applicable to the <tt>options</tt>, <tt>signals</tt>, <tt>jobs</tt>,
<tt>functions</tt>, and <tt>parameters</tt> completion tags.
</p>
<p>For command options, this means that the initial &lsquo;<tt>-</tt>&rsquo;, &lsquo;<tt>+</tt>&rsquo;, or
&lsquo;<tt>-</tt><tt>-</tt>&rsquo; must be typed explicitly before option names will be
completed.
</p>
<p>For signals, an initial &lsquo;<tt>-</tt>&rsquo; is required before signal names will
be completed.
</p>
<p>For jobs, an initial &lsquo;<tt>%</tt>&rsquo; is required before job names will be
completed.
</p>
<p>For function and parameter names, an initial &lsquo;<tt>_</tt>&rsquo; or &lsquo;<tt>.</tt>&rsquo; is
required before function or parameter names starting with those
characters will be completed.
</p>
<p>The default value for this style is &lsquo;false&rsquo; for <tt>function</tt> and
<tt>parameter</tt> completions, and  &lsquo;true&rsquo; otherwise.
</p>
<a name="index-preserve_002dprefix_002c-completion-style"></a>
</dd>
<dt><tt>preserve-prefix</tt></dt>
<dd><p>This style is used when completing path names.  Its value should be a
pattern matching an initial prefix of the word to complete that should
be left unchanged under all circumstances.  For example, on some Unices
an initial &lsquo;<tt>//</tt>&rsquo; (double slash) has a special meaning; setting
this style to the string &lsquo;<tt>//</tt>&rsquo; will preserve it.  As another example,
setting this style to &lsquo;<tt>?:/</tt>&rsquo; under Cygwin would allow completion
after &lsquo;<tt>a:/...</tt>&rsquo; and so on.
</p>
<a name="index-range_002c-completion-style"></a>
</dd>
<dt><tt>range</tt></dt>
<dd><p>This is used by the <tt>_history</tt> completer and the
<tt>_history_complete_word</tt> bindable command to decide which words
should be completed.  
</p>
<p>If it is a single number, only the last <var>N</var> words from the history
will be completed.
</p>
<p>If it is a range of the form &lsquo;<var>max</var><tt>:</tt><var>slice</var>&rsquo;,
the last <var>slice</var> words will be completed; then if that
yields no matches, the <var>slice</var> words before those will be tried and 
so on.  This process stops either when at least one match has been
found, or <var>max</var> words have been tried.
</p>
<p>The default is to complete all words from the history at once.
</p>
<a name="index-recursive_002dfiles_002c-completion-style"></a>
</dd>
<dt><tt>recursive-files</tt></dt>
<dd><p>If this style is set, its value is an array of patterns to be
tested against &lsquo;<tt>$PWD/</tt>&rsquo;: note the trailing slash, which allows
directories in the pattern to be delimited unambiguously by including
slashes on both sides.  If an ordinary file completion fails
and the word on the command line does not yet have a directory part to its
name, the style is retrieved using the same tag as for the completion
just attempted, then the elements tested against <tt>$PWD/</tt> in turn.
If one matches, then the shell reattempts completion by prepending the word
on the command line with each directory in the expansion of <tt>**/*(/)</tt>
in turn.  Typically the elements of the style will be set to restrict
the number of directories beneath the current one to a manageable
number, for example &lsquo;<tt>*/.git/*</tt>&rsquo;.
</p>
<p>For example,
</p>
<div class="example">
<pre class="example">zstyle ':completion:*' recursive-files '*/zsh/*'
</pre></div>

<p>If the current directory is <tt>/home/pws/zsh/Src</tt>, then
<tt>zle_tr</tt><em>TAB</em> can be completed to <tt>Zle/zle_tricky.c</tt>.
</p>
<a name="index-regular_002c-completion-style"></a>
</dd>
<dt><tt>regular</tt></dt>
<dd><p>This style is used by the <tt>_expand_alias</tt> completer and bindable 
command.  If set to &lsquo;true&rsquo; (the default), regular aliases will be
expanded but only in command position.  If it is set to &lsquo;false&rsquo;,
regular aliases will never be expanded.   If it is set to &lsquo;<tt>always</tt>&rsquo;,
regular aliases will be expanded even if not in command position.
</p>
<a name="index-rehash_002c-completion-style"></a>
</dd>
<dt><tt>rehash</tt></dt>
<dd><p>If this is set when completing external commands, the internal
list (hash) of commands will be updated for each search by issuing
the <tt>rehash</tt> command.  There is a speed penalty for this which
is only likely to be noticeable when directories in the path have
slow file access.
</p>
<a name="index-remote_002daccess_002c-completion-style"></a>
</dd>
<dt><tt>remote-access</tt></dt>
<dd><p>If set to &lsquo;false&rsquo;, certain commands will be prevented from making
Internet connections to retrieve remote information.  This includes the
completion for the <tt>CVS</tt> command.
</p>
<p>It is not always possible to know if connections are in fact to a remote
site, so some may be prevented unnecessarily.
</p>
<a name="index-remove_002dall_002ddups_002c-completion-style"></a>
</dd>
<dt><tt>remove-all-dups</tt></dt>
<dd><p>The <tt>_history_complete_word</tt> bindable command and the <tt>_history</tt>
completer use this to decide if all duplicate matches should be
removed, rather than just consecutive duplicates.
</p>
<a name="index-select_002dprompt_002c-completion-style"></a>
</dd>
<dt><tt>select-prompt</tt></dt>
<dd><p>If this is set for the <tt>default</tt> tag, its
value will be displayed during menu selection (see the <tt>menu</tt> style
above) when the completion list does not fit on the screen as a
whole.  The same escapes as for the <tt>list-prompt</tt> style are
understood, except that the numbers refer to the match or line the mark is
on.  A default prompt is used when the value is the empty string.
</p>
<a name="index-select_002dscroll_002c-completion-style"></a>
</dd>
<dt><tt>select-scroll</tt></dt>
<dd><p>This style is tested for the <tt>default</tt> tag and determines how a
completion list is scrolled during a menu selection (see the <tt>menu</tt>
style above) when the completion list does not fit on the screen as a
whole.  If the value is &lsquo;<tt>0</tt>&rsquo; (zero), the list is scrolled by
half-screenfuls; if it is a positive integer, the list is scrolled by the
given number of lines; if it is a negative number, the list is scrolled by a
screenful minus the absolute value of the given number of lines.
The default is to scroll by single lines.
</p>
<a name="index-separate_002dsections_002c-completion-style"></a>
</dd>
<dt><tt>separate-sections</tt></dt>
<dd><p>This style is used with the <tt>manuals</tt> tag when completing names of
manual pages.  If it is &lsquo;true&rsquo;, entries for different sections are
added separately using tag names of the form &lsquo;<tt>manual.</tt><var>X</var>&rsquo;,
where <var>X</var> is the section number.  When the <tt>group-name</tt> style is
also in effect, pages from different sections will appear separately.
This style is also used similarly with the <tt>words</tt> style when
completing words for the dict command. It allows words from different
dictionary databases to be added separately.
The default for this style is &lsquo;false&rsquo;.
</p>
<a name="index-show_002dambiguity_002c-completion-style"></a>
</dd>
<dt><tt>show-ambiguity</tt></dt>
<dd><p>If the <tt>zsh/complist</tt> module is loaded, this style can be used to
highlight the first ambiguous character in completion lists. The
value is either a color indication such as those supported by the
<tt>list-colors</tt> style or, with a value of &lsquo;true&rsquo;, a default of
underlining is selected. The highlighting is only applied if the
completion display strings correspond to the actual matches.
</p>
<a name="index-show_002dcompleter_002c-completion-style"></a>
</dd>
<dt><tt>show-completer</tt></dt>
<dd><p>Tested whenever a new completer is tried.  If it is &lsquo;true&rsquo;, the completion
system outputs a progress message in the listing area showing what
completer is being tried.  The message will be overwritten by any output
when completions are found and is removed after completion is finished.
</p>
<a name="index-single_002dignored_002c-completion-style"></a>
</dd>
<dt><tt>single-ignored</tt></dt>
<dd><p>This is used by the <tt>_ignored</tt> completer when there is only one match.
If its value is &lsquo;<tt>show</tt>&rsquo;, the single match will be
displayed but not inserted.  If the value is &lsquo;<tt>menu</tt>&rsquo;, then the single
match and the original string are both added as matches and menu completion
is started, making it easy to select either of them.
</p>
<a name="index-sort_002c-completion-style"></a>
</dd>
<dt><tt>sort</tt></dt>
<dd><p>Many completion widgets call <tt>_description</tt> at some point which
decides whether the matches are added sorted or unsorted (often
indirectly via <tt>_wanted</tt> or <tt>_requested</tt>).  This style can be set
explicitly to one of the usual &lsquo;true&rsquo; or &lsquo;false&rsquo; values as an override.
If it is not set for the context, the standard behaviour of the
calling widget is used.
</p>
<p>The style is tested first against the full context including the tag, and
if that fails to produce a value against the context without the tag.
</p>
<p>If the calling widget explicitly requests unsorted matches, this is usually
honoured.  However, the default (unsorted) behaviour of completion
for the command history may be overridden by setting the style to
&lsquo;true&rsquo;.
</p>
<p>In the <tt>_expand</tt> completer, if it is set to
&lsquo;true&rsquo;, the expansions generated will always be sorted.  If it is set
to &lsquo;<tt>menu</tt>&rsquo;, then the expansions are only sorted when they are offered 
as single strings but not in the string containing all possible
expansions.
</p>
<a name="index-special_002ddirs_002c-completion-style"></a>
</dd>
<dt><tt>special-dirs</tt></dt>
<dd><p>Normally, the completion code will not produce the directory names
&lsquo;<tt>.</tt>&rsquo; and &lsquo;<tt>..</tt>&rsquo; as possible completions.  If this style is set to
&lsquo;true&rsquo;, it will add both &lsquo;<tt>.</tt>&rsquo; and &lsquo;<tt>..</tt>&rsquo; as possible completions;
if it is set to &lsquo;<tt>..</tt>&rsquo;, only &lsquo;<tt>..</tt>&rsquo; will be added.
</p>
<p>The following example sets <tt>special-dirs</tt> to &lsquo;<tt>..</tt>&rsquo; when the
current prefix is empty, is a single &lsquo;<tt>.</tt>&rsquo;, or consists only of a path
beginning with &lsquo;<tt>../</tt>&rsquo;.  Otherwise the value is &lsquo;false&rsquo;.
</p>
<div class="example">
<pre class="example">zstyle -e ':completion:*' special-dirs \ 
   '[[ $PREFIX = (../)#(|.|..) ]] &amp;&amp; reply=(..)'
</pre></div>

<a name="index-squeeze_002dslashes_002c-completion-style"></a>
</dd>
<dt><tt>squeeze-slashes</tt></dt>
<dd><p>If set to &lsquo;true&rsquo;, sequences of slashes in filename paths (for example in
&lsquo;<tt>foo//bar</tt>&rsquo;) will be treated as a single slash.  This is the usual
behaviour of UNIX paths.  However, by default the file completion
function behaves as if there were a &lsquo;<tt>*</tt>&rsquo; between the slashes.
</p>
<a name="index-stop_002c-completion-style"></a>
</dd>
<dt><tt>stop</tt></dt>
<dd><p>If set to &lsquo;true&rsquo;, the <tt>_history_complete_word</tt> bindable
command will stop once when reaching the beginning or end of the
history.  Invoking <tt>_history_complete_word</tt> will then wrap around to 
the opposite end of the history.  If this style is set to &lsquo;false&rsquo; (the 
default), <tt>_history_complete_word</tt> will loop immediately as in a
menu completion.
</p>
<a name="index-strip_002dcomments_002c-completion-style"></a>
</dd>
<dt><tt>strip-comments</tt></dt>
<dd><p>If set to &lsquo;true&rsquo;, this style causes non-essential comment text to be
removed from completion matches.  Currently it is only used when
completing e-mail addresses where it removes any display name from the
addresses, cutting them down to plain <var>user@host</var> form.
</p>
<a name="index-subst_002dglobs_002donly_002c-completion-style"></a>
</dd>
<dt><tt>subst-globs-only</tt></dt>
<dd><p>This is used by the <tt>_expand</tt> completer.  If it is set to &lsquo;true&rsquo;,
the expansion will only be used if it resulted from globbing; hence,
if expansions resulted from the use of the <tt>substitute</tt> style
described below, but these were not further changed by globbing, the
expansions will be rejected.
</p>
<p>The default for this style is &lsquo;false&rsquo;.
</p>
<a name="index-substitute_002c-completion-style"></a>
</dd>
<dt><tt>substitute</tt></dt>
<dd><p>This boolean style controls whether the <tt>_expand</tt> completer will
first try to expand all substitutions in the string (such as
&lsquo;<tt>$(</tt><var>...</var><tt>)</tt>&rsquo; and &lsquo;<tt>${</tt><var>...</var><tt>}</tt>&rsquo;).
</p>
<p>The default is &lsquo;true&rsquo;.
</p>
<a name="index-suffix_002c-completion-style"></a>
</dd>
<dt><tt>suffix</tt></dt>
<dd><p>This is used by the <tt>_expand</tt> completer if the word starts with a
tilde or contains a parameter expansion.  If it is set to &lsquo;true&rsquo;, the
word will only be expanded if it doesn&rsquo;t have a suffix, i.e. if it is
something like &lsquo;<tt>~foo</tt>&rsquo; or &lsquo;<tt>$foo</tt>&rsquo; rather than &lsquo;<tt>~foo/</tt>&rsquo; or
&lsquo;<tt>$foo/bar</tt>&rsquo;, unless that suffix itself contains characters eligible
for expansion.  The default for this style is &lsquo;true&rsquo;.
</p>
<a name="index-tag_002dorder_002c-completion-style"></a>
</dd>
<dt><tt>tag-order</tt></dt>
<dd><p>This provides a mechanism for sorting how the tags available in a
particular context will be used.
</p>
<p>The values for the style are sets of space-separated lists of tags.
The tags in each value will be tried at the same time; if no match is
found, the next value is used.  (See the <tt>file-patterns</tt> style for
an exception to this behavior.)
</p>
<p>For example:
</p>
<div class="example">
<pre class="example">zstyle ':completion:*:complete:-command-:*:*' tag-order \ 
    'commands functions'
</pre></div>

<p>specifies that completion in command position first offers
external commands and shell functions.  Remaining tags will be tried if
no completions are found.
</p>
<p>In addition to tag names, each string in the value may take one of the
following forms:
</p>
<dl compact="compact">
<dt><tt>-</tt></dt>
<dd><p>If any value consists of only a hyphen,
then <em>only</em> the tags specified in the other values are
generated.  Normally all tags not explicitly selected are tried last
if the specified tags fail to generate any matches.  This means 
that a single value consisting only of a single hyphen
turns off completion.
</p>
</dd>
<dt><tt>!</tt> <var>tags</var>...</dt>
<dd><p>A string starting with an exclamation mark
specifies names of tags that are <em>not</em> to be used.  The effect is
the same as if all other possible tags for the context had been
listed.
</p>
</dd>
<dt><var>tag</var><tt>:</tt><var>label</var> ...</dt>
<dd><p>Here, <var>tag</var> is one of the standard tags and <var>label</var> is an
arbitrary name.  Matches are generated as normal but the name <var>label</var>
is used in contexts instead of <var>tag</var>.  This is not useful in words
starting with <tt>!</tt>.
</p>
<p>If the <var>label</var> starts with a hyphen, the <var>tag</var> is prepended to the
<var>label</var> to form the name used for lookup.  This can be
used to make the completion system try a certain tag more than once,
supplying different style settings for each attempt; see below for an
example.
</p>
</dd>
<dt><var>tag</var><tt>:</tt><var>label</var><tt>:</tt><var>description</var></dt>
<dd><p>As before, but <tt>description</tt> will replace the &lsquo;<tt>%d</tt>&rsquo; in
the value of the <tt>format</tt> style instead of the default description
supplied by the completion function.  Spaces in the description must
be quoted with a backslash.  A &lsquo;<tt>%d</tt>&rsquo; appearing
in <var>description</var> is replaced with the description given by the
completion function.
</p>
</dd>
</dl>

<p>In any of the forms above the tag may be a pattern or several
patterns in the form &lsquo;<tt>{</tt><var>pat1</var><tt>,</tt><var>pat2...</var><tt>}</tt>&rsquo;.  In this
case all matching tags will be used except 
for any given explicitly in the same string.
</p>
<p>One use of these features is to try
one tag more than once, setting other styles differently on
each attempt, but still to use all the other tags without having to
repeat them all.  For example, to make completion of function names in
command position ignore all the completion functions starting with an
underscore the first time completion is tried:
</p>
<div class="example">
<pre class="example">zstyle ':completion:*:*:-command-:*:*' tag-order \ 
    'functions:-non-comp *' functions
zstyle ':completion:*:functions-non-comp' \ 
    ignored-patterns '_*'
</pre></div>

<p>On the first attempt, all tags will be offered but the <tt>functions</tt> tag
will be replaced by <tt>functions-non-comp</tt>.  The <tt>ignored-patterns</tt> style 
is set for this tag to exclude functions starting with an underscore.
If there are no matches, the second value of the
<tt>tag-order</tt> style is used which completes functions using the default
tag, this time presumably including all function names.
</p>
<p>The matches for one tag can be split into different groups.  For example:
</p>
<div class="example">
<pre class="example">zstyle ':completion:*' tag-order \ 
    'options:-long:long\ options
     options:-short:short\ options
     options:-single-letter:single\ letter\ options'
zstyle ':completion:*:options-long' \ 
     ignored-patterns '[-+](|-|[^-]*)'
zstyle ':completion:*:options-short' \ 
     ignored-patterns '--*' '[-+]?'
zstyle ':completion:*:options-single-letter' \ 
     ignored-patterns '???*'
</pre></div>

<p>With the <tt>group-names</tt> style set, options beginning with
&lsquo;<tt>-</tt><tt>-</tt>&rsquo;, options beginning with a single &lsquo;<tt>-</tt>&rsquo; or &lsquo;<tt>+</tt>&rsquo; but
containing multiple characters, and single-letter options will be
displayed in separate groups with different descriptions.
</p>
<p>Another use of patterns is to
try multiple match specifications one after another.  The
<tt>matcher-list</tt> style offers something similar, but it is tested very
early in the completion system and hence can&rsquo;t be set for single
commands nor for more specific contexts.  Here is how to
try normal completion without any match specification and, if that
generates no matches, try again with case-insensitive matching, restricting
the effect to arguments of the command <tt>foo</tt>:
</p>
<div class="example">
<pre class="example">zstyle ':completion:*:*:foo:*:*' tag-order '*' '*:-case'
zstyle ':completion:*-case' matcher 'm:{a-z}={A-Z}'
</pre></div>

<p>First, all the tags offered when completing after <tt>foo</tt> are tried using
the normal tag name.  If that generates no matches, the second value of
<tt>tag-order</tt> is used, which tries all tags again except that this time
each has <tt>-case</tt> appended to its name for lookup of styles.  Hence this
time the value for the <tt>matcher</tt> style from the second call to <tt>zstyle</tt>
in the example is used to make completion case-insensitive.
</p>
<p>It is possible to use the <tt>-e</tt> option of the <tt>zstyle</tt> builtin
command to specify conditions for the use of particular tags.  For
example:
</p>
<div class="example">
<pre class="example">zstyle -e '*:-command-:*' tag-order '
    if [[ -n $PREFIX$SUFFIX ]]; then
      reply=( )
    else
      reply=( - )
    fi'
</pre></div>

<p>Completion in command position will be attempted only if the string
typed so far is not empty.  This is tested using the <tt>PREFIX</tt>
special parameter; see
<a href="Completion-Widgets.html#Completion-Widgets">Completion Widgets</a>
for a description of parameters which are special inside completion widgets.
Setting <tt>reply</tt> to an empty array provides the default
behaviour of trying all tags at once; setting it to an
array containing only a hyphen disables the use of all tags and hence of
all completions.
</p>
<p>If no <tt>tag-order</tt> style has been defined for a context, the strings
&lsquo;<tt>(|*-)argument-* (|*-)option-* values</tt>&rsquo; and &lsquo;<tt>options</tt>&rsquo; plus all
tags offered by the completion function will be used to provide a
sensible default behavior that causes arguments (whether normal command
arguments or arguments of options) to be completed before option names for
most commands.
</p>
<a name="index-urls_002c-completion-style"></a>
</dd>
<dt><tt>urls</tt></dt>
<dd><p>This is used together with the <tt>urls</tt> tag by
functions completing URLs.
</p>
<p>If the value consists of more than one string, or if the only string
does not name a file or directory, the strings are used as the URLs to
complete.
</p>
<p>If the value contains only one string which is the name of a normal 
file the URLs are taken from that file (where the URLs may be
separated by white space or newlines).
</p>
<p>Finally, if the only string in the value names a directory, the
directory hierarchy rooted at this directory gives the completions.  The
top level directory should be the file access method, such as
&lsquo;<tt>http</tt>&rsquo;, &lsquo;<tt>ftp</tt>&rsquo;, &lsquo;<tt>bookmark</tt>&rsquo; and so on.  In many cases the next
level of directories will be a filename.  The directory hierarchy can
descend as deep as necessary.
</p>
<p>For example, 
</p>
<div class="example">
<pre class="example">zstyle ':completion:*' urls ~/.urls
mkdir -p ~/.urls/ftp/ftp.zsh.org/pub

</pre></div>

<p>allows completion of all the components of the URL
<tt>ftp://ftp.zsh.org/pub</tt> after suitable commands such as
&lsquo;<tt>netscape</tt>&rsquo; or &lsquo;<tt>lynx</tt>&rsquo;.  Note, however, that access methods and
files are completed separately, so if the <tt>hosts</tt> style is set hosts
can be completed without reference to the <tt>urls</tt> style.
</p>
<p>See the description in the function <tt>_urls</tt> itself
for more information (e.g. &lsquo;<tt>more $^fpath/_urls(N)</tt>&rsquo;).
</p>
<a name="index-use_002dcache_002c-completion-style"></a>
</dd>
<dt><tt>use-cache</tt></dt>
<dd><p>If this is set, the completion caching layer is activated for any completions
which use it (via the <tt>_store_cache</tt>, <tt>_retrieve_cache</tt>, and
<tt>_cache_invalid</tt> functions).  The directory containing the cache
files can be changed with the <tt>cache-path</tt> style.
</p>
<a name="index-use_002dcompctl_002c-completion-style"></a>
</dd>
<dt><tt>use-compctl</tt></dt>
<dd><p>If this style is set to a string <em>not</em> equal to <tt>false</tt>, <tt>0</tt>,
<tt>no</tt>, and <tt>off</tt>, the completion system may use any completion
specifications defined with the <tt>compctl</tt> builtin command.  If the
style is unset, this is done only if the <tt>zsh/compctl</tt> module
is loaded.  The string may also contain the substring &lsquo;<tt>first</tt>&rsquo; to
use completions defined with &lsquo;<tt>compctl -T</tt>&rsquo;, and the substring
&lsquo;<tt>default</tt>&rsquo; to use the completion defined with &lsquo;<tt>compctl -D</tt>&rsquo;.
</p>
<p>Note that this is only intended to smooth the transition from
<tt>compctl</tt> to the new completion system and may disappear in the
future.
</p>
<p>Note also that the definitions from <tt>compctl</tt> will only be used if
there is no specific completion function for the command in question.  For
example, if there is a function <tt>_foo</tt> to complete arguments to the
command <tt>foo</tt>, <tt>compctl</tt> will never be invoked for <tt>foo</tt>.
However, the <tt>compctl</tt> version will be tried if <tt>foo</tt> only uses
default completion.
</p>
<a name="index-use_002dip_002c-completion-style"></a>
</dd>
<dt><tt>use-ip</tt></dt>
<dd><p>By default, the function <tt>_hosts</tt> that completes host names strips
IP addresses from entries read from host databases such as NIS and
ssh files.  If this style is &lsquo;true&rsquo;, the corresponding IP addresses
can be completed as well.  This style is not use in any context
where the <tt>hosts</tt> style is set; note also it must be set before
the cache of host names is generated (typically the first completion
attempt).
</p>
<a name="index-users_002c-completion-style"></a>
</dd>
<dt><tt>users</tt></dt>
<dd><p>This may be set to a list of usernames to be completed.
If it is not set all usernames will be completed.
Note that if it is set only that list of users will be completed;
this is because on some systems querying all users can take
a prohibitive amount of time.
</p>
<a name="index-users_002dhosts_002c-completion-style"></a>
</dd>
<dt><tt>users-hosts</tt></dt>
<dd><p>The values of this style should be of the form
&lsquo;<var>user</var><tt>@</tt><var>host</var>&rsquo; or &lsquo;<var>user</var><tt>:</tt><var>host</var>&rsquo;. It is used for
commands that need pairs of
user- and hostnames.  These commands will complete usernames from this
style (only), and will restrict subsequent hostname completion to hosts
paired with that user in one of the values of the style.
</p>
<p>It is possible to group values for sets of commands which allow a remote
login, such as <tt>rlogin</tt> and <tt>ssh</tt>, by using the <tt>my-accounts</tt> tag.
Similarly, values for sets of commands which usually refer to the
accounts of other people, such as <tt>talk</tt> and <tt>finger</tt>, can be
grouped by using the <tt>other-accounts</tt> tag.  More ambivalent commands
may use the <tt>accounts</tt> tag.
</p>
<a name="index-users_002dhosts_002dports_002c-completion-style"></a>
</dd>
<dt><tt>users-hosts-ports</tt></dt>
<dd><p>Like <tt>users-hosts</tt> but used for commands like <tt>telnet</tt> and
containing strings of the form &lsquo;<var>user</var><tt>@</tt><var>host</var><tt>:</tt><var>port</var>&rsquo;.
</p>
<a name="index-verbose_002c-completion-style"></a>
</dd>
<dt><tt>verbose</tt></dt>
<dd><p>If set, as it is by default, the completion listing is more verbose.
In particular many commands show descriptions for options if this
style is &lsquo;true&rsquo;.
</p>
<a name="index-word_002c-completion-style"></a>
</dd>
<dt><tt>word</tt></dt>
<dd><p>This is used by the <tt>_list</tt> completer, which prevents the insertion of
completions until a second completion attempt when the line has not
changed.  The normal way of finding out if the line has changed is to
compare its entire contents between the two occasions.  If this style is
&lsquo;true&rsquo;, the comparison is instead performed only on the current word.
Hence if completion is performed on another word with the same contents,
completion will not be delayed.
</p>
</dd>
</dl>

<hr>
<a name="Control-Functions"></a>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Completion-System" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Standard-Styles" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Completion-System" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Bindable-Commands" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left">[<a href="Completion-Using-compctl.html#Completion-Using-compctl" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="index.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="zsh_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="Concept-Index.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="zsh_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>

<a name="Control-Functions-1"></a>
<h2 class="section">20.4 Control Functions</h2>
<p><a name="index-completion-system_002c-choosing-completers"></a>
</p>
<p>The initialization script <tt>compinit</tt> redefines all the widgets
which perform completion to call the supplied widget function
<tt>_main_complete</tt>.  This function acts as a wrapper calling the
so-called &lsquo;completer&rsquo; functions that generate matches.  If
<tt>_main_complete</tt> is called with arguments, these are taken as the
names of completer functions to be called in the order given.  If no
arguments are given, the set of functions to try is taken from the
<tt>completer</tt> style.  For example, to use normal completion and
correction if that doesn&rsquo;t generate any matches:
</p>
<div class="example">
<pre class="example">zstyle ':completion:*' completer _complete _correct
</pre></div>

<p>after calling <tt>compinit</tt>. The default value for this style is
&lsquo;<tt>_complete _ignored</tt>&rsquo;, i.e. normally only ordinary completion is tried,
first with the effect of the <tt>ignored-patterns</tt> style and then without
it.  The <tt>_main_complete</tt> function uses the return status of the completer
functions to decide if other completers should be called.  If the return
status is zero, no other completers are tried and the <tt>_main_complete</tt>
function returns.
</p>
<p>If the first argument to <tt>_main_complete</tt> is a single hyphen, the
arguments will not be taken as names of completers.  Instead, the
second argument gives a name to use in the <var>completer</var> field of the 
context and the other arguments give a command name and arguments to
call to generate the matches.
</p>
<p>The following completer functions are contained in the distribution,
although users may write their own.  Note that in contexts the leading
underscore is stripped, for example basic completion is performed in the
context &lsquo;<tt>:completion::complete:</tt><var>...</var>&rsquo;.
</p>
<p><a name="index-completion-system_002c-completers"></a>
</p><dl compact="compact">
<dd><a name="index-_005fall_005fmatches"></a>
</dd>
<dt><tt>_all_matches</tt></dt>
<dd><p>This completer can be used to add a string consisting of all other
matches.  As it influences later completers it must appear as the first
completer in the list.  The list of all matches is affected by the
<tt>avoid-completer</tt> and <tt>old-matches</tt> styles described above.
</p>
<p>It may be useful to use the <tt>_generic</tt> function described below
to bind <tt>_all_matches</tt> to its own keystroke, for example:
</p>
<div class="example">
<pre class="example">zle -C all-matches complete-word _generic
bindkey '^Xa' all-matches
zstyle ':completion:all-matches:*' old-matches only
zstyle ':completion:all-matches::::' completer _all_matches
</pre></div>

<p>Note that this does not generate completions by itself:  first use
any of the standard ways of generating a list of completions,
then use <tt>^Xa</tt> to show all matches.  It is possible instead to
add a standard completer to the list and request that the
list of all matches should be directly inserted:
</p>
<div class="example">
<pre class="example">zstyle ':completion:all-matches::::' completer \ 
       _all_matches _complete
zstyle ':completion:all-matches:*' insert true
</pre></div>

<p>In this case the <tt>old-matches</tt> style should not be set.
</p>
<a name="index-_005fapproximate"></a>
</dd>
<dt><tt>_approximate</tt></dt>
<dd><p>This is similar to the basic <tt>_complete</tt> completer but allows the
completions to undergo corrections.  The maximum number of errors can be
specified by the <tt>max-errors</tt> style; see the description of
approximate matching in
<a href="Expansion.html#Filename-Generation">Filename Generation</a>
for how errors are counted.  Normally this completer will only be tried
after the normal <tt>_complete</tt> completer:
</p>
<div class="example">
<pre class="example">zstyle ':completion:*' completer _complete _approximate
</pre></div>

<p>This will give correcting completion if and only if
normal completion yields no possible completions.  When
corrected completions are found, the completer will normally start
menu completion allowing you to cycle through these strings.
</p>
<p>This completer uses the tags <tt>corrections</tt> and <tt>original</tt> when
generating the possible corrections and the original string.  The
<tt>format</tt> style for the former may contain the additional sequences
&lsquo;<tt>%e</tt>&rsquo; and &lsquo;<tt>%o</tt>&rsquo; which will be replaced by the number of errors
accepted to generate the corrections and the original string,
respectively.
</p>
<p>The completer progressively increases the number of errors allowed up to
the limit by the <tt>max-errors</tt> style, hence if a completion is found
with one error, no completions with two errors will be shown, and so on.
It modifies the completer name in the context to indicate the number of
errors being tried: on the first try the completer field contains
&lsquo;<tt>approximate-1</tt>&rsquo;, on the second try &lsquo;<tt>approximate-2</tt>&rsquo;, and so on.
</p>
<p>When <tt>_approximate</tt> is called from another function, the number of
errors to accept may be passed with the <tt>-a</tt> option.  The argument
is in the same format as the <tt>max-errors</tt> style, all in one string.
</p>
<p>Note that this completer (and the <tt>_correct</tt> completer mentioned
below) can be quite expensive to call, especially when a large number
of errors are allowed.  One way to avoid this is to set up the
<tt>completer</tt> style using the <tt>-e</tt> option to zstyle so that some
completers are only used when completion is attempted a second time on 
the same string, e.g.:
</p>
<div class="example">
<pre class="example">zstyle -e ':completion:*' completer '
  if [[ $_last_try != &quot;$HISTNO$BUFFER$CURSOR&quot; ]]; then
    _last_try=&quot;$HISTNO$BUFFER$CURSOR&quot;
    reply=(_complete _match _prefix)
  else
    reply=(_ignored _correct _approximate)
  fi'
</pre></div>

<p>This uses the <tt>HISTNO</tt> parameter and the <tt>BUFFER</tt> and <tt>CURSOR</tt>
special parameters that are available inside zle and completion
widgets to find out if the command line hasn&rsquo;t changed since the last
time completion was tried.  Only then are the <tt>_ignored</tt>,
<tt>_correct</tt> and <tt>_approximate</tt> completers called.
</p>
<a name="index-_005fcanonical_005fpaths"></a>
</dd>
<dt><tt>_canonical_paths</tt> [ <tt>-A</tt> <var>var</var> ] [ <tt>-N</tt> ] [ <tt>-MJV12nfX</tt> ] <var>tag</var> <var>descr</var> [ <var>paths</var> ... ]</dt>
<dd><p>This completion function completes all paths given to it, and also tries to
offer completions which point to the same file as one of the paths given
(relative path when an absolute path is given, and vice versa; when <tt>..</tt>&rsquo;s
are present in the word to be completed; and some paths got from symlinks).
</p>
<p><tt>-A</tt>, if specified, takes the paths from the array variable specified. Paths can
also be specified on the command line as shown above.  <tt>-N</tt>, if specified,
prevents canonicalizing the paths given before using them for completion, in
case they are already so. The options <tt>-M</tt>, <tt>-J</tt>, <tt>-V</tt>, <tt>-1</tt>, <tt>-2</tt>,
<tt>-n</tt>, <tt>-F</tt>, <tt>-X</tt> are passed to <tt>compadd</tt>.
</p>
<p>See <tt>_description</tt> for a description of <var>tag</var> and <var>descr</var>.
</p>
<a name="index-_005fcomplete"></a>
</dd>
<dt><tt>_complete</tt></dt>
<dd><p>This completer generates all possible completions in a context-sensitive
manner, i.e. using the settings defined with the <tt>compdef</tt> function
explained above and the current settings of all special parameters.
This gives the normal completion behaviour.
</p>
<p>To complete arguments of commands, <tt>_complete</tt> uses the utility function
<tt>_normal</tt>, which is in turn responsible for finding the particular
function; it is described below.  Various contexts of the form
<tt>-</tt><var>context</var><tt>-</tt> are handled specifically. These are all
mentioned above as possible arguments to the <tt>#compdef</tt> tag.
</p>
<p>Before trying to find a function for a specific context, <tt>_complete</tt> 
checks if the parameter &lsquo;<tt>compcontext</tt>&rsquo; is set. Setting
&lsquo;<tt>compcontext</tt>&rsquo; allows the usual completion dispatching to be
overridden which is useful in places such as a function that uses
<tt>vared</tt> for input. If it is set to an array, the elements are taken
to be the possible matches which will be completed using the tag
&lsquo;<tt>values</tt>&rsquo; and the description &lsquo;<tt>value</tt>&rsquo;. If it is set to an
associative array, the keys are used as the possible completions and
the values (if non-empty) are used as descriptions for the matches.  If
&lsquo;<tt>compcontext</tt>&rsquo; is set to a string containing colons, it should be of
the form &lsquo;<var>tag</var><tt>:</tt><var>descr</var><tt>:</tt><var>action</var>&rsquo;.  In this case the
<var>tag</var> and <var>descr</var> give the tag and description to use and the
<var>action</var> indicates what should be completed in one of the forms
accepted by the <tt>_arguments</tt> utility function described below.
</p>
<p>Finally, if &lsquo;<tt>compcontext</tt>&rsquo; is set to a string without colons, the
value is taken as the name of the context to use and the function
defined for that context will be called.  For this purpose, there is a
special context named <tt>-command-line-</tt> that completes whole command
lines (commands and their arguments).  This is not used by the completion
system itself but is nonetheless handled when explicitly called.
</p>
<a name="index-_005fcorrect"></a>
</dd>
<dt><tt>_correct</tt></dt>
<dd><p>Generate corrections, but not completions, for the current word; this is
similar to <tt>_approximate</tt> but will not allow any number of extra
characters at the cursor as that completer does.  The effect is
similar to spell-checking.  It is based on <tt>_approximate</tt>, but the
completer field in the context name is <tt>correct</tt>.
</p>
<p>For example, with:
</p>
<div class="example">
<pre class="example">zstyle ':completion:::::' completer \ 
       _complete _correct _approximate
zstyle ':completion:*:correct:::' max-errors 2 not-numeric
zstyle ':completion:*:approximate:::' max-errors 3 numeric
</pre></div>

<p>correction will accept up to two errors.  If a numeric argument is
given, correction will not be performed, but correcting completion
will be, and will accept as many errors as given by the numeric
argument.  Without a numeric argument, first correction and then
correcting completion will be tried, with the first one accepting two
errors and the second one accepting three errors.
</p>
<p>When <tt>_correct</tt> is called as a function, the number of errors to accept
may be given following the <tt>-a</tt> option.  The argument is in the same
form a values to the <tt>accept</tt> style, all in one string.
</p>
<p>This completer function is intended to be used without the
<tt>_approximate</tt> completer or, as in the example, just before
it.  Using it after the <tt>_approximate</tt> completer is useless since
<tt>_approximate</tt> will at least generate the corrected strings
generated by the <tt>_correct</tt> completer &mdash; and probably more.
</p>
<a name="index-_005fexpand"></a>
</dd>
<dt><tt>_expand</tt></dt>
<dd><p>This completer function does not really perform completion, but instead
checks if the word on the command line is eligible for expansion and,
if it is, gives detailed control over how this expansion is done.  For
this to happen, the completion system needs to be invoked with
<tt>complete-word</tt>, not <tt>expand-or-complete</tt> (the default binding for
<tt>TAB</tt>), as otherwise the string will be expanded by the shell&rsquo;s
internal mechanism before the completion system is started.
Note also this completer should be called before the <tt>_complete</tt> 
completer function.
</p>
<p>The tags used when generating expansions are <tt>all-expansions</tt> for the
string containing all possible expansions, <tt>expansions</tt> when adding
the possible expansions as single matches and <tt>original</tt> when adding
the original string from the line.  The order in which these strings are
generated, if at all, can be controlled by the <tt>group-order</tt> and
<tt>tag-order</tt> styles, as usual.
</p>
<p>The format string for <tt>all-expansions</tt> and for <tt>expansions</tt> may
contain the sequence &lsquo;<tt>%o</tt>&rsquo; which will be replaced by the original
string from the line.
</p>
<p>The kind of expansion to be tried is controlled by the <tt>substitute</tt>,
<tt>glob</tt> and <tt>subst-globs-only</tt> styles.
</p>
<p>It is also possible to call <tt>_expand</tt> as a function, in which case the
different modes may be selected with options: <tt>-s</tt> for
<tt>substitute</tt>, <tt>-g</tt> for <tt>glob</tt> and <tt>-o</tt> for <tt>subst-globs-only</tt>.
</p>
<a name="index-_005fexpand_005falias"></a>
</dd>
<dt><tt>_expand_alias</tt></dt>
<dd><p>If the word the cursor is on is an alias, it is expanded and no other
completers are called.  The types of aliases which are to be expanded can
be controlled with the styles <tt>regular</tt>, <tt>global</tt> and <tt>disabled</tt>.
</p>
<p>This function is also a bindable command, see
<a href="#Bindable-Commands">Bindable Commands</a>.
</p>
<a name="index-_005fextensions"></a>
</dd>
<dt><tt>_extensions</tt></dt>
<dd><p>If the cursor follows the string &lsquo;<tt>*.</tt>&rsquo;, filename extensions are
completed. The extensions are taken from files in current directory or a
directory specified at the beginning of the current word. For exact matches,
completion continues to allow other completers such as <tt>_expand</tt> to
expand the pattern. The standard <tt>add-space</tt> and <tt>prefix-hidden</tt>
styles are observed.
</p>
<a name="index-_005fexternal_005fpwds"></a>
</dd>
<dt><tt>_external_pwds</tt></dt>
<dd><p>Completes current directories of other zsh processes belonging to the
current user.
</p>
<p>This is intended to be used via <tt>_generic</tt>, bound to a custom key
combination. Note that pattern matching is enabled so matching is
performed similar to how it works with the <tt>_match</tt> completer.
</p>
<a name="index-_005fhistory"></a>
</dd>
<dt><tt>_history</tt></dt>
<dd><p>Complete words from the shell&rsquo;s command  history.  This completer 
can be controlled by the <tt>remove-all-dups</tt>, and <tt>sort</tt> styles as for the
<tt>_history_complete_word</tt> bindable command, see
<a href="#Bindable-Commands">Bindable Commands</a>
and
<a href="#Completion-System-Configuration">Completion System Configuration</a>.
</p>
<a name="index-_005fignored"></a>
</dd>
<dt><tt>_ignored</tt></dt>
<dd><p>The <tt>ignored-patterns</tt> style can be set to a list of patterns which are
compared against possible completions; matching ones are removed.
With this completer those matches can be reinstated, as
if no <tt>ignored-patterns</tt> style were set.  The completer actually
generates its own list of matches; which completers are invoked
is determined in the same way as for the <tt>_prefix</tt> completer.
The <tt>single-ignored</tt> style is also available as described above.
</p>
<a name="index-_005flist"></a>
</dd>
<dt><tt>_list</tt></dt>
<dd><p>This completer allows the insertion of matches to be delayed until
completion is attempted a second time without the word on the line
being changed.  On the first attempt, only the list of matches will be
shown.  It is affected by the styles <tt>condition</tt> and <tt>word</tt>, see
<a href="#Completion-System-Configuration">Completion System Configuration</a>.
</p>
<a name="index-_005fmatch"></a>
</dd>
<dt><tt>_match</tt></dt>
<dd><p>This completer is intended to be used after the <tt>_complete</tt>
completer.  It behaves similarly but the string on the command line may
be a pattern to match against trial completions.  This gives the effect
of the <tt>GLOB_COMPLETE</tt> option.
</p>
<p>Normally completion will be performed by taking the pattern from the line,
inserting a &lsquo;<tt>*</tt>&rsquo; at the cursor position and comparing the resulting
pattern with the possible completions generated.  This can be modified
with the <tt>match-original</tt> style described above.
</p>
<p>The generated matches will be offered in a menu completion unless the
<tt>insert-unambiguous</tt> style is set to &lsquo;true&rsquo;; see the description above
for other options for this style.
</p>
<p>Note that matcher specifications defined globally or used by the
completion functions (the styles <tt>matcher-list</tt> and <tt>matcher</tt>) will
not be used.
</p>
<a name="index-_005fmenu"></a>
</dd>
<dt><tt>_menu</tt></dt>
<dd><p>This completer was written as simple example function to show how menu
completion can be enabled in shell code. However, it has the notable
effect of disabling menu selection which can be useful with
<tt>_generic</tt> based widgets. It should be used as the first completer in
the list.  Note that this is independent of the setting of the
<tt>MENU_COMPLETE</tt> option and does not work with the other menu
completion widgets such as <tt>reverse-menu-complete</tt>, or
<tt>accept-and-menu-complete</tt>.
</p>
<a name="index-_005foldlist"></a>
</dd>
<dt><tt>_oldlist</tt></dt>
<dd><p>This completer controls how the standard completion widgets behave
when there is an existing list of completions which may have been
generated by a special completion (i.e. a separately-bound completion
command).  It allows the ordinary completion keys to continue to use the
list of completions thus generated, instead of producing a new list of
ordinary contextual completions.
It should appear in the list of completers before any of
the widgets which generate matches.  It uses two styles: <tt>old-list</tt> and
<tt>old-menu</tt>, see
<a href="#Completion-System-Configuration">Completion System Configuration</a>.
</p>
<a name="index-_005fprefix"></a>
</dd>
<dt><tt>_prefix</tt></dt>
<dd><p>This completer can be used to try completion with the suffix (everything
after the cursor) ignored.  In other words, the suffix will not be
considered to be part of the word to complete.  The effect is similar
to the <tt>expand-or-complete-prefix</tt> command.
</p>
<p>The <tt>completer</tt> style is used to decide which other completers are to
be called to generate matches.  If this style is unset, the list of
completers set for the current context is used &mdash; except, of course, the
<tt>_prefix</tt> completer itself.  Furthermore, if this completer appears
more than once in the list of completers only those completers not
already tried by the last invocation of <tt>_prefix</tt> will be called.
</p>
<p>For example, consider this global <tt>completer</tt> style:
</p>
<div class="example">
<pre class="example">zstyle ':completion:*' completer \ 
    _complete _prefix _correct _prefix:foo
</pre></div>

<p>Here, the <tt>_prefix</tt> completer tries normal completion but ignoring the
suffix.  If that doesn&rsquo;t generate any matches, and neither does
the call to the <tt>_correct</tt> completer after it, <tt>_prefix</tt> will 
be called a second time and, now only trying correction with the
suffix ignored.  On the second invocation the completer part of the
context appears as &lsquo;<tt>foo</tt>&rsquo;.
</p>
<p>To use <tt>_prefix</tt> as the last resort and try only normal completion
when it is invoked:
</p>
<div class="example">
<pre class="example">zstyle ':completion:*' completer _complete ... _prefix
zstyle ':completion::prefix:*' completer _complete
</pre></div>

<p>The <tt>add-space</tt> style is also respected.  If it is set to &lsquo;true&rsquo; then
<tt>_prefix</tt> will insert a space between the matches generated (if any) 
and the suffix.
</p>
<p>Note that this completer is only useful if the
<tt>COMPLETE_IN_WORD</tt> option is set; otherwise, the cursor will
be moved to the end of the current word before the completion code is
called and hence there will be no suffix.
</p>
<a name="index-_005fuser_005fexpand"></a>
</dd>
<dt><tt>_user_expand</tt></dt>
<dd><p>This completer behaves similarly to the <tt>_expand</tt> completer but
instead performs expansions defined by users.  The styles <tt>add-space</tt> and
<tt>sort</tt> styles specific to the <tt>_expand</tt> completer are usable with
<tt>_user_expand</tt> in addition to other styles handled more generally by
the completion system.  The tag <tt>all-expansions</tt> is also available.
</p>
<p>The expansion depends on the array style <tt>user-expand</tt> being defined
for the current context; remember that the context for completers is less
specific than that for contextual completion as the full context has not
yet been determined.  Elements of the array may have one of the following
forms:
</p>
<dl compact="compact">
<dt><tt>$</tt><var>hash</var></dt>
<dd>
<p><var>hash</var> is the name of an associative array.  Note this is not a full
parameter expression, merely a <tt>$</tt>, suitably quoted to prevent immediate
expansion, followed by the name of an associative array.  If the trial
expansion word matches a key in <var>hash</var>, the resulting expansion is the
corresponding value.
</p>
</dd>
<dt><var>_func</var></dt>
<dd>
<p><var>_func</var> is the name of a shell function whose name must begin with
<tt>_</tt> but is not otherwise special to the completion system.  The function
is called with the trial word as an argument.  If the word is to be
expanded, the function should set the array <tt>reply</tt> to a list of
expansions.  Optionally, it can set <tt>REPLY</tt> to a word that will
be used as a description for the set of expansions.
The return status of the function is irrelevant.
</p>
</dd>
</dl>

</dd>
</dl>

<hr>
<a name="Bindable-Commands"></a>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Completion-System" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Control-Functions" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Completion-System" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Completion-Functions" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left">[<a href="Completion-Using-compctl.html#Completion-Using-compctl" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="index.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="zsh_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="Concept-Index.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="zsh_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>

<a name="Bindable-Commands-1"></a>
<h2 class="section">20.5 Bindable Commands</h2>
<p><a name="index-completion-system_002c-bindable-commands"></a>
</p>
<p>In addition to the context-dependent completions provided, which are
expected to work in an intuitively obvious way, there are a few widgets
implementing special behaviour which can be bound separately to keys.  The
following is a list of these and their default bindings.
</p>
<dl compact="compact">
<dd><a name="index-_005fbash_005fcompletions"></a>
</dd>
<dt><tt>_bash_completions</tt></dt>
<dd><p>This function is used by two widgets, <tt>_bash_complete-word</tt> and
<tt>_bash_list-choices</tt>.  It exists to provide compatibility with
completion bindings in bash.  The last character of the binding determines
what is completed: &lsquo;<tt>!</tt>&rsquo;, command names; &lsquo;<tt>$</tt>&rsquo;, environment variables;
&lsquo;<tt>@</tt>&rsquo;, host names; &lsquo;<tt>/</tt>&rsquo;, file names; &lsquo;<tt>~</tt>&rsquo; user names.  In bash, the
binding preceded by &lsquo;<tt>\e</tt>&rsquo; gives completion, and preceded by &lsquo;<tt>^X</tt>&rsquo;
lists options.  As some of these bindings clash with standard zsh
bindings, only &lsquo;<tt>\e~</tt>&rsquo; and &lsquo;<tt>^X~</tt>&rsquo; are bound by default.  To add the
rest, the following should be added to <tt>.zshrc</tt> after <tt>compinit</tt> has
been run:
</p>
<div class="example">
<pre class="example">for key in '!' '$' '@' '/' '~'; do
  bindkey &quot;\e$key&quot; _bash_complete-word
  bindkey &quot;^X$key&quot; _bash_list-choices
done
</pre></div>

<p>This includes the bindings for &lsquo;<tt>~</tt>&rsquo; in case they were already bound to
something else; the completion code does not override user bindings.
</p>
<a name="index-_005fcorrect_005ffilename-_0028_005eXC_0029"></a>
</dd>
<dt><tt>_correct_filename</tt> (<tt>^XC</tt>)</dt>
<dd><p>Correct the filename path at the cursor position.  Allows up to six errors
in the name.  Can also be called with an argument to correct
a filename path, independently of zle; the correction is printed on
standard output.
</p>
<a name="index-_005fcorrect_005fword-_0028_005eXc_0029"></a>
</dd>
<dt><tt>_correct_word</tt> (<tt>^Xc</tt>)</dt>
<dd><p>Performs correction of the current argument using the usual contextual
completions as possible choices. This stores the string
&lsquo;<tt>correct-word</tt>&rsquo; in the <var>function</var> field of the context name and
then calls the <tt>_correct</tt> completer.
</p>
<a name="index-_005fexpand_005falias-_0028_005eXa_0029"></a>
</dd>
<dt><tt>_expand_alias</tt> (<tt>^Xa</tt>)</dt>
<dd><p>This function can be used as a completer and as a bindable command.
It expands the word the cursor is on if it is an alias.  The types of
alias expanded can be controlled with the styles <tt>regular</tt>, <tt>global</tt>
and <tt>disabled</tt>.
</p>
<p>When used as a bindable command there is one additional feature that
can be selected by setting the <tt>complete</tt> style to &lsquo;true&rsquo;.  In this
case, if the word is not the name of an alias, <tt>_expand_alias</tt> tries
to complete the word to a full alias name without expanding it.  It
leaves the cursor directly after the completed word so that invoking
<tt>_expand_alias</tt> once more will expand the now-complete alias name.
</p>
<a name="index-_005fexpand_005fword-_0028_005eXe_0029"></a>
</dd>
<dt><tt>_expand_word</tt> (<tt>^Xe</tt>)</dt>
<dd><p>Performs expansion on the current word:  equivalent to the standard
<tt>expand-word</tt> command, but using the <tt>_expand</tt> completer.  Before
calling it, the <var>function</var> field of the context is set to
&lsquo;<tt>expand-word</tt>&rsquo;.
</p>
<a name="index-_005fgeneric"></a>
</dd>
<dt><tt>_generic</tt></dt>
<dd><p>This function is not defined as a widget and not bound by
default.  However, it can be used to define a widget and will then
store the name of the widget in the <var>function</var> field of the context 
and call the completion system.  This allows custom completion widgets
with their own set of style settings to be defined easily.  For example, 
to define a widget that performs normal completion and starts
menu selection:
</p>
<div class="example">
<pre class="example">zle -C foo complete-word _generic
bindkey '...' foo
zstyle ':completion:foo:*' menu yes select=1
</pre></div>

<p>Note in particular that the <tt>completer</tt> style may be set for the context
in order to change the set of functions used to generate possible matches.
If <tt>_generic</tt> is called with arguments, those are passed through to
<tt>_main_complete</tt> as the list of completers in place of those defined by
the <tt>completer</tt> style.
</p>
<a name="index-_005fhistory_005fcomplete_005fword-_0028_005ce_002f_0029"></a>
</dd>
<dt><tt>_history_complete_word</tt> (<tt>\e/</tt>)</dt>
<dd><p>Complete words from the shell&rsquo;s command history. This uses the
<tt>list</tt>, <tt>remove-all-dups</tt>, <tt>sort</tt>, and <tt>stop</tt> styles.
</p>
<a name="index-_005fmost_005frecent_005ffile-_0028_005eXm_0029"></a>
</dd>
<dt><tt>_most_recent_file</tt> (<tt>^Xm</tt>)</dt>
<dd><p>Complete the name of the most recently modified file matching the pattern
on the command line (which may be blank).  If given a numeric argument
<var>N</var>, complete the <var>N</var>th most recently modified file.  Note the
completion, if any, is always unique.
</p>
<a name="index-_005fnext_005ftags-_0028_005eXn_0029"></a>
</dd>
<dt><tt>_next_tags</tt> (<tt>^Xn</tt>)</dt>
<dd><p>This command alters the set of matches used to that for the next tag, or
set of tags, either as given by the <tt>tag-order</tt> style or as set by
default; these matches would otherwise not be available.
Successive invocations of the command cycle through all possible sets of
tags.
</p>
<a name="index-_005fread_005fcomp-_0028_005eX_005eR_0029"></a>
</dd>
<dt><tt>_read_comp</tt> (<tt>^X^R</tt>)</dt>
<dd><p>Prompt the user for a string, and use that to perform completion on the
current word.  There are two possibilities for the string.  First, it can
be a set of words beginning &lsquo;<tt>_</tt>&rsquo;, for example &lsquo;<tt>_files -/</tt>&rsquo;, in which
case the function with any arguments will be called to generate the
completions.  Unambiguous parts of the function name will be completed
automatically (normal completion is not available at this point) until a
space is typed.
</p>
<p>Second, any other string will be passed as a set of arguments to
<tt>compadd</tt> and should hence be an expression specifying what should
be completed.
</p>
<p>A very restricted set of editing commands is available when reading the
string:  &lsquo;<tt>DEL</tt>&rsquo; and &lsquo;<tt>^H</tt>&rsquo; delete the last character; &lsquo;<tt>^U</tt>&rsquo; deletes
the line, and &lsquo;<tt>^C</tt>&rsquo; and &lsquo;<tt>^G</tt>&rsquo; abort the function, while &lsquo;<tt>RET</tt>&rsquo;
accepts the completion.  Note the string is used verbatim as a command
line, so arguments must be quoted in accordance with standard shell rules.
</p>
<p>Once a string has been read, the next call to <tt>_read_comp</tt> will use the
existing string instead of reading a new one.  To force a new string to be
read, call <tt>_read_comp</tt> with a numeric argument.
</p>
<a name="index-_005fcomplete_005fdebug-_0028_005eX_003f_0029"></a>
</dd>
<dt><tt>_complete_debug</tt> (<tt>^X?</tt>)</dt>
<dd><p>This widget performs ordinary completion, but captures in a temporary file
a trace of the shell commands executed by the completion system.  Each
completion attempt gets its own file.  A command to view each of these
files is pushed onto the editor buffer stack.
</p>
<a name="index-_005fcomplete_005fhelp-_0028_005eXh_0029"></a>
</dd>
<dt><tt>_complete_help</tt> (<tt>^Xh</tt>)</dt>
<dd><p>This widget displays information about the context names, 
the tags, and the completion functions used 
when completing at the current cursor position. If given a numeric
argument other than <tt>1</tt> (as in &lsquo;<tt>ESC-2 ^Xh</tt>&rsquo;), then the styles
used and the contexts for which they are used will be shown, too.
</p>
<p>Note that the information about styles may be incomplete; it depends on the
information available from the completion functions called, which in turn
is determined by the user&rsquo;s own styles and other settings.
</p>
<a name="index-_005fcomplete_005fhelp_005fgeneric"></a>
</dd>
<dt><tt>_complete_help_generic</tt></dt>
<dd><p>Unlike other commands listed here, this must be created as a normal ZLE
widget rather than a completion widget (i.e. with <tt>zle -N</tt>).  It
is used for generating help with a widget bound to the <tt>_generic</tt>
widget that is described above.
</p>
<p>If this widget is created using the name of the function, as it is by
default, then when executed it will read a key sequence.  This is expected
to be bound to a call to a completion function that uses the <tt>_generic</tt>
widget.  That widget will be executed, and information provided in
the same format that the <tt>_complete_help</tt> widget displays for
contextual completion.
</p>
<p>If the widget&rsquo;s name contains <tt>debug</tt>, for example if it is created
as &lsquo;<tt>zle -N _complete_debug_generic _complete_help_generic</tt>&rsquo;, it
will read and execute the keystring for a generic widget as before,
but then generate debugging information as done by <tt>_complete_debug</tt>
for contextual completion.
</p>
<p>If the widget&rsquo;s name contains <tt>noread</tt>, it will not read a keystring
but instead arrange that the next use of a generic widget run in
the same shell will have the effect as described above.
</p>
<p>The widget works by setting the shell parameter
<tt>ZSH_TRACE_GENERIC_WIDGET</tt> which is read by <tt>_generic</tt>.  Unsetting
the parameter cancels any pending effect of the <tt>noread</tt> form.
</p>
<p>For example, after executing the following:
</p>
<div class="example">
<pre class="example">zle -N _complete_debug_generic _complete_help_generic
bindkey '^x:' _complete_debug_generic
</pre></div>

<p>typing &lsquo;<tt>C-x :</tt>&rsquo; followed by the key sequence for a generic widget
will cause trace output for that widget to be saved to a file.
</p>
<a name="index-_005fcomplete_005ftag-_0028_005eXt_0029"></a>
</dd>
<dt><tt>_complete_tag</tt> (<tt>^Xt</tt>)</dt>
<dd><p>This widget completes symbol tags created by the <tt>etags</tt> or <tt>ctags</tt>
programmes (note there is no connection with the completion system&rsquo;s tags)
stored in a file <tt>TAGS</tt>, in the format used by <tt>etags</tt>, or <tt>tags</tt>, in the
format created by <tt>ctags</tt>.  It will look back up the path hierarchy for
the first occurrence of either file; if both exist, the file <tt>TAGS</tt> is
preferred.  You can specify the full path to a <tt>TAGS</tt> or <tt>tags</tt> file by
setting the parameter <tt>$TAGSFILE</tt> or <tt>$tagsfile</tt> respectively.
The corresponding completion tags used are <tt>etags</tt> and <tt>vtags</tt>, after
emacs and vi respectively.
</p>
</dd>
</dl>

<hr>
<a name="Completion-Functions"></a>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Completion-System" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Bindable-Commands" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Completion-System" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Completion-System-Variables" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left">[<a href="Completion-Using-compctl.html#Completion-Using-compctl" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="index.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="zsh_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="Concept-Index.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="zsh_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>

<a name="Utility-Functions"></a>
<h2 class="section">20.6 Utility Functions</h2>
<p><a name="index-completion-system_002c-utility-functions"></a>
</p>
<p>Descriptions follow for utility functions that may be
useful when writing completion functions.  If functions are installed in
subdirectories, most of these reside in the
<tt>Base</tt> subdirectory.  Like the example 
functions for commands in the distribution, the utility functions
generating matches all follow the convention of returning status zero if they
generated completions and non-zero if no matching completions could be 
added.
</p>
<dl compact="compact">
<dd><a name="index-_005fabsolute_005fcommand_005fpaths"></a>
</dd>
<dt><tt>_absolute_command_paths</tt></dt>
<dd><p>This function completes external commands as absolute paths (unlike
<tt>_command_names -e</tt> which completes their basenames).  It takes no
arguments.
</p>
<a name="index-_005fall_005flabels"></a>
</dd>
<dt><tt>_all_labels</tt> [ <tt>-x</tt> ] [ <tt>-12VJ</tt> ] <var>tag</var> <var>name</var> <var>descr</var> [ <var>command</var> <var>arg</var> ... ]</dt>
<dd><p>This is a convenient interface to the <tt>_next_label</tt> function below,
implementing the loop shown in the <tt>_next_label</tt> example.  The
<var>command</var> and its arguments are called to generate the matches.  The
options stored in the parameter <var>name</var> will automatically be inserted
into the <var>arg</var>s passed to the <var>command</var>.  Normally, they are put
directly after the <var>command</var>, but if one of the <var>arg</var>s is a single
hyphen, they are inserted directly before that.  If the hyphen is the last
argument, it will be removed from the argument list before the
<var>command</var> is called.  This allows <tt>_all_labels</tt> to be used in almost all
cases where the matches can be generated by a single call to the
<tt>compadd</tt> builtin command or by a call to one of the utility functions.
</p>
<p>For example:
</p>
<div class="example">
<pre class="example">local expl
...
if _requested foo; then
  ...
  _all_labels foo expl '...' compadd ... - $matches
fi
</pre></div>

<p>Will complete the strings from the <tt>matches</tt> parameter, using
<tt>compadd</tt> with additional options which will take precedence over
those generated by <tt>_all_labels</tt>.
</p>
<a name="index-_005falternative"></a>
</dd>
<dt><tt>_alternative</tt> [ <tt>-O</tt> <var>name</var> ] [ <tt>-C</tt> <var>name</var> ] <var>spec</var> ...</dt>
<dd><p>This function is useful in simple cases where multiple tags are available.
Essentially it implements a loop like the one described for the <tt>_tags</tt>
function below.
</p>
<p>The tags to use and the action to perform if a tag is requested are
described using the <var>spec</var>s which are of the form:
&lsquo;<var>tag</var><tt>:</tt><var>descr</var><tt>:</tt><var>action</var>&rsquo;.  The <var>tag</var>s are offered using
<tt>_tags</tt> and if the tag is requested, the <var>action</var> is executed with the
given description <var>descr</var>.  The <var>action</var>s are those accepted
by the <tt>_arguments</tt> function (described below), excluding the
&lsquo;<tt>-&gt;</tt><var>state</var>&rsquo; and &lsquo;<tt>=</tt><var>...</var>&rsquo; forms.
</p>
<p>For example, the <var>action</var> may be a simple function call:
</p>
<div class="example">
<pre class="example">_alternative \ 
    'users:user:_users' \ 
    'hosts:host:_hosts'
</pre></div>

<p>offers usernames and hostnames as possible matches,
generated by the <tt>_users</tt> and <tt>_hosts</tt> functions respectively.
</p>
<p>Like <tt>_arguments</tt>, this function uses <tt>_all_labels</tt> to execute 
the actions, which will loop over all sets of tags.  Special handling is
only required if there is an additional valid tag, for example inside a
function called from <tt>_alternative</tt>.
</p>
<p>The option &lsquo;<tt>-O</tt> <var>name</var>&rsquo; is used in the same way as by the
<tt>_arguments</tt> function.  In other words, the elements of the <var>name</var>
array will be passed to <tt>compadd</tt> when executing an action.
</p>
<p>Like <tt>_tags</tt> this function supports the <tt>-C</tt> option to give a
different name for the argument context field.
</p>
<a name="index-_005farguments"></a>

</dd>
<dt><tt>_arguments </tt>[ <tt>-nswWCRS</tt> ] [ <tt>-A</tt> <var>pat</var> ] [ <tt>-O</tt> <var>name</var> ] [ <tt>-M</tt> <var>matchspec</var> ]</dt>
<dt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt>[ <tt>:</tt> ] <var>spec</var> ...</dt>
<dt><tt>_arguments</tt> [ <var>opt</var> ... ] <tt>-</tt><tt>-</tt> [ <tt>-i</tt> <var>pats</var> ] [ <tt>-s</tt> <var>pair</var> ] [ <var>helpspec</var> ... ]</dt>
<dd><p>This function can be used to give a complete specification for completion
for a command whose arguments follow standard UNIX option and argument
conventions.
</p>
<p><em>Options overview</em>
</p>
<p>Options to <tt>_arguments</tt> itself must be in separate words, i.e. <tt>-s -w</tt>,
not <tt>-sw</tt>.  The options are followed by <var>spec</var>s that describe options and
arguments of the analyzed command.  <var>spec</var>s that describe option flags must
precede <var>spec</var>s that describe non-option (&quot;positional&quot; or &quot;normal&quot;)
arguments of the analyzed line.  To avoid ambiguity, all
options to <tt>_arguments</tt> itself may be separated from the <var>spec</var> forms
by a single colon.
</p>
<p>The &lsquo;<tt>-</tt><tt>-</tt>&rsquo;
form is used to intuit <var>spec</var> forms from the help output of the command
being analyzed, and is described in detail below.  The <var>opts</var> for the
&lsquo;<tt>-</tt><tt>-</tt>&rsquo; form are otherwise the same options as the first form.  Note
that &lsquo;<tt>-s</tt>&rsquo; following &lsquo;<tt>-</tt><tt>-</tt>&rsquo; has a distinct meaning from &lsquo;<tt>-s</tt>&rsquo;
preceding &lsquo;<tt>-</tt><tt>-</tt>&rsquo;, and both may appear.
</p>
<p>The option switches <tt>-s</tt>, <tt>-S</tt>, <tt>-A</tt>, <tt>-w</tt>, and <tt>-W</tt> affect how
<tt>_arguments</tt> parses the analyzed command line&rsquo;s options.  These switches are
useful for commands with standard argument parsing.
</p>
<p>The options of <tt>_arguments</tt> have the following meanings:
</p>
<dl compact="compact">
<dt><tt>-n</tt></dt>
<dd><p>With this option, <tt>_arguments</tt> sets the parameter <tt>NORMARG</tt>
to the position of the first normal argument in the <tt>$words</tt> array,
i.e. the position after the end of the options.  If that argument
has not been reached, <tt>NORMARG</tt> is set to <tt>-1</tt>.  The caller
should declare &lsquo;<tt>integer NORMARG</tt>&rsquo; if the <tt>-n</tt> option is passed;
otherwise the parameter is not used.
</p>
</dd>
<dt><tt>-s</tt></dt>
<dd><p>Enable <em>option stacking</em> for single-letter options, whereby multiple
single-letter options may be combined into a single word.  For example,
the two options &lsquo;<tt>-x</tt>&rsquo; and &lsquo;<tt>-y</tt>&rsquo; may be combined into
a single word &lsquo;<tt>-xy</tt>&rsquo;.  By default, every word corresponds to a single
option name (&lsquo;<tt>-xy</tt>&rsquo; is a single option named &lsquo;<tt>xy</tt>&rsquo;).
</p>
<p>Options beginning with a single hyphen or plus sign are eligible for stacking;
words beginning with two hyphens are not.
</p>
<p>Note that <tt>-s</tt> after <tt>-</tt><tt>-</tt> has a different meaning, which is documented
in the segment entitled &lsquo;Deriving <var>spec</var> forms from the help output&rsquo;.
</p>
</dd>
<dt><tt>-w</tt></dt>
<dd><p>In combination with <tt>-s</tt>, allow option stacking
even if one or more of the options take
arguments.  For example, if <tt>-x</tt> takes an argument, with no
<tt>-s</tt>, &lsquo;<tt>-xy</tt>&rsquo; is considered as a single (unhandled) option; with
<tt>-s</tt>, <tt>-xy</tt> is an option with the argument &lsquo;<tt>y</tt>&rsquo;; with both <tt>-s</tt>
and <tt>-w</tt>, <tt>-xy</tt> is the option <tt>-x</tt> and the option <tt>-y</tt> with
arguments to <tt>-x</tt> (and to <tt>-y</tt>, if it takes arguments) still to come
in subsequent words.
</p>
</dd>
<dt><tt>-W</tt></dt>
<dd><p>This option takes <tt>-w</tt> a stage further:  it is possible to
complete single-letter options even after an argument that occurs in the
same word.  However, it depends on the action performed whether options
will really be completed at this point.  For more control, use a
utility function like <tt>_guard</tt> as part of the action.
</p>
</dd>
<dt><tt>-C</tt></dt>
<dd><p>Modify the <tt>curcontext</tt> parameter for an action of the form &lsquo;<tt>-&gt;</tt><var>state</var>&rsquo;.
This is discussed in detail below.
</p>
</dd>
<dt><tt>-R</tt></dt>
<dd><p>Return status 300 instead of zero when a <tt>$state</tt> is to
be handled, in the &lsquo;<tt>-&gt;</tt><var>string</var>&rsquo; syntax.
</p>
</dd>
<dt><tt>-S</tt></dt>
<dd><p>Do not complete options after a &lsquo;<tt>-</tt><tt>-</tt>&rsquo; appearing on the line,
and ignore the &lsquo;<tt>-</tt><tt>-</tt>&rsquo;.  For example, with <tt>-S</tt>, in the line
</p>
<div class="example">
<pre class="example">foobar -x -- -y
</pre></div>

<p>the &lsquo;<tt>-x</tt>&rsquo; is considered an option, the &lsquo;<tt>-y</tt>&rsquo; is considered an
argument, and the &lsquo;<tt>-</tt><tt>-</tt>&rsquo; is considered to be neither.
</p>
</dd>
<dt><tt>-A</tt> <var>pat</var></dt>
<dd><p>Do not complete options after the first non-option
argument on the line.  <var>pat</var> is a pattern matching
all strings which are not to be taken as arguments.  For example, to make
<tt>_arguments</tt> stop completing options after the first normal argument, but
ignoring all strings starting with a hyphen even if they are not described
by one of the <var>optspec</var>s, the form is &lsquo;<tt>-A &quot;-*&quot;</tt>&rsquo;.
</p>
</dd>
<dt><tt>-O</tt> <var>name</var></dt>
<dd><p>Pass the elements of the array <var>name</var> as arguments to functions called to
execute <var>action</var>s.
This is discussed in detail below.
</p>
</dd>
<dt><tt>-M</tt> <var>matchspec</var></dt>
<dd><p>Use the match specification <var>matchspec</var> for completing option names and values.
The default <var>matchspec</var> allows partial word completion after &lsquo;<tt>_</tt>&rsquo; and
&lsquo;<tt>-</tt>&rsquo;, such as completing &lsquo;<tt>-f-b</tt>&rsquo; to &lsquo;<tt>-foo-bar</tt>&rsquo;.  The default
<var>matchspec</var> is:
</p><div class="example">
<pre class="example"><tt>r:|[_-]=* r:|=*</tt>
</pre></div>

</dd>
</dl>

<p><em><var>spec</var>s: overview</em>
</p>
<p>Each of the following forms is a <var>spec</var> describing individual sets of
options or arguments on the command line being analyzed.
</p>
<dl compact="compact">
<dt><var>n</var><tt>:</tt><var>message</var><tt>:</tt><var>action</var></dt>
<dt><var>n</var><tt>::</tt><var>message</var><tt>:</tt><var>action</var></dt>
<dd><p>This describes the <var>n</var>&rsquo;th normal argument.  The <var>message</var> will be 
printed above the matches generated and the <var>action</var> indicates what can
be completed in this position (see below).  If there are two colons
before the <var>message</var> the argument is optional.  If the
<var>message</var> contains only white space, nothing will be printed above
the matches unless the action adds an explanation string itself.
</p>
</dd>
<dt><tt>:</tt><var>message</var><tt>:</tt><var>action</var></dt>
<dt><tt>::</tt><var>message</var><tt>:</tt><var>action</var></dt>
<dd><p>Similar, but describes the <em>next</em> argument, whatever number that
happens to be.  If all arguments are specified in this form in the
correct order the numbers are unnecessary.
</p>
</dd>
<dt><tt>*:</tt><var>message</var><tt>:</tt><var>action</var></dt>
<dt><tt>*::</tt><var>message</var><tt>:</tt><var>action</var></dt>
<dt><tt>*:::</tt><var>message</var><tt>:</tt><var>action</var></dt>
<dd><p>This describes how arguments (usually non-option arguments, those not
beginning with <tt>-</tt> or <tt>+</tt>) are to be completed when neither
of the first two forms was provided.  Any number of arguments can
be completed in this fashion.
</p>
<p>With two colons before the <var>message</var>, the <tt>words</tt> special array and
the <tt>CURRENT</tt> special parameter are modified to refer only to the
normal arguments when the <var>action</var> is executed or evaluated.  With
three colons before the <var>message</var> they are modified to refer only to
the normal arguments covered by this description.
</p>
</dd>
<dt><var>optspec</var></dt>
<dt><var>optspec</var><tt>:</tt><var>...</var></dt>
<dd><p>This describes an option.  The colon indicates handling for one or more
arguments to the option; if it is not present, the option is assumed to
take no arguments.
</p>
<p>The following forms are available for the initial <var>optspec</var>, whether
or not the option has arguments.
</p>
<dl compact="compact">
<dt><tt>*</tt><var>optspec</var></dt>
<dd><p>Here <var>optspec</var> is one of the remaining forms below.  This indicates
the following <var>optspec</var> may be repeated.  Otherwise if the
corresponding option is already present on the command line to the left
of the cursor it will not be offered again.
</p>
</dd>
<dt><tt>-</tt><var>optname</var></dt>
<dt><tt>+</tt><var>optname</var></dt>
<dd><p>In the simplest form the <var>optspec</var> is just the option name beginning
with a minus or a plus sign, such as &lsquo;<tt>-foo</tt>&rsquo;.  The first argument for
the option (if any) must follow as a <em>separate</em> word directly after the
option.
</p>
<p>Either of &lsquo;<tt>-+</tt><var>optname</var>&rsquo; and &lsquo;<tt>+-</tt><var>optname</var>&rsquo; can be used to
specify that <tt>-</tt><var>optname</var> and <tt>+</tt><var>optname</var> are both valid.
</p>
<p>In all the remaining forms, the leading &lsquo;<tt>-</tt>&rsquo; may be replaced by or
paired with &lsquo;<tt>+</tt>&rsquo; in this way.
</p>
</dd>
<dt><tt>-</tt><var>optname</var><tt>-</tt></dt>
<dd><p>The first argument of the option must come directly after the option name
<em>in the same word</em>.  For example, &lsquo;<tt>-foo-:</tt><var>...</var>&rsquo; specifies that
the completed option and argument will look like &lsquo;<tt>-foo</tt><var>arg</var>&rsquo;.
</p>
</dd>
<dt><tt>-</tt><var>optname</var><tt>+</tt></dt>
<dd><p>The first argument may appear immediately after <var>optname</var> in the same
word, or may appear as a separate word after the option.  For example,
&lsquo;<tt>-foo+:</tt><var>...</var>&rsquo; specifies that the completed option and argument
will look like either &lsquo;<tt>-foo</tt><var>arg</var>&rsquo; or &lsquo;<tt>-foo</tt> <var>arg</var>&rsquo;.
</p>
</dd>
<dt><tt>-</tt><var>optname</var><tt>=</tt></dt>
<dd><p>The argument may appear as the next word, or in same word as the option
name provided that it is separated from it by an equals sign, for
example &lsquo;<tt>-foo=</tt><var>arg</var>&rsquo; or &lsquo;<tt>-foo</tt> <var>arg</var>&rsquo;.
</p>
</dd>
<dt><tt>-</tt><var>optname</var><tt>=-</tt></dt>
<dd><p>The argument to the option must appear after an equals sign in the same
word, and may not be given in the next argument.
</p>
</dd>
<dt><var>optspec</var><tt>[</tt><var>explanation</var><tt>]</tt></dt>
<dd><p>An explanation string may be appended to any of the preceding forms of
<var>optspec</var> by enclosing it in brackets, as in &lsquo;<tt>-q[query operation]</tt>&rsquo;.
</p>
<p>The <tt>verbose</tt> style is used to decide whether the explanation strings
are displayed with the option in a completion listing.
</p>
<p>If no bracketed explanation string is given but the <tt>auto-description</tt>
style is set and only one argument is described for this <var>optspec</var>, the
value of the style is displayed, with any appearance of the sequence
&lsquo;<tt>%d</tt>&rsquo; in it replaced by the <var>message</var> of the first <var>optarg</var>
that follows the <var>optspec</var>; see below.
</p>
</dd>
</dl>

<p>It is possible for options with a literal &lsquo;<tt>+</tt>&rsquo; or &lsquo;<tt>=</tt>&rsquo; to
appear, but that character must be quoted, for example &lsquo;<tt>-\+</tt>&rsquo;.
</p>
<p>Each <var>optarg</var> following an <var>optspec</var> must take one of the
following forms:
</p>
<dl compact="compact">
<dt><tt>:</tt><var>message</var><tt>:</tt><var>action</var></dt>
<dt><tt>::</tt><var>message</var><tt>:</tt><var>action</var></dt>
<dd><p>An argument to the option; <var>message</var> and <var>action</var> are treated as
for ordinary arguments.  In the first form, the argument is mandatory,
and in the second form it is optional.
</p>
<p>This group may be repeated for options which take multiple arguments.
In other words,
<tt>:</tt><var>message1</var><tt>:</tt><var>action1</var><tt>:</tt><var>message2</var><tt>:</tt><var>action2</var>
specifies that the option takes two arguments.
</p>
</dd>
<dt><tt>:*</tt><var>pattern</var><tt>:</tt><var>message</var><tt>:</tt><var>action</var></dt>
<dt><tt>:*</tt><var>pattern</var><tt>::</tt><var>message</var><tt>:</tt><var>action</var></dt>
<dt><tt>:*</tt><var>pattern</var><tt>:::</tt><var>message</var><tt>:</tt><var>action</var></dt>
<dd><p>This describes multiple arguments.  Only the last <var>optarg</var> for
an option taking multiple arguments may be
given in this form.  If the <var>pattern</var> is empty (i.e. <tt>:*:</tt>), all
the remaining words on the line are to be completed as described by the
<var>action</var>; otherwise, all the words up to and including a word matching
the <var>pattern</var> are to be completed using the <var>action</var>.
</p>
<p>Multiple colons are treated as for the &lsquo;<tt>*:</tt><var>...</var>&rsquo; forms for
ordinary arguments:  when the <var>message</var> is preceded by two colons,
the <tt>words</tt> special array and the <tt>CURRENT</tt> special parameter are
modified during the execution or evaluation of the <var>action</var> to refer
only to the words after the option.  When preceded by three colons, they
are modified to refer only to the words covered by this description.
</p>
</dd>
</dl>

</dd>
</dl>

<p>Any literal colon in an <var>optname</var>, <var>message</var>, or <var>action</var>
must be preceded by a backslash, &lsquo;<tt>\:</tt>&rsquo;.
</p>
<p>Each of the forms above may be preceded by a list in parentheses
of option names and argument numbers.  If the given option is on
the command line, the options and arguments indicated in parentheses
will not be offered.  For example, 
&lsquo;<tt>(-two -three 1)-one:</tt><var>...</var>&rsquo; completes the option &lsquo;<tt>-one</tt>&rsquo;; if this
appears on the command line, the options <tt>-two</tt> and <tt>-three</tt> and the
first ordinary argument will not be completed after it.
&lsquo;<tt>(-foo):</tt><var>...</var>&rsquo; specifies an ordinary argument completion;
<tt>-foo</tt> will not be completed if that argument is already present.
</p>
<p>Other items may appear in the list of excluded options to indicate
various other items that should not be applied when the current
specification is matched: a single star (<tt>*</tt>) for the rest arguments
(i.e. a specification of the form &lsquo;<tt>*:</tt><var>...</var>&rsquo;); a colon (<tt>:</tt>)
for all normal (non-option-) arguments; and a hyphen (<tt>-</tt>) for all
options.  For example, if &lsquo;<tt>(*)</tt>&rsquo; appears before an option and the
option appears on the command line, the list of remaining arguments
(those shown in the above table beginning with &lsquo;<tt>*:</tt>&rsquo;) will not be
completed.
</p>
<p>To aid in reuse of specifications, it is possible to precede any of the
forms above with &lsquo;<tt>!</tt>&rsquo;; then the form will no longer be completed,
although if the option or argument appears on the command line they will
be skipped as normal.  The main use for this is when the arguments are
given by an array, and <tt>_arguments</tt> is called repeatedly for more
specific contexts: on the first call &lsquo;<tt>_arguments $global_options</tt>&rsquo; is
used, and on subsequent calls &lsquo;<tt>_arguments !$^global_options</tt>&rsquo;.
</p>
<p><em><var>spec</var>s: actions</em>
</p>
<p>In each of the forms above the <var>action</var> determines how
completions should be generated.  Except for the &lsquo;<tt>-&gt;</tt><var>string</var>&rsquo;
form below, the <var>action</var> will be executed by calling the
<tt>_all_labels</tt> function to process all tag labels.  No special handling
of tags is needed unless a function call introduces a new one.
</p>
<p>The functions called to execute <var>action</var>s will be called with the
elements of the array named by the &lsquo;<tt>-O</tt> <var>name</var>&rsquo; option as arguments.
This can be used, for example, to pass the same set of options for the
<tt>compadd</tt> builtin to all <var>action</var>s.
</p>
<p>The forms for <var>action</var> are as follows.
</p>
<dl compact="compact">
<dt><tt>&nbsp;</tt>(single unquoted space)</dt>
<dd><p>This is useful where an argument is required but it is not possible or
desirable to generate matches for it.  The
<var>message</var> will be displayed but no completions listed.  Note
that even in this case the colon at the end of the <var>message</var> is
needed; it may only be omitted when neither a <var>message</var>
nor an <var>action</var> is given.
</p>
</dd>
<dt><tt>(</tt><var>item1</var> <var>item2</var> <var>...</var><tt>)</tt></dt>
<dd><p>One of a list of possible matches, for example:
</p>
<div class="example">
<pre class="example"><tt>:foo:(foo bar baz</tt><tt>)</tt>
</pre></div>

</dd>
<dt><tt>((<var>item1</var>\:<var>desc1</var> <var>...</var>))</tt></dt>
<dd><p>Similar to the above, but with descriptions for each possible match.
Note the backslash before the colon.  For example,
</p>
<div class="example">
<pre class="example"><tt>:foo:((a\:bar b\:baz</tt><tt>))</tt>
</pre></div>

<p>The matches will be listed together with their descriptions if the
<tt>description</tt> style is set with the <tt>values</tt> tag in the context.
</p>
</dd>
<dt><tt>-&gt;</tt><var>string</var></dt>
<dd><a name="index-context_002c-use-of"></a>
<a name="index-line_002c-use-of"></a>
<a name="index-opt_005fargs_002c-use-of"></a>
<p>In this form, <tt>_arguments</tt> processes the arguments and options and then
returns control to the calling function with parameters set to indicate the
state of processing; the calling function then makes its own arrangements
for generating completions.  For example, functions that implement a state
machine can use this type of action.
</p>
<p>Where <tt>_arguments</tt> encounters <var>action</var> in the &lsquo;<tt>-&gt;</tt><var>string</var>&rsquo;
format, it will strip all leading and trailing whitespace from <var>string</var>
and set the array <tt>state</tt> to the set of all <var>string</var>s for which an
action is to be performed.  The elements of the array <tt>state_descr</tt> are
assigned the corresponding <var>message</var> field from each <var>optarg</var>
containing such an <var>action</var>.
</p>
<p>By default and in common with all other well behaved completion
functions, _arguments returns status zero if it was able to add matches and
non-zero otherwise. However, if the <tt>-R</tt> option is given,
<tt>_arguments</tt> will instead return a status of 300 to indicate that
<tt>$state</tt> is to be handled.
</p>
<p>In addition to <tt>$state</tt> and <tt>$state_descr</tt>, <tt>_arguments</tt> also
sets the global
parameters &lsquo;<tt>context</tt>&rsquo;, &lsquo;<tt>line</tt>&rsquo; and &lsquo;<tt>opt_args</tt>&rsquo; as described
below, and does not reset any changes made to the special parameters
such as <tt>PREFIX</tt> and <tt>words</tt>.  This gives the calling function the
choice of resetting these parameters or propagating changes in them.
</p>
<p>A function calling <tt>_arguments</tt> with at least
one action containing a &lsquo;<tt>-&gt;</tt><var>string</var>&rsquo; must therefore declare
appropriate local parameters:
</p>
<div class="example">
<pre class="example">local context state state_descr line
typeset -A opt_args
</pre></div>

<p>to prevent <tt>_arguments</tt> from altering the global environment.
</p>
</dd>
<dt><tt>{</tt><var>eval-string</var><tt>}</tt></dt>
<dd><a name="index-expl_002c-use-of"></a>
<p>A string in braces is evaluated as shell code to generate matches.  If the
<var>eval-string</var> itself does not begin with an opening parenthesis or
brace it is split into separate words before execution.
</p>
</dd>
<dt><tt>= </tt><var>action</var></dt>
<dd><p>If the <var>action</var> starts with &lsquo;<tt>= </tt>&rsquo; (an equals sign followed by a
space), <tt>_arguments</tt> will insert the contents of the <var>argument</var>
field of the current context as the new first element in the <tt>words</tt> 
special array and increment the value of the <tt>CURRENT</tt> special
parameter.  This has the effect of inserting a dummy word onto the
completion command line while not changing the point at which completion is
taking place.
</p>
<p>This is most useful with one of the specifiers that restrict the words on
the command line on which the <var>action</var> is to operate (the two- and
three-colon forms above).  One particular use is when an <var>action</var> itself
causes <tt>_arguments</tt> on a restricted range; it is necessary to use this
trick to insert an appropriate command name into the range for the second
call to <tt>_arguments</tt> to be able to parse the line.
</p>
</dd>
<dt><var><tt>&nbsp;</tt>word...</var></dt>
<dt><var>word...</var></dt>
<dd><p>This covers all forms other than those above.  If the <var>action</var>
starts with a space, the remaining list of words will be invoked unchanged.
</p>
<p>Otherwise it will be invoked with some extra strings placed after the
first word; these are to be passed down as options to the <tt>compadd</tt>
builtin.  They ensure that the state specified by <tt>_arguments</tt>, in
particular the descriptions of options and arguments, is correctly passed
to the completion command.  These additional arguments
are taken from the array parameter &lsquo;<tt>expl</tt>&rsquo;; this will be set up
before executing the <var>action</var> and hence may be referred to inside it,
typically in an expansion of the form &lsquo;<tt>$expl[@]</tt>&rsquo; which preserves empty
elements of the array.
</p>
</dd>
</dl>

<p>During the performance of the action the array &lsquo;<tt>line</tt>&rsquo; will be set to
the normal arguments from the command line, i.e. the words from the
command line after the command name excluding all options and their
arguments.  Options are stored in the associative array
&lsquo;<tt>opt_args</tt>&rsquo; with option names as keys and their arguments as
the values.  For options that have more than one argument these are
given as one string, separated by colons.  All colons and backslashes
in the original arguments are preceded with backslashes.
</p>
<p>The parameter &lsquo;<tt>context</tt>&rsquo; is set when returning to the calling function
to perform an action of the form &lsquo;<tt>-&gt;</tt><var>string</var>&rsquo;.  It is set to an
array of elements corresponding to the elements of <tt>$state</tt>.  Each
element is a suitable name for the argument field of the context: either a
string of the form &lsquo;<tt>option</tt><var>-opt</var><tt>-</tt><var>n</var>&rsquo; for the <var>n</var>&rsquo;th
argument of the option <var>-opt</var>, or a string of the form
&lsquo;<tt>argument-</tt><var>n</var>&rsquo; for the <var>n</var>&rsquo;th argument.  For &lsquo;rest&rsquo; arguments,
that is those in the list at the end not handled by position, <var>n</var> is the
string &lsquo;<tt>rest</tt>&rsquo;.  For example, when completing the argument of the <tt>-o</tt>
option, the name is &lsquo;<tt>option-o-1</tt>&rsquo;, while for the second normal
(non-option-) argument it is &lsquo;<tt>argument-2</tt>&rsquo;.
</p>
<p>Furthermore, during the evaluation of the <var>action</var> the context name in
the <tt>curcontext</tt> parameter is altered to append the same string that is
stored in the <tt>context</tt> parameter.
</p>
<p>The option <tt>-C</tt> tells <tt>_arguments</tt> to modify the <tt>curcontext</tt>
parameter for an action of the form &lsquo;<tt>-&gt;</tt><var>state</var>&rsquo;.  This is the
standard parameter used to keep track of the current context.  Here it
(and not the <tt>context</tt> array) should be made local to the calling
function to avoid passing back the modified value and should be
initialised to the current value at the start of the function:
</p>
<div class="example">
<pre class="example">local curcontext=&quot;$curcontext&quot;
</pre></div>

<p>This is useful where it is not possible for multiple states to be valid
together.
</p>
<p><em>Specifying multiple sets of options</em>
</p>
<p>It is possible to specify multiple sets of options and
arguments with the sets separated by single hyphens.  The specifications
before the first hyphen (if any) are shared by all the remaining sets.
The first word in every other set provides a name for the
set which may appear in exclusion lists in specifications,
either alone or before one of the possible values described above.
In the second case a &lsquo;<tt>-</tt>&rsquo; should appear between this name and the
remainder.
</p>
<p>For example:
</p>
<div class="example">
<pre class="example">_arguments \ 
    -a \ 
  - set1 \ 
    -c \ 
  - set2 \ 
    -d \ 
    ':arg:(x2 y2)'
</pre></div>

<p>This defines two sets.  When the command line contains the option
&lsquo;<tt>-c</tt>&rsquo;, the &lsquo;<tt>-d</tt>&rsquo; option and the argument will not be considered
possible completions.  When it contains &lsquo;<tt>-d</tt>&rsquo; or an argument, the
option &lsquo;<tt>-c</tt>&rsquo; will not be considered.  However, after &lsquo;<tt>-a</tt>&rsquo;
both sets will still be considered valid.
</p>
<p>If an option in a set appears on the command line, it is stored in the
associative array &lsquo;<tt>opt_args</tt>&rsquo; with &rsquo;<var>set</var><tt>-</tt><var>option</var>&rsquo;
as a key.  In the example above, a key &lsquo;<tt>set1--c</tt>&rsquo; is used if the option
&lsquo;<tt>-c</tt>&rsquo; is on the command line.
</p>
<p>If the name given for one of the mutually exclusive sets is of the form
&lsquo;<tt>(</tt><var>name</var><tt>)</tt>&rsquo; then only one value from each set will ever
be completed; more formally, all specifications are mutually
exclusive to all other specifications in the same set.  This is
useful for defining multiple sets of options which are mutually
exclusive and in which the options are aliases for each other.  For
example:
</p>
<div class="example">
<pre class="example">_arguments \ 
    -a -b \ 
  - '(compress)' \ 
    {-c,--compress}'[compress]' \ 
  - '(uncompress)' \ 
    {-d,--decompress}'[decompress]'
</pre></div>

<p>As the completion code has to parse the command line separately for each
set this form of argument is slow and should only be used when necessary.
A useful alternative is often an option specification with rest-arguments
(as in &lsquo;<tt>-foo:*:...</tt>&rsquo;); here the option <tt>-foo</tt> swallows up all
remaining arguments as described by the <var>optarg</var> definitions.
</p>
<p><em>Deriving <var>spec</var> forms from the help output</em>
</p>
<p>The option &lsquo;<tt>-</tt><tt>-</tt>&rsquo; allows <tt>_arguments</tt> to work out the names of long
options that support the &lsquo;<tt>-</tt><tt>-help</tt>&rsquo; option which is standard in many
GNU commands.  The command word is called with the argument
&lsquo;<tt>-</tt><tt>-help</tt>&rsquo; and the output examined for option names.  Clearly, it can
be dangerous to pass this to commands which may not support this option as
the behaviour of the command is unspecified.
</p>
<p>In addition to options, &lsquo;<tt>_arguments -</tt><tt>-</tt>&rsquo; will try to deduce the
types of arguments available for options when the form
&lsquo;<tt>-</tt><tt>-</tt><var>opt</var><tt>=</tt><var>val</var>&rsquo; is valid.  It is also possible to provide
hints by examining the help text of the command and adding <var>helpspec</var> of
the form &lsquo;<var>pattern</var><tt>:</tt><var>message</var><tt>:</tt><var>action</var>&rsquo;; note that other
<tt>_arguments</tt> <var>spec</var> forms are not used.  The <var>pattern</var> is matched
against the help text for an option, and if it matches the <var>message</var> and
<var>action</var> are used as for other argument specifiers.  The special case
of &lsquo;<tt>*:</tt>&rsquo; means both <var>message</var> and <var>action</var> are empty, which has
the effect of causing options having no description in the help output to
be ordered in listings ahead of options that have a description.
</p>
<p>For example:
</p>
<div class="example">
<pre class="example">_arguments -- '*\*:toggle:(yes no)' \ 
              '*=FILE*:file:_files' \ 
              '*=DIR*:directory:_files -/' \ 
              '*=PATH*:directory:_files -/'
</pre></div>

<p>Here, &lsquo;<tt>yes</tt>&rsquo; and &lsquo;<tt>no</tt>&rsquo; will be completed as the argument of
options whose description ends in a star; file names will be completed for
options that contain the substring &lsquo;<tt>=FILE</tt>&rsquo; in the description; and
directories will be completed for options whose description contains
&lsquo;<tt>=DIR</tt>&rsquo; or &lsquo;<tt>=PATH</tt>&rsquo;.  The last three are in fact the default and so
need not be given explicitly, although it is possible to override the use
of these patterns.  A typical help text which uses this feature is:
</p>
<div class="example">
<pre class="example">  -C, --directory=DIR          change to directory DIR
</pre></div>

<p>so that the above specifications will cause directories to be completed
after &lsquo;<tt>-</tt><tt>-directory</tt>&rsquo;, though not after &lsquo;<tt>-C</tt>&rsquo;.
</p>
<p>Note also that <tt>_arguments</tt> tries to find out automatically if the
argument for an option is optional.  This can be specified explicitly by
doubling the colon before the <var>message</var>.
</p>
<p>If the <var>pattern</var> ends in &lsquo;<tt>(-)</tt>&rsquo;, this will be removed from the
pattern and the <var>action</var> will be used only directly after the
&lsquo;<tt>=</tt>&rsquo;, not in the next word.  This is the behaviour of a normal
specification defined with the form &lsquo;<tt>=-</tt>&rsquo;.
</p>
<p>The &lsquo;<tt>_arguments -</tt><tt>-</tt>&rsquo; can be followed by the option &lsquo;<tt>-i</tt>
<var>patterns</var>&rsquo; to give patterns for options which are not to be
completed.  The patterns can be given as the name of an array parameter
or as a literal list in parentheses.  For example,
</p>
<div class="example">
<pre class="example">_arguments -- -i \ 
    &quot;(--(en|dis)able-FEATURE*)&quot;
</pre></div>

<p>will cause completion to ignore the options
&lsquo;<tt>-</tt><tt>-enable-FEATURE</tt>&rsquo; and &lsquo;<tt>-</tt><tt>-disable-FEATURE</tt>&rsquo; (this example is
useful with GNU <tt>configure</tt>).
</p>
<p>The &lsquo;<tt>_arguments -</tt><tt>-</tt>&rsquo; form can also be followed by the option &lsquo;<tt>-s</tt>
<var>pair</var>&rsquo; to describe option aliases.  The <var>pair</var> consists of a list
of alternating patterns and corresponding replacements, enclosed in parens
and quoted so that it forms a single argument word in the <tt>_arguments</tt>
call.
</p>
<p>For example, some <tt>configure</tt>-script help output describes options only
as &lsquo;<tt>-</tt><tt>-enable-foo</tt>&rsquo;, but the script also accepts the negated form
&lsquo;<tt>-</tt><tt>-disable-foo</tt>&rsquo;.  To allow completion of the second form:
</p>
<div class="example">
<pre class="example">_arguments -- -s &quot;((#s)--enable- --disable-)&quot;
</pre></div>

<p><em>Miscellaneous notes</em>
</p>
<p>Finally, note that <tt>_arguments</tt> generally expects to be the primary
function handling any completion for which it is used.  It may have side
effects which change the treatment of any matches added by other functions
called after it.  To combine <tt>_arguments</tt> with other functions, those
functions should be called either before <tt>_arguments</tt>, as an <var>action</var>
within a <var>spec</var>, or in handlers for &lsquo;<tt>-&gt;</tt><var>state</var>&rsquo; actions.
</p>
<p>Here is a more general example of the use of <tt>_arguments</tt>:
</p>
<div class="example">
<pre class="example">_arguments '-l+:left border:' \ 
           '-format:paper size:(letter A4)' \ 
           '*-copy:output file:_files::resolution:(300 600)' \ 
           ':postscript file:_files -g \*.\(ps\|eps\)' \ 
           '*:page number:'
</pre></div>

<p>This describes three options: &lsquo;<tt>-l</tt>&rsquo;, &lsquo;<tt>-format</tt>&rsquo;, and
&lsquo;<tt>-copy</tt>&rsquo;.  The first takes one argument described as &lsquo;<var>left
border</var>&rsquo; for which no completion will be offered because of the empty
action.  Its argument may come directly after the &lsquo;<tt>-l</tt>&rsquo; or it may be 
given as the next word on the line.
</p>
<p>The &lsquo;<tt>-format</tt>&rsquo; option takes one
argument in the next word, described as &lsquo;<var>paper size</var>&rsquo; for which
only the strings &lsquo;<tt>letter</tt>&rsquo; and &lsquo;<tt>A4</tt>&rsquo; will be completed.
</p>
<p>The &lsquo;<tt>-copy</tt>&rsquo; option may appear more than once on the command line and
takes two arguments.  The first is mandatory and will be completed as a
filename.  The second is optional (because of the second colon before
the description &lsquo;<var>resolution</var>&rsquo;) and will be completed from the strings
&lsquo;<tt>300</tt>&rsquo; and &lsquo;<tt>600</tt>&rsquo;.
</p>
<p>The last two descriptions say what should be completed as
arguments.  The first describes the first argument as a
&lsquo;<var>postscript file</var>&rsquo; and makes files ending in &lsquo;<tt>ps</tt>&rsquo; or &lsquo;<tt>eps</tt>&rsquo; 
be completed.  The last description gives all other arguments the
description &lsquo;<var>page numbers</var>&rsquo; but does not offer completions.
</p>
<a name="index-_005fcache_005finvalid"></a>
</dd>
<dt><tt>_cache_invalid</tt> <var>cache_identifier</var></dt>
<dd><p>This function returns status zero if the completions cache corresponding to
the given cache identifier needs rebuilding.  It determines this by
looking up the <tt>cache-policy</tt> style for the current context.
This should provide a function name which is run with the full path to the
relevant cache file as the only argument.
</p>
<p>Example:
</p>
<div class="example">
<pre class="example">_example_caching_policy () {
    # rebuild if cache is more than a week old
    local -a oldp
    oldp=( &quot;$1&quot;(Nm+7) )
    (( $#oldp ))
}
</pre></div>

<a name="index-_005fcall_005ffunction"></a>
</dd>
<dt><tt>_call_function</tt> <var>return</var> <var>name</var> [ <var>arg</var> ... ]</dt>
<dd><p>If a function <var>name</var> exists, it is called with the arguments
<var>arg</var>s.  The <var>return</var> argument gives the name of a parameter in which
the return status from the function <var>name</var> should be stored; if <var>return</var>
is empty or a single hyphen it is ignored.
</p>
<p>The return status of <tt>_call_function</tt> itself is zero if the function
<var>name</var> exists and was called and non-zero otherwise.
</p>
<a name="index-_005fcall_005fprogram"></a>
</dd>
<dt><tt>_call_program</tt> [ <tt>-p</tt> ] <var>tag</var> <var>string</var> ...</dt>
<dd><p>This function provides a mechanism for the user to override the use of an
external command.  It looks up the <tt>command</tt> style with the supplied
<var>tag</var>.  If the style is set, its value is used as the command to
execute.  The <var>string</var>s from the call to <tt>_call_program</tt>, or from the
style if set, are concatenated with spaces between them and the resulting
string is evaluated.  The return status is the return status of the command
called.
</p>
<p>If the option &lsquo;<tt>-p</tt>&rsquo; is supplied it indicates that the command
output is influenced by the permissions it is run with. If the
<tt>gain-privileges</tt> style is set to true, <tt>_call_program</tt> will make
use of commands such as <tt>sudo</tt>, if present on the command-line, to
match the permissions to whatever the final command is likely to run
under. When looking up the <tt>gain-privileges</tt> and <tt>command</tt> styles,
the command component of the zstyle context will end with a slash
(&lsquo;<tt>/</tt>&rsquo;) followed by the command that would be used to gain privileges.
</p>
<a name="index-_005fcombination"></a>
</dd>
<dt><tt>_combination</tt> [ <tt>-s</tt> <var>pattern</var> ] <var>tag</var> <var>style</var> <var>spec</var> ... <var>field</var> <var>opts</var> ...</dt>
<dd><p>This function is used to complete combinations of values,  for example
pairs of hostnames and usernames.  The <var>style</var> argument gives the style
which defines the pairs; it is looked up in a context with the <var>tag</var>
specified.
</p>
<p>The style name consists of field names separated by hyphens, for example
&lsquo;<tt>users-hosts-ports</tt>&rsquo;.  For each field for a value is already known, a
<var>spec</var> of the form &lsquo;<var>field</var><tt>=</tt><var>pattern</var>&rsquo; is given.  For example,
if the command line so far specifies a user &lsquo;<tt>pws</tt>&rsquo;, the argument
&lsquo;<tt>users=pws</tt>&rsquo; should appear.
</p>
<p>The next argument with no equals sign is taken as the name of the field
for which completions should be generated (presumably not one of the
<var>field</var>s for which the value is known).
</p>
<p>The matches generated will be taken from the value of the style.  These
should contain the possible values for the combinations in the appropriate
order (users, hosts, ports in the example above).  The different fields
the values for the different fields are separated by colons.  This
can be altered with the option <tt>-s</tt> to <tt>_combination</tt> which specifies a
pattern.  Typically this is a character class, as for example
&lsquo;<tt>-s &quot;[:@]&quot;</tt>&rsquo; in the case of the <tt>users-hosts</tt> style.    Each
&lsquo;<var>field</var><tt>=</tt><var>pattern</var>&rsquo; specification restricts the
completions which apply to elements of the style with appropriately
matching fields.
</p>
<p>If no style with the given name is defined for the given tag,
or if none of the strings in style&rsquo;s value match, but a
function name of the required field preceded by an
underscore is defined, that function will be called to generate the
matches.  For example, if there is no &lsquo;<tt>users-hosts-ports</tt>&rsquo; or no
matching hostname when a host is required, the function &lsquo;<tt>_hosts</tt>&rsquo; will
automatically be called.
</p>
<p>If the same name is used for more than one field, in both the
&lsquo;<var>field</var><tt>=</tt><var>pattern</var>&rsquo; and the argument that gives the name of the
field to be completed, the number of the field (starting with one) may
be given after the fieldname, separated from it by a colon.
</p>
<p>All arguments after the required field name are passed to
<tt>compadd</tt> when generating matches from the style value, or to 
the functions for the fields if they are called.
</p>
<a name="index-_005fcommand_005fnames"></a>
</dd>
<dt><tt>_command_names</tt> [ <tt>-e</tt> | <tt>-</tt> ]</dt>
<dd><p>This function completes words that are valid at command position: names of
aliases, builtins, hashed commands, functions, and so on.  With the <tt>-e</tt>
flag, only hashed commands are completed.  The <tt>-</tt> flag is ignored.
</p>
<a name="index-_005fcompleters"></a>
</dd>
<dt><tt>_completers</tt> [ <tt>-p</tt> ]</dt>
<dd><p>This function completes names of completers.
</p>
<dl compact="compact">
<dt><tt>-p</tt></dt>
<dd><p>Include the leading underscore (&lsquo;<tt>_</tt>&rsquo;) in the matches.
</p>
</dd>
</dl>

<a name="index-_005fdescribe"></a>

</dd>
<dt><tt>_describe </tt>[<tt>-12JVx</tt>] [ <tt>-oO</tt> | <tt>-t</tt> <var>tag</var> ] <var>descr</var> <var>name1</var> [ <var>name2</var> ] [ <var>opt</var> ... ]</dt>
<dt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt>[ <tt>-</tt><tt>-</tt> <var>name1</var> [ <var>name2</var> ] [ <var>opt</var> ... ] ... ]</dt>
<dd><p>This function associates completions with descriptions.
Multiple groups separated by <tt>-</tt><tt>-</tt> can be supplied, potentially with
different completion options <var>opt</var>s.
</p>
<p>The <var>descr</var> is taken as a string to display above the matches if the
<tt>format</tt> style for the <tt>descriptions</tt> tag is set.  This is followed by
one or two names of arrays followed by options to pass to <tt>compadd</tt>.  The
array <var>name1</var> contains the possible completions with their descriptions in
the form &lsquo;<var>completion</var><tt>:</tt><var>description</var>&rsquo;.  Any literal colons in
<var>completion</var> must be quoted with a backslash.  If a <var>name2</var> is
given, it should have the same number of elements as <var>name1</var>; in this
case the corresponding elements are added as possible completions instead
of the <var>completion</var> strings from <var>name1</var>.  The completion list
will retain the descriptions from <var>name1</var>.  Finally, a set of
completion options can appear.
</p>
<p>If the option &lsquo;<tt>-o</tt>&rsquo; appears before the first argument, the matches added
will be treated as names of command options (N.B. not shell options),
typically following a &lsquo;<tt>-</tt>&rsquo;, &lsquo;<tt>-</tt><tt>-</tt>&rsquo; or &lsquo;<tt>+</tt>&rsquo; on the command
line.  In this case <tt>_describe</tt> uses the <tt>prefix-hidden</tt>,
<tt>prefix-needed</tt> and <tt>verbose</tt> styles to find out if the strings should
be added as completions and if the descriptions should be shown.  Without
the &lsquo;<tt>-o</tt>&rsquo; option, only the <tt>verbose</tt> style is used to decide how
descriptions are shown.  If &lsquo;<tt>-O</tt>&rsquo; is used instead of &lsquo;<tt>-o</tt>&rsquo;, command
options are completed as above but <tt>_describe</tt> will not handle the
<tt>prefix-needed</tt> style.
</p>
<p>With the <tt>-t</tt> option a <var>tag</var> can be specified.  The default is
&lsquo;<tt>values</tt>&rsquo; or, if the <tt>-o</tt> option is given, &lsquo;<tt>options</tt>&rsquo;.
</p>
<p>The options <tt>-1</tt>, <tt>-2</tt>, <tt>-J</tt>, <tt>-V</tt>, <tt>-x</tt> are passed to
<tt>_next_label</tt>.
</p>
<p>If selected by the <tt>list-grouped</tt> style, strings with the same
description will appear together in the list.
</p>
<p><tt>_describe</tt> uses the <tt>_all_labels</tt> function to generate the matches, so
it does not need to appear inside a loop over tag labels.
</p>
<a name="index-_005fdescription"></a>
</dd>
<dt><tt>_description</tt> [ <tt>-x</tt> ] [ <tt>-12VJ</tt> ] <var>tag</var> <var>name</var> <var>descr</var> [ <var>spec</var> ... ]</dt>
<dd><p>This function is not to be confused with the previous one; it is used as
a helper function for creating options to <tt>compadd</tt>.  It is buried
inside many of the higher level completion functions and so often does
not need to be called directly.
</p>
<p>The styles listed below are tested in the current context using the
given <var>tag</var>.  The resulting options for <tt>compadd</tt> are put into the
array named <var>name</var> (this is traditionally &lsquo;<tt>expl</tt>&rsquo;, but this
convention is not enforced).  The description for the corresponding set
of matches is passed to the function in <var>descr</var>.
</p>
<p>The styles tested are: <tt>format</tt>, <tt>hidden</tt>, <tt>matcher</tt>,
<tt>ignored-patterns</tt> and <tt>group-name</tt>.  The <tt>format</tt> style is first
tested for the given <var>tag</var> and then for the <tt>descriptions</tt> tag if
no value was found, while the remainder are only tested for the tag
given as the first argument.  The function also calls <tt>_setup</tt>
which tests some more styles.
</p>
<p>The string returned by the <tt>format</tt> style (if any) will be modified so
that the sequence &lsquo;<tt>%d</tt>&rsquo; is replaced by the <var>descr</var> given as the third
argument without any leading or trailing white space.  If, after
removing the white space, the <var>descr</var> is the empty string, the format
style will not be used and the options put into the <var>name</var> array will
not contain an explanation string to be displayed above the matches.
</p>
<p>If <tt>_description</tt> is called with more than three arguments,
the additional <var>spec</var>s should be of the form &lsquo;<var>char</var><tt>:</tt><var>str</var>&rsquo;.
These supply escape sequence replacements for the <tt>format</tt> style:
every appearance of &lsquo;<tt>%</tt><var>char</var>&rsquo; will be
replaced by <var>string</var>.
</p>
<p>If the <tt>-x</tt> option is given, the description will be passed to
<tt>compadd</tt> using the <tt>-x</tt> option instead of the default <tt>-X</tt>.  This
means that the description will be displayed even if there are no
corresponding matches.
</p>
<p>The options placed in the array <var>name</var> take account of the
<tt>group-name</tt> style, so matches are placed in a separate group where
necessary.  The group normally has its elements sorted (by passing the
option <tt>-J</tt> to <tt>compadd</tt>), but if an option starting with &lsquo;<tt>-V</tt>&rsquo;,
&lsquo;<tt>-J</tt>&rsquo;, &lsquo;<tt>-1</tt>&rsquo;, or &lsquo;<tt>-2</tt>&rsquo; is passed to <tt>_description</tt>, that
option will be included in the array.  Hence it is possible for the
completion group to be unsorted by giving the option &lsquo;<tt>-V</tt>&rsquo;,
&lsquo;<tt>-1V</tt>&rsquo;, or &lsquo;<tt>-2V</tt>&rsquo;.
</p>
<p>In most cases, the function will be used like this:
</p>
<div class="example">
<pre class="example">local expl
_description files expl file
compadd &quot;$expl[@]&quot; - &quot;$files[@]&quot;
</pre></div>

<p>Note the use of the parameter <tt>expl</tt>, the hyphen, and the list of
matches.  Almost all calls to <tt>compadd</tt> within the completion system use
a similar format; this ensures that user-specified styles are correctly
passed down to the builtins which implement the internals of completion.
</p>
<a name="index-_005fdir_005flist"></a>
</dd>
<dt><tt>_dir_list</tt> [ <tt>-s</tt> <var>sep</var> ] [ <tt>-S</tt> ]</dt>
<dd><p>Complete a list of directory names separated by colons
(the same format as <tt>$PATH</tt>).
</p>
<dl compact="compact">
<dt><tt>-s</tt> <var>sep</var></dt>
<dd><p>Use <var>sep</var> as separator between items.
<var>sep</var> defaults to a colon (&lsquo;<tt>:</tt>&rsquo;).
</p>
</dd>
<dt><tt>-S</tt></dt>
<dd><p>Add <var>sep</var> instead of slash (&lsquo;<tt>/</tt>&rsquo;) as an autoremoveable suffix.
</p>
</dd>
</dl>

<a name="index-_005fdispatch"></a>
</dd>
<dt><tt>_dispatch</tt> <var>context string</var> ...</dt>
<dd><p>This sets the current context to <var>context</var> and looks for completion
functions to handle this context by hunting through the list of command
names or special contexts (as described above for <tt>compdef</tt>)
given as <var>string</var>s.  The first completion function to be defined
for one of the contexts in the list is used to generate matches.
Typically, the last <var>string</var> is <tt>-default-</tt> to cause the function
for default completion to be used as a fallback.
</p>
<p>The function sets the parameter
<tt>$service</tt> to the <var>string</var> being tried, and sets
the <var>context/command</var> field (the fourth) of the <tt>$curcontext</tt>
parameter to the <var>context</var> given as the first argument.
</p>
<a name="index-_005femail_005faddresses"></a>
</dd>
<dt><tt>_email_addresses</tt> [ <tt>-c</tt> ] [ <tt>-n</tt> <var>plugin</var> ]</dt>
<dd><p>Complete email addresses.  Addresses are provided by plugins.
</p>
<dl compact="compact">
<dt><tt>-c</tt></dt>
<dd><p>Complete bare <tt>localhost@domain.tld</tt> addresses, without a name part or
a comment.
Without this option, RFC822 &lsquo;<var>Firstname Lastname</var> <tt>&lt;</tt><var>address</var><tt>&gt;</tt>&rsquo;
strings are completed.
</p>
</dd>
<dt><tt>-n</tt> <var>plugin</var></dt>
<dd><p>Complete aliases from <var>plugin</var>.  
</p>
</dd>
</dl>

<p>The following plugins are available by default:
<tt>_email-ldap</tt> (see the <tt>filter</tt> style),
<tt>_email-local</tt> (completes <var>user</var><tt>@</tt><var>hostname</var> Unix addresses),
<tt>_email-mail</tt> (completes aliases from <tt>~/.mailrc</tt>),
<tt>_email-mush</tt>,
<tt>_email-mutt</tt>,
and
<tt>_email-pine</tt>.
</p>
<p>Addresses from the <tt>_email-</tt><var>foo</var> plugin are added under the
tag &lsquo;<tt>email-</tt><var>foo</var>&rsquo;.
</p>
<p><em>Writing plugins</em>
</p>
<p>Plugins are written as separate functions with names starting with &lsquo;<tt>_email-</tt>&rsquo;.
They are invoked with the <tt>-c</tt> option and <tt>compadd</tt> options.
They should either do their own completion or
set the <tt>$reply</tt> array to a list of &lsquo;<var>alias</var><tt>:</tt><var>address</var>&rsquo; elements and return <tt>300</tt>.
New plugins will be picked up and run automatically.
</p>
<a name="index-_005ffiles"></a>
</dd>
<dt><tt>_files</tt></dt>
<dd><p>The function <tt>_files</tt> calls <tt>_path_files</tt> with all the arguments it
was passed except for <tt>-g</tt> and <tt>-/</tt>.  The use of these two options
depends on the setting of the  <tt>file-patterns</tt> style.
</p>
<p>This function accepts the full set of options allowed by
<tt>_path_files</tt>, described below.
</p>
<a name="index-_005fgnu_005fgeneric"></a>
</dd>
<dt><tt>_gnu_generic</tt></dt>
<dd><p>This function is a simple wrapper around the <tt>_arguments</tt> function
described above.  It can be used to determine automatically the long
options understood by commands that produce a list when passed the
option &lsquo;<tt>-</tt><tt>-help</tt>&rsquo;.  It is intended to be used as a top-level
completion function in its own right.  For example, to enable option
completion for the commands <tt>foo</tt> and <tt>bar</tt>, use
</p>
<div class="example">
<pre class="example">compdef _gnu_generic foo bar
</pre></div>

<p>after the call to <tt>compinit</tt>.
</p>
<p>The completion system as supplied is conservative in its use of this
function, since it is important to be sure the command understands the
option &lsquo;<tt>-</tt><tt>-help</tt>&rsquo;.
</p>
<a name="index-_005fguard"></a>
</dd>
<dt><tt>_guard</tt> [ <var>options</var> ] <var>pattern descr</var></dt>
<dd><p>This function displays <var>descr</var> if <var>pattern</var> matches the string to
be completed.  It is intended to be used in the <var>action</var> for the
specifications passed to <tt>_arguments</tt> and similar functions.
</p>
<p>The return status is zero if the message was displayed and the word to
complete is not empty, and non-zero otherwise.
</p>
<p>The <var>pattern</var> may be preceded by any of the options understood by
<tt>compadd</tt> that are passed down from <tt>_description</tt>, namely <tt>-M</tt>,
<tt>-J</tt>, <tt>-V</tt>, <tt>-1</tt>, <tt>-2</tt>, <tt>-n</tt>, <tt>-F</tt> and <tt>-X</tt>.  All of these
options will be ignored.  This fits in conveniently with the
argument-passing conventions of actions for <tt>_arguments</tt>.
</p>
<p>As an example, consider a command taking the options <tt>-n</tt> and
<tt>-none</tt>, where <tt>-n</tt> must be followed by a numeric value in the
same word.  By using:
</p>
<div class="example">
<pre class="example">_arguments '-n-: :_guard &quot;[0-9]#&quot; &quot;numeric value&quot;' '-none'
</pre></div>

<p><tt>_arguments</tt> can be made to both display the message &lsquo;<tt>numeric
value</tt>&rsquo; and complete options after &lsquo;<tt>-n&lt;TAB&gt;</tt>&rsquo;.  If the &lsquo;<tt>-n</tt>&rsquo; is
already followed by one or more digits (the pattern passed to
<tt>_guard</tt>) only the message will be displayed; if the &lsquo;<tt>-n</tt>&rsquo; is
followed by another character, only options are completed.
</p>
<a name="index-_005fmessage"></a>
</dd>
<dt><tt>_message</tt> [ <tt>-r12</tt> ] [ <tt>-VJ</tt> <var>group</var> ] <var>descr</var></dt>
<dt><tt>_message -e</tt> [ <var>tag</var> ] <var>descr</var></dt>
<dd><p>The <var>descr</var> is used in the same way as the third
argument to the <tt>_description</tt> function, except that the resulting
string will always be shown whether or not matches were
generated.  This is useful for displaying a help message in places where
no completions can be generated.
</p>
<p>The <tt>format</tt> style is examined with the <tt>messages</tt> tag to find a
message; the usual tag, <tt>descriptions</tt>, is used only if the style is
not set with the former.
</p>
<p>If the <tt>-r</tt> option is given, no style is used; the <var>descr</var> is
taken literally as the string to display.  This is most useful
when the <var>descr</var> comes from a pre-processed argument list
which already contains an expanded description.
</p>
<p>The <tt>-12VJ</tt> options and the <var>group</var> are passed to <tt>compadd</tt> and
hence determine the group the message string is added to.
</p>
<p>The second <tt>-e</tt> form gives a description for completions with the tag
<var>tag</var> to be shown even if there are no matches for that tag.  This form
is called by <tt>_arguments</tt> in the event that there is no action for an
option specification.  The tag can be omitted and if so the tag is taken
from the parameter <tt>$curtag</tt>; this is maintained by the completion
system and so is usually correct.  Note that if there are no matches at
the time this function is called, <tt>compstate[insert]</tt> is cleared, so
additional matches generated later are not inserted on the command line.
</p>
<a name="index-_005fmulti_005fparts"></a>
</dd>
<dt><tt>_multi_parts</tt> [ <tt>-i</tt> ] <var>sep</var> <var>array</var></dt>
<dd><p>The argument <var>sep</var> is a separator character.
The <var>array</var> may be either the
name of an array parameter or a literal array in the form
&lsquo;<tt>(foo bar</tt><tt>)</tt>&rsquo;, a parenthesised list of words separated
by whitespace.  The possible completions are the
strings from the array.  However, each chunk delimited by <var>sep</var> will be
completed separately.  For example, the <tt>_tar</tt> function uses
&lsquo;<tt>_multi_parts</tt> <tt>/</tt> <var>patharray</var>&rsquo; to complete partial file paths
from the given array of complete file paths.
</p>
<p>The <tt>-i</tt> option causes <tt>_multi_parts</tt> to insert a unique match even
if that requires multiple separators to be inserted.  This is not usually
the expected behaviour with filenames, but certain other types of
completion, for example those with a fixed set of possibilities, may be
more suited to this form.
</p>
<p>Like other utility functions, this function accepts the &lsquo;<tt>-V</tt>&rsquo;,
&lsquo;<tt>-J</tt>&rsquo;, &lsquo;<tt>-1</tt>&rsquo;, &lsquo;<tt>-2</tt>&rsquo;, &lsquo;<tt>-n</tt>&rsquo;, &lsquo;<tt>-f</tt>&rsquo;, &lsquo;<tt>-X</tt>&rsquo;, &lsquo;<tt>-M</tt>&rsquo;,
&lsquo;<tt>-P</tt>&rsquo;, &lsquo;<tt>-S</tt>&rsquo;, &lsquo;<tt>-r</tt>&rsquo;, &lsquo;<tt>-R</tt>&rsquo;, and &lsquo;<tt>-q</tt>&rsquo; options and passes
them to the <tt>compadd</tt> builtin.
</p>
<a name="index-_005fnext_005flabel"></a>
</dd>
<dt><tt>_next_label</tt> [ <tt>-x</tt> ] [ <tt>-12VJ</tt> ] <var>tag</var> <var>name</var> <var>descr</var> [ <var>option</var> ... ]</dt>
<dd><p>This function is used to implement the loop over different tag
labels for a particular tag as described above for the <tt>tag-order</tt>
style.  On each call it checks to see if there are any more tag labels; if
there is it returns status zero, otherwise non-zero.
As this function requires a current tag to be set, it must always follow
a call to <tt>_tags</tt> or <tt>_requested</tt>.
</p>
<p>The <tt>-x12VJ</tt> options and the first three arguments are passed to the
<tt>_description</tt> function.  Where appropriate the <var>tag</var> will be
replaced by a tag label in this call.  Any description given in
the <tt>tag-order</tt> style is preferred to the <var>descr</var> passed to
<tt>_next_label</tt>.
</p>
<p>The <var>option</var>s given after the <var>descr</var>
are set in the parameter given by <var>name</var>, and hence are to be passed
to <tt>compadd</tt> or whatever function is called to add the matches.
</p>
<p>Here is a typical use of this function for the tag <tt>foo</tt>.  The call to
<tt>_requested</tt> determines if tag <tt>foo</tt> is required at all; the loop
over <tt>_next_label</tt> handles any labels defined for the tag in the
<tt>tag-order</tt> style.
</p>
<div class="example">
<pre class="example">local expl ret=1
...
if _requested foo; then
  ...
  while _next_label foo expl '...'; do
    compadd &quot;$expl[@]&quot; ... &amp;&amp; ret=0
  done
  ...
fi
return ret
</pre></div>

<a name="index-_005fnormal"></a>
</dd>
<dt><tt>_normal</tt></dt>
<dd><p>This is the standard function called to handle completion outside
any special <tt>-</tt><var>context</var><tt>-</tt>.  It is called both to complete the command
word and also the arguments for a command.  In the second case,
<tt>_normal</tt> looks for a special completion for that command, and if
there is none it uses the completion for the <tt>-default-</tt> context.
</p>
<p>A second use is to reexamine the command line specified by the <tt>$words</tt>
array and the <tt>$CURRENT</tt> parameter after those have been modified.
For example, the function <tt>_precommand</tt>, which
completes after pre-command specifiers such as <tt>nohup</tt>, removes the
first word from the <tt>words</tt> array, decrements the <tt>CURRENT</tt> parameter,
then calls <tt>_normal</tt> again.  The effect is that &lsquo;<tt>nohup</tt> <var>cmd ...</var>&rsquo;
is treated in the same way as &lsquo;<var>cmd ...</var>&rsquo;.
</p>
<p>If the command name matches one of the patterns given by one of the
options <tt>-p</tt> or <tt>-P</tt> to <tt>compdef</tt>, the corresponding completion
function is called and then the parameter <tt>_compskip</tt> is
checked.  If it is set completion is terminated at that point even if
no matches have been found.  This is the same effect as in the
<tt>-first-</tt> context.
</p>
<a name="index-_005foptions"></a>
</dd>
<dt><tt>_options</tt></dt>
<dd><p>This can be used to complete the names of shell options.  It provides a
matcher specification that ignores a leading &lsquo;<tt>no</tt>&rsquo;, ignores
underscores and allows upper-case letters to
match their lower-case counterparts (for example, &lsquo;<tt>glob</tt>&rsquo;,
&lsquo;<tt>noglob</tt>&rsquo;, &lsquo;<tt>NO_GLOB</tt>&rsquo; are all completed).  Any arguments
are propagated to the <tt>compadd</tt> builtin.
</p>
<a name="index-_005foptions_005fset"></a>
<a name="index-_005foptions_005funset"></a>
</dd>
<dt><tt>_options_set</tt> and <tt>_options_unset</tt></dt>
<dd><p>These functions complete only set or unset options, with the same
matching specification used in the <tt>_options</tt> function.
</p>
<p>Note that you need to uncomment a few lines in the <tt>_main_complete</tt>
function for these functions to work properly.  The lines in question
are used to store the option settings in effect before the completion
widget locally sets the options it needs.  Hence these functions are not
generally used by the completion system.
</p>
<a name="index-_005fparameters"></a>
</dd>
<dt><tt>_parameters</tt></dt>
<dd><p>This is used to complete the names of shell parameters.
</p>
<p>The option &lsquo;<tt>-g</tt> <var>pattern</var>&rsquo; limits the completion to parameters
whose type matches the <var>pattern</var>.  The type of a parameter is that
shown by &lsquo;<tt>print ${(t)</tt><var>param</var><tt>}</tt>&rsquo;, hence judicious use of
&lsquo;<tt>*</tt>&rsquo; in <var>pattern</var> is probably necessary.
</p>
<p>All other arguments are passed to the <tt>compadd</tt> builtin.
</p>
<a name="index-_005fpath_005ffiles"></a>
</dd>
<dt><tt>_path_files</tt></dt>
<dd><p>This function is used throughout the completion system
to complete filenames.  It allows completion of partial paths.  For
example, the string &lsquo;<tt>/u/i/s/sig</tt>&rsquo; may be completed to
&lsquo;<tt>/usr/include/sys/signal.h</tt>&rsquo;.
</p>
<p>The options accepted by both <tt>_path_files</tt> and <tt>_files</tt> are:
</p>
<dl compact="compact">
<dt><tt>-f</tt></dt>
<dd><p>Complete all filenames.  This is the default.
</p>
</dd>
<dt><tt>-/</tt></dt>
<dd><p>Specifies that only directories should be completed.
</p>
</dd>
<dt><tt>-g</tt> <var>pattern</var></dt>
<dd><p>Specifies that only files matching the <var>pattern</var> should be completed.
</p>
</dd>
<dt><tt>-W</tt> <var>paths</var></dt>
<dd><p>Specifies path prefixes that are to be prepended to the string from the
command line to generate the filenames but that should not be inserted
as completions nor shown in completion listings.  Here, <var>paths</var> may be
the name of an array parameter, a literal list of paths enclosed in
parentheses or an absolute pathname.
</p>
</dd>
<dt><tt>-F</tt> <var>ignored-files</var></dt>
<dd><p>This behaves as for the corresponding option to the <tt>compadd</tt> builtin.
It gives direct control over which
filenames should be ignored.  If the option is not present, the
<tt>ignored-patterns</tt> style is used.
</p>
</dd>
</dl>

<p>Both <tt>_path_files</tt> and <tt>_files</tt> also accept the following options
which are passed to <tt>compadd</tt>: &lsquo;<tt>-J</tt>&rsquo;, &lsquo;<tt>-V</tt>&rsquo;,
&lsquo;<tt>-1</tt>&rsquo;, &lsquo;<tt>-2</tt>&rsquo;, &lsquo;<tt>-n</tt>&rsquo;, &lsquo;<tt>-X</tt>&rsquo;, &lsquo;<tt>-M</tt>&rsquo;, &lsquo;<tt>-P</tt>&rsquo;, &lsquo;<tt>-S</tt>&rsquo;,
&lsquo;<tt>-q</tt>&rsquo;, &lsquo;<tt>-r</tt>&rsquo;, and &lsquo;<tt>-R</tt>&rsquo;.
</p>
<p>Finally, the <tt>_path_files</tt> function  uses the styles <tt>expand</tt>,
<tt>ambiguous</tt>, <tt>special-dirs</tt>, <tt>list-suffixes</tt> and <tt>file-sort</tt>
described above.
</p>
<a name="index-_005fpick_005fvariant"></a>

</dd>
<dt><tt>_pick_variant </tt>[ <tt>-b</tt> <var>builtin-label</var> ] [ <tt>-c</tt> <var>command</var> ] [ <tt>-r</tt> <var>name</var> ]</dt>
<dt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt><var>label</var><tt>=</tt><var>pattern</var> ... <var>label</var> [ <var>arg</var> ... ]</dt>
<dd><p>This function is used to resolve situations where a single command name
requires more than one type of handling, either because it
has more than one variant or because there is a name clash between two
different commands.
</p>
<p>The command to run is taken from the first element of the array
<tt>words</tt> unless this is overridden by the option <tt>-c</tt>.  This command
is run and its output is compared with a series of patterns.  Arguments
to be passed to the command can be specified at the end after all the
other arguments.  The patterns to try in order are given by the arguments
<var>label</var><tt>=</tt><var>pattern</var>; if the output of &lsquo;<var>command</var> <var>arg</var>
...&rsquo; contains <var>pattern</var>, then <var>label</var> is selected as the label
for the command variant.  If none of the patterns match, the final
command label is selected and status 1 is returned.
</p>
<p>If the &lsquo;<tt>-b</tt> <var>builtin-label</var>&rsquo; is given, the command is tested to
see if it is provided as a shell builtin, possibly autoloaded; if so,
the label <var>builtin-label</var> is selected as the label for the variant.
</p>
<p>If the &lsquo;<tt>-r</tt> <var>name</var>&rsquo; is given, the <var>label</var> picked is stored in
the parameter named <var>name</var>.
</p>
<p>The results are also cached in the <tt>_cmd_variant</tt> associative array
indexed by the name of the command run.
</p>
<a name="index-_005fregex_005farguments"></a>
</dd>
<dt><tt>_regex_arguments</tt> <var>name</var> <var>spec</var> ...</dt>
<dd><p>This function generates a completion function <var>name</var> which matches
the specifications <var>spec</var>s, a set of regular expressions as
described below.  After running <tt>_regex_arguments</tt>, the function
<var>name</var> should be called as a normal completion function.
The pattern to be matched is given by the contents of
the <tt>words</tt> array up to the current cursor position joined together
with null characters; no quotation is applied.
</p>
<p>The arguments are grouped as sets of alternatives separated by &lsquo;<tt>|</tt>&rsquo;,
which are tried one after the other until one matches.  Each alternative
consists of a one or more specifications which are tried left to right,
with each pattern matched being stripped in turn from the command line
being tested, until all of the group succeeds or until one fails; in the
latter case, the next alternative is tried.  This structure can be
repeated to arbitrary depth by using parentheses; matching proceeds from
inside to outside.
</p>
<p>A special procedure is applied if no test succeeds but the remaining
command line string contains no null character (implying the remaining
word is the one for which completions are to be generated).  The
completion target is restricted to the remaining word and any
<var>action</var>s for the corresponding patterns are executed.  In this case,
nothing is stripped from the command line string.  The order of
evaluation of the <var>action</var>s can be determined by the <tt>tag-order</tt>
style; the various formats supported by <tt>_alternative</tt> can be used
in <var>action</var>.  The <var>descr</var> is used for setting up the array
parameter <tt>expl</tt>.
</p>
<p>Specification arguments take one of following forms, in which
metacharacters such as &lsquo;<tt>(</tt>&rsquo;, &lsquo;<tt>)</tt>&rsquo;, &lsquo;<tt>#</tt>&rsquo; and &lsquo;<tt>|</tt>&rsquo;
should be quoted.
</p>
<dl compact="compact">
<dt><tt>/</tt><var>pattern</var><tt>/</tt> [<tt>%</tt><var>lookahead</var><tt>%</tt>] [<tt>-</tt><var>guard</var>] [<tt>:</tt><var>tag</var><tt>:</tt><var>descr</var><tt>:</tt><var>action</var>]</dt>
<dd><p>This is a single primitive component.
The function tests whether the combined pattern
&lsquo;<tt>(#b)((#B)</tt><var>pattern</var><tt>)</tt><var>lookahead</var><tt>*</tt>&rsquo; matches
the command line string.  If so, &lsquo;<var>guard</var>&rsquo; is evaluated and
its return status is examined to determine if the test has succeeded.
The <var>pattern</var> string &lsquo;<tt>[]</tt>&rsquo; is guaranteed never to match.
The <var>lookahead</var> is not stripped from the command line before the next
pattern is examined.
</p>
<p>The argument starting with <tt>:</tt> is used in the same manner as an argument to
<tt>_alternative</tt>.
</p>
<p>A component is used as follows: <var>pattern</var> is tested to
see if the component already exists on the command line.  If
it does, any following specifications are examined to find something to
complete.  If a component is reached but no such pattern exists yet on the
command line, the string containing the <var>action</var> is used to generate
matches to insert at that point.
</p>
</dd>
<dt><tt>/</tt><var>pattern</var><tt>/+</tt> [<tt>%</tt><var>lookahead</var><tt>%</tt>] [<tt>-</tt><var>guard</var>] [<tt>:</tt><var>tag</var><tt>:</tt><var>descr</var><tt>:</tt><var>action</var>]</dt>
<dd><p>This is similar to &lsquo;<tt>/</tt><var>pattern</var><tt>/</tt> ...&rsquo; but the left part of the
command line string (i.e. the part already matched by previous patterns)
is also considered part of the completion target.
</p>
</dd>
<dt><tt>/</tt><var>pattern</var><tt>/-</tt> [<tt>%</tt><var>lookahead</var><tt>%</tt>] [<tt>-</tt><var>guard</var>] [<tt>:</tt><var>tag</var><tt>:</tt><var>descr</var><tt>:</tt><var>action</var>]</dt>
<dd><p>This is similar to &lsquo;<tt>/</tt><var>pattern</var><tt>/</tt> ...&rsquo; but the <var>action</var>s of the
current and previously matched patterns are ignored even if the
following &lsquo;<var>pattern</var>&rsquo; matches the empty string.
</p>
</dd>
<dt><tt>(</tt> <var>spec</var> <tt>)</tt></dt>
<dd><p>Parentheses may be used to groups <var>spec</var>s; note each parenthesis
is a single argument to <tt>_regex_arguments</tt>.
</p>
</dd>
<dt><var>spec</var> <tt>#</tt></dt>
<dd><p>This allows any number of repetitions of <var>spec</var>.
</p>
</dd>
<dt><var>spec</var> <var>spec</var></dt>
<dd><p>The two <var>spec</var>s are to be matched one after the other as described
above.
</p>
</dd>
<dt><var>spec</var> <tt>|</tt> <var>spec</var></dt>
<dd><p>Either of the two <var>spec</var>s can be matched.
</p>
</dd>
</dl>

<p>The function <tt>_regex_words</tt> can be used as a helper function to
generate matches for a set of alternative words possibly with
their own arguments as a command line argument.
</p>
<p>Examples:
</p>
<div class="example">
<pre class="example">_regex_arguments _tst /$'[^\0]#\0'/ \ 
    /$'[^\0]#\0'/ :'compadd aaa'
</pre></div>

<p>This generates a function <tt>_tst</tt> that completes <tt>aaa</tt> as its only
argument.  The <var>tag</var> and <var>description</var> for the action have been
omitted for brevity (this works but is not recommended in normal use).
The first component matches the command word, which is arbitrary; the
second matches  any argument.  As the argument is also arbitrary, any
following component would not depend on <tt>aaa</tt> being present.
</p>
<div class="example">
<pre class="example">_regex_arguments _tst /$'[^\0]#\0'/ \ 
    /$'aaa\0'/ :'compadd aaa'
</pre></div>

<p>This is a more typical use; it is similar, but any following patterns
would only match if <tt>aaa</tt> was present as the first argument.
</p>
<div class="example">
<pre class="example">_regex_arguments _tst /$'[^\0]#\0'/ \( \ 
    /$'aaa\0'/ :'compadd aaa' \ 
    /$'bbb\0'/ :'compadd bbb' \) \#
</pre></div>

<p>In this example, an indefinite number of command arguments may be
completed.  Odd arguments are completed as <tt>aaa</tt> and even arguments
as <tt>bbb</tt>.  Completion fails unless the set of <tt>aaa</tt> and <tt>bbb</tt>
arguments before the current one is matched correctly.
</p>
<div class="example">
<pre class="example">_regex_arguments _tst /$'[^\0]#\0'/ \ 
    \( /$'aaa\0'/ :'compadd aaa' \| \ 
    /$'bbb\0'/ :'compadd bbb' \) \#
</pre></div>

<p>This is similar, but either <tt>aaa</tt> or <tt>bbb</tt> may be completed for
any argument.  In this case <tt>_regex_words</tt> could be used to generate
a suitable expression for the arguments.
</p>

<a name="index-_005fregex_005fwords-_005b-_002dt-term-_005d"></a>
</dd>
<dt><tt>_regex_words</tt> <var>tag</var> <var>description</var> <var>spec</var> ...</dt>
<dd><p>This function can be used to generate arguments for the
<tt>_regex_arguments</tt> command which may be inserted at any point where
a set of rules is expected.  The <var>tag</var> and <var>description</var> give a
standard tag and description pertaining to the current context.  Each
<var>spec</var> contains two or three arguments separated by a colon: note
that there is no leading colon in this case.
</p>
<p>Each <var>spec</var> gives one of a set of words that may be completed at
this point, together with arguments.  It is thus roughly equivalent to
the <tt>_arguments</tt> function when used in normal (non-regex) completion.
</p>
<p>The part of the <var>spec</var> before the first colon is the word to be
completed.  This may contain a <tt>*</tt>; the entire word, before and after
the <tt>*</tt> is completed, but only the text before the <tt>*</tt> is required
for the context to be matched, so that further arguments may be
completed after the abbreviated form.
</p>
<p>The second part of <var>spec</var> is a description for the word being
completed.
</p>
<p>The optional third part of the <var>spec</var> describes how words following
the one being completed are themselves to be completed.  It will be
evaluated in order to avoid problems with quoting.  This means that
typically it contains a reference to an array containing previously
generated regex arguments.
</p>
<p>The option <tt>-t</tt> <var>term</var> specifies a terminator for the word
instead of the usual space.  This is handled as an auto-removable suffix
in the manner of the option <tt>-s</tt> <var>sep</var> to <tt>_values</tt>.
</p>
<p>The result of the processing by <tt>_regex_words</tt> is placed in the array
<tt>reply</tt>, which should be made local to the calling function.
If the set of words and arguments may be matched repeatedly, a <tt>#</tt>
should be appended to the generated array at that point.
</p>
<p>For example:
</p>
<div class="example">
<pre class="example">local -a reply
_regex_words mydb-commands 'mydb commands' \ 
  'add:add an entry to mydb:$mydb_add_cmds' \ 
  'show:show entries in mydb'
_regex_arguments _mydb &quot;$reply[@]&quot;
_mydb &quot;$@&quot;
</pre></div>

<p>This shows a completion function for a command <tt>mydb</tt> which takes
two command arguments, <tt>add</tt> and <tt>show</tt>.  <tt>show</tt> takes no arguments,
while the arguments for <tt>add</tt> have already been prepared in an
array <tt>mydb_add_cmds</tt>, quite possibly by a previous call to
<tt>_regex_words</tt>.
</p>
<a name="index-_005frequested"></a>
</dd>
<dt><tt>_requested</tt> [ <tt>-x</tt> ] [ <tt>-12VJ</tt> ] <var>tag</var> [ <var>name</var> <var>descr</var> [ <var>command</var> [ <var>arg</var> ... ] ]</dt>
<dd><p>This function is called to decide whether a tag already registered by a
call to <tt>_tags</tt> (see below) has been requested by the user and hence
completion should be performed for it.  It returns status zero if the
tag is requested and non-zero otherwise.  The function is typically used
as part of a loop over different tags as follows:
</p>
<div class="example">
<pre class="example">_tags foo bar baz
while _tags; do
  if _requested foo; then
    ... # perform completion for foo
  fi
  ... # test the tags bar and baz in the same way
  ... # exit loop if matches were generated
done
</pre></div>

<p>Note that the test for whether matches were generated is not performed
until the end of the <tt>_tags</tt> loop.  This is so that the user can set
the <tt>tag-order</tt> style to specify a set of tags to be completed at the
same time.
</p>
<p>If <var>name</var> and <var>descr</var> are given, <tt>_requested</tt> calls the
<tt>_description</tt> function with these arguments together with the options
passed to <tt>_requested</tt>.
</p>
<p>If <var>command</var> is given, the <tt>_all_labels</tt> function will be called
immediately with the same arguments.  In simple cases this makes it
possible to perform the test for the tag and the matching in one go.
For example:
</p>
<div class="example">
<pre class="example">local expl ret=1
_tags foo bar baz
while _tags; do
  _requested foo expl 'description' \ 
      compadd foobar foobaz &amp;&amp; ret=0
  ...
  (( ret )) || break
done
</pre></div>

<p>If the <var>command</var> is not <tt>compadd</tt>, it must nevertheless be prepared
to handle the same options.
</p>
<a name="index-_005fretrieve_005fcache"></a>
</dd>
<dt><tt>_retrieve_cache</tt> <var>cache_identifier</var></dt>
<dd><p>This function retrieves completion information from the file given by
<var>cache_identifier</var>, stored in a directory specified by the
<tt>cache-path</tt> style which defaults to <tt>~/.zcompcache</tt>.  The return status
is zero if retrieval was successful.  It will only attempt retrieval
if the <tt>use-cache</tt> style is set, so you can call this function
without worrying about whether the user wanted to use the caching
layer.
</p>
<p>See <tt>_store_cache</tt> below for more details.
</p>
<a name="index-_005fsep_005fparts"></a>
</dd>
<dt><tt>_sep_parts</tt></dt>
<dd><p>This function is passed alternating arrays and separators as arguments.
The arrays specify completions for parts of strings to be separated by the
separators.  The arrays may be the names of array parameters or
a quoted list of words in parentheses.  For example, with the array
&lsquo;<tt>hosts=(ftp news)</tt>&rsquo; the call &lsquo;<tt>_sep_parts '(foo bar)' @ hosts</tt>&rsquo; will
complete the string  &lsquo;<tt>f</tt>&rsquo; to &lsquo;<tt>foo</tt>&rsquo; and the string &lsquo;<tt>b@n</tt>&rsquo; to
&lsquo;<tt>bar@news</tt>&rsquo;.
</p>
<p>This function accepts the <tt>compadd</tt> options &lsquo;<tt>-V</tt>&rsquo;, &lsquo;<tt>-J</tt>&rsquo;,
&lsquo;<tt>-1</tt>&rsquo;, &lsquo;<tt>-2</tt>&rsquo;, &lsquo;<tt>-n</tt>&rsquo;, &lsquo;<tt>-X</tt>&rsquo;, &lsquo;<tt>-M</tt>&rsquo;, &lsquo;<tt>-P</tt>&rsquo;, &lsquo;<tt>-S</tt>&rsquo;,
&lsquo;<tt>-r</tt>&rsquo;, &lsquo;<tt>-R</tt>&rsquo;, and &lsquo;<tt>-q</tt>&rsquo; and passes them on to the <tt>compadd</tt>
builtin used to add the matches.
</p>
<a name="index-_005fsequence"></a>
</dd>
<dt><tt>_sequence</tt> [ <tt>-s</tt> <var>sep</var> ] [ <tt>-n</tt> <var>max</var> ] [ <tt>-d</tt> ] <var>function</var> [ <tt>-</tt> ] ...</dt>
<dd><p>This function is a wrapper to other functions for completing items in a
separated list. The same function is used to complete each item in the
list. The separator is specified with the <tt>-s</tt> option. If <tt>-s</tt> is
omitted it will use &lsquo;<tt>,</tt>&rsquo;. Duplicate values are not matched unless
<tt>-d</tt> is specified. If there is a fixed or maximum number of items in
the list, this can be specified with the <tt>-n</tt> option.
</p>
<p>Common <tt>compadd</tt> options are passed on to the function. It is possible
to use <tt>compadd</tt> directly with <tt>_sequence</tt>, though <tt>_values</tt> may
be more appropriate in this situation.
</p>
<a name="index-_005fsetup"></a>
</dd>
<dt><tt>_setup</tt> <var>tag</var> [ <var>group</var> ]</dt>
<dd><p>This function sets up the special
parameters used by the completion system appropriately for the <var>tag</var>
given as the first argument.  It uses the styles <tt>list-colors</tt>,
<tt>list-packed</tt>, <tt>list-rows-first</tt>, <tt>last-prompt</tt>, <tt>accept-exact</tt>,
<tt>menu</tt> and <tt>force-list</tt>.
</p>
<p>The optional <var>group</var> supplies the name of the group in which the
matches will be placed.  If it is not given, the <var>tag</var> is used as
the group name.
</p>
<p>This function is called automatically from <tt>_description</tt>
and hence is not normally called explicitly.
</p>
<a name="index-_005fstore_005fcache"></a>
</dd>
<dt><tt>_store_cache</tt> <var>cache_identifier</var> <var>param</var> ...</dt>
<dd><p>This function, together with <tt>_retrieve_cache</tt> and
<tt>_cache_invalid</tt>, implements a caching layer which can be used
in any completion function.  Data obtained by
costly operations are stored in parameters;
this function then dumps the values of those parameters to a file.  The
data can then be retrieved quickly from that file via <tt>_retrieve_cache</tt>,
even in different instances of the shell.
</p>
<p>The <var>cache_identifier</var> specifies the file which the data should be
dumped to.  The file is stored in a directory specified by the
<tt>cache-path</tt> style which defaults to <tt>~/.zcompcache</tt>.  The remaining
<var>param</var>s arguments are the parameters to dump to the file.
</p>
<p>The return status is zero if storage was successful.  The function will
only attempt storage if the <tt>use-cache</tt> style is set, so you can
call this function without worrying about whether the user wanted to
use the caching layer.
</p>
<p>The completion function may avoid calling <tt>_retrieve_cache</tt> when it
already has the completion data available as parameters. 
However, in that case it should
call <tt>_cache_invalid</tt> to check whether the data in the parameters and
in the cache are still valid.
</p>
<p>See the _perl_modules completion function for a simple example of
the usage of the caching layer.
</p>
<a name="index-_005ftags"></a>
</dd>
<dt><tt>_tags</tt> [ [ <tt>-C</tt> <var>name</var> ] <var>tag</var> ... ]</dt>
<dd><p>If called with arguments, these are taken to be the names of tags
valid for completions in the current context.  These tags are stored
internally and sorted by using the <tt>tag-order</tt> style.
</p>
<p>Next, <tt>_tags</tt> is called repeatedly without arguments from the same
completion function.  This successively selects the first, second,
etc. set of tags requested by the user.  The return status is zero if at
least one of the tags is requested and non-zero otherwise.  To test if a
particular tag is to be tried, the <tt>_requested</tt> function should be
called (see above).
</p>
<p>If &lsquo;<tt>-C</tt> <var>name</var>&rsquo; is given, <var>name</var> is temporarily stored in the
<var>argument</var> field (the fifth) of the context in the <tt>curcontext</tt> parameter
during the call to <tt>_tags</tt>; the field is restored on exit.  This
allows <tt>_tags</tt> to use a more 
specific context without having to change and reset the
<tt>curcontext</tt> parameter (which has the same effect).
</p>
<a name="index-_005ftilde_005ffiles"></a>
</dd>
<dt><tt>_tilde_files</tt></dt>
<dd><p>Like <tt>_files</tt>, but resolve leading tildes according to the rules of
filename expansion, so the suggested completions don&rsquo;t start with
a &lsquo;<tt>~</tt>&rsquo; even if the filename on the command-line does.
</p>
<a name="index-_005fvalues"></a>
</dd>
<dt><tt>_values</tt> [ <tt>-O</tt> <var>name</var> ] [ <tt>-s</tt> <var>sep</var> ] [ <tt>-S</tt> <var>sep</var> ] [ <tt>-wC</tt> ] <var>desc</var> <var>spec</var> ...</dt>
<dd><p>This is used to complete arbitrary keywords (values) and their arguments,
or lists of such combinations.
</p>
<p>If the first argument is the option &lsquo;<tt>-O</tt> <var>name</var>&rsquo;, it will be used
in the same way as by the <tt>_arguments</tt> function.  In other words, the
elements of the <var>name</var> array will be passed to <tt>compadd</tt>
when executing an action.
</p>
<p>If the first argument (or the first argument after &lsquo;<tt>-O</tt> <var>name</var>&rsquo;)
is &lsquo;<tt>-s</tt>&rsquo;, the next argument is used as the character that separates
multiple values.  This character is automatically added after each value
in an auto-removable fashion (see below); all values completed by
&lsquo;<tt>_values -s</tt>&rsquo; appear in the same word on the command line, unlike
completion using <tt>_arguments</tt>.  If this option is not present, only a
single value will be completed per word.
</p>
<p>Normally, <tt>_values</tt> will only use the current word to determine
which values are already present on the command line and hence are not
to be completed again.  If the <tt>-w</tt> option is given, other arguments
are examined as well.
</p>
<p>The first non-option argument is used as a string to print as a
description before listing the values.
</p>
<p>All other arguments describe the possible values and their
arguments in the same format used for the description of options by
the <tt>_arguments</tt> function (see above).  The only differences are that
no minus or plus sign is required at the beginning,
values can have only one argument, and the forms of action
beginning with an equal sign are not supported.
</p>
<p>The character separating a value from its argument can be set using the
option <tt>-S</tt> (like <tt>-s</tt>, followed by the character to use as the
separator in the next argument).  By default the equals
sign will be used as the separator between values and arguments.
</p>
<p>Example:
</p>
<div class="example">
<pre class="example">_values -s , 'description' \ 
        '*foo[bar]' \ 
        '(two)*one[number]:first count:' \ 
        'two[another number]::second count:(1 2 3)'
</pre></div>

<p>This describes three possible values: &lsquo;<tt>foo</tt>&rsquo;, &lsquo;<tt>one</tt>&rsquo;, and
&lsquo;<tt>two</tt>&rsquo;.  The first is described as &lsquo;<tt>bar</tt>&rsquo;, takes no argument 
and may appear more than once.  The second is described as
&lsquo;<tt>number</tt>&rsquo;, may appear more than once, and takes one mandatory
argument described as &lsquo;<tt>first count</tt>&rsquo;; no action is
specified, so it will not be completed.  The
&lsquo;<tt>(two)</tt>&rsquo; at the beginning says that if the value &lsquo;<tt>one</tt>&rsquo; is on
the line, the value &lsquo;<tt>two</tt>&rsquo; will no longer be considered a possible
completion.  Finally, the last value (&lsquo;<tt>two</tt>&rsquo;) is described
as &lsquo;<tt>another number</tt>&rsquo; and takes an optional argument described as
&lsquo;<tt>second count</tt>&rsquo; for which the completions (to appear after an
&lsquo;<tt>=</tt>&rsquo;) are &lsquo;<tt>1</tt>&rsquo;, &lsquo;<tt>2</tt>&rsquo;, and &lsquo;<tt>3</tt>&rsquo;.  The <tt>_values</tt> function
will complete lists of these values separated by commas.
</p>
<p>Like <tt>_arguments</tt>, this function temporarily adds another context name
component to the arguments element (the fifth) of the current context
while executing the <var>action</var>.  Here this name is just the name of the
value for which the argument is completed.
</p>
<p>The style <tt>verbose</tt> is used to decide if the descriptions for the
values (but not those for the arguments) should be printed.
</p>
<p>The associative array <tt>val_args</tt> is used to report values and their
arguments; this works similarly to the <tt>opt_args</tt> associative array
used by <tt>_arguments</tt>.  Hence the function calling <tt>_values</tt> should
declare the local parameters <tt>state</tt>, <tt>state_descr</tt>, <tt>line</tt>,
<tt>context</tt> and <tt>val_args</tt>:
</p>
<div class="example">
<pre class="example">local context state state_descr line
typeset -A val_args
</pre></div>

<p>when using an action of the form &lsquo;<tt>-&gt;</tt><var>string</var>&rsquo;.  With this
function the <tt>context</tt> parameter will be set to the name of the
value whose argument is to be completed.  Note that for <tt>_values</tt>,
the <tt>state</tt> and <tt>state_descr</tt> are scalars rather than arrays.
Only a single matching state is returned.
</p>
<p>Note also that <tt>_values</tt> normally adds the character used as the
separator between values as an auto-removable suffix (similar to a
&lsquo;<tt>/</tt>&rsquo; after a directory).  However, this is not possible for a
&lsquo;<tt>-&gt;</tt><var>string</var>&rsquo; action as the matches for the argument are
generated by the calling function.  To get the usual behaviour,
the calling function can add the separator <var>x</var> as a suffix by
passing the options &lsquo;<tt>-qS</tt> <var>x</var>&rsquo; either directly or indirectly to
<tt>compadd</tt>.
</p>
<p>The option <tt>-C</tt> is treated in the same way as it is by <tt>_arguments</tt>.
In that case the parameter <tt>curcontext</tt> should be made local instead 
of <tt>context</tt> (as described above).
</p>
<a name="index-_005fwanted"></a>
</dd>
<dt><tt>_wanted</tt> [ <tt>-x</tt> ] [ <tt>-C</tt> <var>name</var> ]  [ <tt>-12VJ</tt> ] <var>tag</var> <var>name</var> <var>descr</var> <var>command</var> [ <var>arg</var> ...]</dt>
<dd><p>In many contexts, completion can only generate one particular set of
matches, usually corresponding to a single tag.  However, it is
still necessary to decide whether the user requires matches of this type.
This function is useful in such a case.
</p>
<p>The arguments to <tt>_wanted</tt> are the same as those to <tt>_requested</tt>,
i.e. arguments to be passed to <tt>_description</tt>.  However, in this case
the <var>command</var> is not optional;  all the processing of tags, including
the loop over both tags and tag labels and the generation of matches,
is carried out automatically by <tt>_wanted</tt>.
</p>
<p>Hence to offer only one tag and immediately add the corresponding
matches with the given description:
</p>
<div class="example">
<pre class="example">local expl
_wanted tag expl 'description' \ 
    compadd matches...
</pre></div>

<p>Note that, as for <tt>_requested</tt>, the <var>command</var> must be able to
accept options to be passed down to <tt>compadd</tt>.
</p>
<p>Like <tt>_tags</tt> this function supports the <tt>-C</tt> option to give a
different name for the argument context field.  The <tt>-x</tt> option has
the same meaning as for <tt>_description</tt>.
</p>
<a name="index-_005fwidgets"></a>
</dd>
<dt><tt>_widgets</tt> [ <tt>-g</tt> <var>pattern</var> ]</dt>
<dd><p>This function completes names of zle widgets (see
<a href="Zsh-Line-Editor.html#Zle-Widgets">Widgets</a>).  The <var>pattern</var>, if present, is matched against values of the <tt>$widgets</tt>
special parameter, documented in 
<a href="Zsh-Modules.html#The-zsh_002fzleparameter-Module">The zsh/zleparameter Module</a>.
</p>
</dd>
</dl>

<hr>
<a name="Completion-System-Variables"></a>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Completion-System" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Completion-Functions" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Completion-System" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Completion-Directories" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left">[<a href="Completion-Using-compctl.html#Completion-Using-compctl" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="index.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="zsh_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="Concept-Index.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="zsh_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>

<a name="Completion-System-Variables-1"></a>
<h2 class="section">20.7 Completion System Variables</h2>
<p><a name="index-completion-system_002c-variables"></a>
</p>
<p>There are some standard variables, initialised by the <tt>_main_complete</tt>
function and then used from other functions.
</p>
<p>The standard variables are:
</p>
<dl compact="compact">
<dt><tt>_comp_caller_options</tt></dt>
<dd><p>The completion system uses <tt>setopt</tt> to set a number of options. This
allows functions to be written without concern for compatibility with
every possible combination of user options. However, sometimes completion
needs to know what the user&rsquo;s option preferences are. These are saved
in the <tt>_comp_caller_options</tt> associative array. Option names, spelled
in lowercase without underscores, are mapped to one or other of the
strings &lsquo;<tt>on</tt>&rsquo; and &lsquo;<tt>off</tt>&rsquo;.
</p>

</dd>
<dt><tt>_comp_priv_prefix</tt></dt>
<dd><p>Completion functions such as <tt>_sudo</tt> can set the <tt>_comp_priv_prefix</tt>
array to a command prefix that may then be used by <tt>_call_program</tt> to
match the privileges when calling programs to generate matches.
</p>
</dd>
</dl>

<p>Two more features are offered by the <tt>_main_complete</tt> function.  The
arrays <tt>compprefuncs</tt> and <tt>comppostfuncs</tt> may contain
names of functions that are to be called immediately before or after
completion has been tried.  A function will only be called once unless
it explicitly reinserts itself into the array.
</p>
<hr>
<a name="Completion-Directories"></a>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Completion-System" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Completion-System-Variables" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Completion-System" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="Completion-Using-compctl.html#Completion-Using-compctl" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left">[<a href="Completion-Using-compctl.html#Completion-Using-compctl" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="index.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="zsh_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="Concept-Index.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="zsh_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>

<a name="Completion-Directories-1"></a>
<h2 class="section">20.8 Completion Directories</h2>
<p><a name="index-completion-system_002c-directory-structure"></a>
</p>
<p>In the source distribution, the files are contained in various
subdirectories of the <tt>Completion</tt> directory.  They may have been
installed in the same structure, or into one single function directory.
The following is a description of the files found in the original directory
structure.  If you wish to alter an installed file, you will need to copy
it to some directory which appears earlier in your <tt>fpath</tt> than the
standard directory where it appears.
</p>
<dl compact="compact">
<dt><tt>Base</tt></dt>
<dd><p>The core functions and special completion widgets automatically bound
to keys.  You will certainly need most of these, though will
probably not need to alter them.  Many of these are documented above.
</p>
</dd>
<dt><tt>Zsh</tt></dt>
<dd><p>Functions for completing arguments of shell builtin commands and
utility functions for this.  Some of these are also used by functions from
the <tt>Unix</tt> directory.
</p>
</dd>
<dt><tt>Unix</tt></dt>
<dd><p>Functions for completing arguments of external commands and suites of
commands.  They may need modifying for your system, although in many cases
some attempt is made to decide which version of a command is present.  For
example, completion for the <tt>mount</tt> command tries to determine the system
it is running on, while completion for many other utilities try to decide
whether the GNU version of the command is in use, and hence whether the
<tt>-</tt><tt>-help</tt> option is supported.
</p>
</dd>
<dt><tt>X</tt>, <tt>AIX</tt>, <tt>BSD</tt>, ...</dt>
<dd><p>Completion and utility function for commands available only on some systems.
These are not arranged hierarchically, so, for example, both the
<tt>Linux</tt> and <tt>Debian</tt> directories, as well as the <tt>X</tt> directory,
may be useful on your system.
</p>
</dd>
</dl>
<hr>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Completion-System" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="Completion-Using-compctl.html#Completion-Using-compctl" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="index.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="zsh_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="Concept-Index.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="zsh_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<p><font size="-1">
  This document was generated on <em>April 11, 2017</em> using <a href="http://www.gnu.org/software/texinfo/"><em>texi2any</em></a>.
</font></p>

<font size="-1">Zsh version 5.3.1, released on December 21, 2016.</font>
</body>
</html>