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
|
EExx//VVii RReeffeerreennccee MMaannuuaall
_K_e_i_t_h _B_o_s_t_i_c
Computer Science Division
Department of Electrical Engineering and Computer Science
University of California, Berkeley
Berkeley, California 94720
August 15, 1994
_A_b_s_t_r_a_c_t
This document is the reference guide for the 4.4BSD
implementations of nneexx/nnvvii, which are reimplementations
of the historic Berkeley eexx/vvii editors.
_A_c_k_n_o_w_l_e_d_g_e_m_e_n_t_s
Bruce Englar encouraged the early development of
the historic eexx/vvii editor. Peter Kessler helped bring
sanity to version 2's command layout. Bill Joy wrote
versions 1 and 2.0 through 2.7, and created the frame-
work that users see in the present editor. Mark Horton
added macros and other features and made eexx/vvii work on a
large number of terminals and Unix systems.
NNvvii is originally derived from software contributed
to the University of California, Berkeley by Steve Kirk-
endall, the author of the vvii clone eellvviiss.
IEEE Standard Portable Operating System Interface
for Computer Environments (POSIX) 1003.2 style Regular
Expression support was done by Henry Spencer.
The curses library was originally done by Ken
Arnold. Scrolling and reworking for nnvvii was done by
Elan Amir.
The Institute of Electrical and Electronics Engi-
neers has given us permission to reprint portions of
their documentation. Portions of this document are
reprinted and reproduced from IEEE Std 1003.2-1992, IEEE
Standard Portable Operating System Interface for Comput-
er Environments (POSIX), copyright 1992 by the Institute
of Electrical and Electronics Engineers, Inc.
The financial support of UUNET Communications Ser-
vices is gratefully acknowledged.
NNvvii//NNeexx RReeffeerreennccee UUSSDD::1133--33
11.. DDeessccrriippttiioonn
VVii is a screen oriented text editor. EExx is a line-
oriented text editor. EExx and vvii are different interfaces to
the same program, and it is possible to switch back and
forth during an edit session. VViieeww is the equivalent of
using the --RR (read-only) option of vvii.
This reference manual is the one provided with the
nneexx/nnvvii versions of the eexx/vvii text editors. NNeexx/nnvvii are
intended as bug-for-bug compatible replacements for the
original Fourth Berkeley Software Distribution (4BSD) eexx/vvii
programs. This reference manual is accompanied by a tradi-
tional-style manual page. That manual page describes the
functionality found in eexx/vvii in far less detail than the
description here. In addition, it describes the system
interface to eexx/vvii, e.g. command line options, session
recovery, signals, environmental variables, and similar
things.
This reference is intended for users already familiar
with eexx/vvii. Anyone else should almost certainly read a good
tutorial on the editor first. If you are in an unfamiliar
environment, and you absolutely have to get work done imme-
diately, see the section entitled "FFaasstt SSttaarrttuupp" in the man-
ual page. It is probably enough to get you started.
There are a few features in nneexx/nnvvii that are not found
in historic versions of eexx/vvii. Some of the more interesting
of those features are briefly described in the section enti-
tled "AAddddiittiioonnaall FFeeaattuurreess" near the end of this document.
For the rest of this document, nneexx/nnvvii is used only when it
is necessary to distinguish it from the historic implementa-
tions of eexx/vvii.
Future versions of this software will be periodically
made available by anonymous ftp, and can be retrieved from
ffttpp..ccss..bbeerrkkeelleeyy..eedduu, in the directory uuccbb//44bbssdd.
22.. SSttaarrttuupp IInnffoorrmmaattiioonn
EExx/vvii interprets one of two possible environmental
variables and reads up to three of five possible files dur-
ing startup. The variables and files are expected to con-
tain eexx commands, not vvii commands. In addition, they are
interpreted _b_e_f_o_r_e the file to be edited is read, and there-
fore many eexx commands may not be used. Generally, any com-
mand that requires output to the screen or that needs a file
upon which to operate, will cause an error if included in a
startup file or environmental variable.
Because the eexx command set supported by nneexx/nnvvii is a
superset of the command set supported by most historical
UUSSDD::1133--44 NNvvii//NNeexx RReeffeerreennccee
implementations of eexx, nneexx/nnvvii can use the startup files
created for the historical implementations, but the converse
may not be true.
If the --ss (the historic - option) is specified, or if
standard input is redirected from a file, all environmental
variables and startup files are ignored.
Otherwise, startup files and environmental variables
are handled in the following order:
(1) The file //eettcc//vvii..eexxrrcc is read, as long as it is owned
by root or the effective user ID of the user.
(2) The environmental variable NNEEXXIINNIITT (or the variable
EEXXIINNIITT, if NNEEXXIINNIITT is not set) is interpreted.
(3) If neither NNEEXXIINNIITT or EEXXIINNIITT was set, and the HHOOMMEE
environmental variable is set, the file $$HHOOMMEE//..nneexxrrcc
(or the file $$HHOOMMEE//..eexxrrcc, if $$HHOOMMEE//..nneexxrrcc does not
exist) is read, as long as the effective user ID of
the user is root or is the same as the owner of the
file.
(4) If the eexxrrcc option was turned on by one of the previ-
ous startup information sources, the file ..nneexxrrcc (or
the file ..eexxrrcc, if ..nneexxrrcc does not exist) is read, as
long as the effective user ID of the user is the same
as the owner of the file.
No startup file is read if it is writable by anyone
other than its owner.
It is not an error for any of the startup environmental
variables or files not to exist.
Once all environmental variables are interpreted, and
all startup files are read, the first file to be edited is
read in (or a temporary file is created). Then, any com-
mands specified using the --cc option are executed, in the
context of that file.
33.. RReeccoovveerryy
There is no recovery program for nneexx/nnvvii, nor does
nneexx/nnvvii run setuid. Recovery files are created readable and
writable by the owner only. Users may recover any file
which they can read, and the superuser may recover any edit
session.
Edit sessions are backed by files in the directory
named by the rreeccddiirr option (the directory
//vvaarr//ttmmpp//vvii..rreeccoovveerr by default), and are named "vvii..XXXXXXXXXXXX",
NNvvii//NNeexx RReeffeerreennccee UUSSDD::1133--55
where "XXXXXXXXXXXX" is a number related to the process ID. When
a file is first modified, a second recovery file containing
an email message for the user is created, and is named
"rreeccoovveerr..XXXXXXXXXXXX", where, again, "XXXXXXXXXXXX" is associated with
the process ID. Both files are removed at the end of a nor-
mal edit session, but will remain if the edit session is
abnormally terminated or the user runs the eexx pprreesseerrvvee com-
mand.
The rreeccddiirr option may be set in either the user's or
system's startup information, changing the recovery direc-
tory. (Note, however, that if a memory based file system is
used as the backup directory, each system reboot will delete
all of the recovery files! The same caution applies to
directories such as //ttmmpp which are cleared of their contents
by a system reboot, or //uussrr//ttmmpp which is periodically
cleared of old files on many systems.)
The recovery directory should be owned by root, or at
least by a pseudo-user. In addition, if directory "sticky-
bit" semantics are available, the directory should have the
sticky-bit set so that files may only be removed by their
owners. The recovery directory must be read, write, and
executable by any user, i.e. mode 1777.
If the recovery directory does not exist, eexx/vvii will
attempt to create it. This can result in the recovery
directory being owned by a normal user, which means that
that user will be able to remove other user's recovery and
backup files. This is annoying, but is not a security issue
as the user cannot otherwise access or modify the files.
The recovery file has all of the necessary information
in it to enable the user to recover the edit session. In
addition, it has all of the necessary email headers for
_s_e_n_d_m_a_i_l(8). When the system is rebooted, all of the files
in //vvaarr//ttmmpp//vvii..rreeccoovveerr named "rreeccoovveerr..XXXXXXXXXXXX" should be sent
to their owners, by email, using the --tt option of sseennddmmaaiill
(or a similar mechanism in other mailers). If eexx/vvii
receives a hangup (SIGHUP) signal, or the user executes the
eexx pprreesseerrvvee command, eexx/vvii will automatically email the
recovery information to the user.
If your system does not have the sseennddmmaaiill utility (or a
mailer program which supports its interface) the source file
nnvvii//ccoommmmoonn//rreeccoovveerr..cc will have to be modified to use your
local mail delivery programs. Note, if nneexx/nnvvii is changed
to use another mailer, it is important to remember that the
owner of the file given to the mailer is the nneexx/nnvvii user,
so nothing in the file should be trusted as it may have been
modified in an effort to compromise the system.
UUSSDD::1133--66 NNvvii//NNeexx RReeffeerreennccee
Finally, the owner execute bit is set on backup files
when they are created, and unset when they are first modi-
fied, e.g. backup files that have no associated email recov-
ery file will have this bit set. (There is also a small
window where empty files can be created and not yet have
this bit set. This is due to the method in which the files
are created.) Such files should be deleted when the system
reboots.
A simple way to do this cleanup is to insert the fol-
lowing Bourne shell script into your //eettcc//rrcc..llooccaall (or other
startup) file. The script should work with the historic
Bourne shell, a POSIX 1003.2 shell or the Korn shell. (A
copy of this script is included as
nnvvii//iinnssttaallll//rreeccoovveerr..ssccrriipptt in the nneexx/nnvvii distribution.)
## @@((##))rreeccoovveerr..ssccrriipptt 88..44 ((BBeerrkkeelleeyy)) 88//1133//9944
##
## RReeccoovveerr nnvvii eeddiittoorr ffiilleess::
RREECCDDIIRR==//vvaarr//ttmmpp//vvii..rreeccoovveerr
SSEENNDDMMAAIILL==//uussrr//lliibb//sseennddmmaaiill
eecchhoo ''RReeccoovveerriinngg nnvvii eeddiittoorr sseessssiioonnss..''
## UUnnmmooddiiffiieedd nnvvii eeddiittoorr bbaacckkuupp ffiilleess aarree eeiitthheerr zzeerroo lleennggtthh oorr
## hhaavvee tthhee eexxeeccuuttee bbiitt sseett.. DDeelleettee bbootthh ccaasseess..
vviibbaacckkuupp==``eecchhoo $$RREECCDDIIRR//vvii..**``
iiff [[ ""$$vviibbaacckkuupp"" !!== ""$$RREECCDDIIRR//vvii..**"" ]];; tthheenn
ffoorr ii iinn $$vviibbaacckkuupp;; ddoo
iiff tteesstt --xx $$ii --oo !! --ss $$ii;; tthheenn
rrmm $$ii
ffii
ddoonnee
ffii
## IItt iiss ppoossssiibbllee ttoo ggeett iinnccoommpplleettee rreeccoovveerryy ffiilleess,, iiff tthhee eeddiittoorr
## ccrraasshheess aatt tthhee rriigghhtt ttiimmee.. DDeelleettee aannyy rreeccoovveerryy ffiilleess wwiitthhoouutt
## ccoorrrreessppoonnddiinngg bbaacckkuupp ffiilleess,, ootthheerrwwiissee sseenndd mmaaiill ttoo tthhee uusseerr..
vviirreeccoovveerryy==``eecchhoo $$RREECCDDIIRR//rreeccoovveerr..**``
iiff [[ ""$$vviirreeccoovveerryy"" !!== ""$$RREECCDDIIRR//rreeccoovveerr..**"" ]];; tthheenn
ffoorr ii iinn $$vviirreeccoovveerryy;; ddoo
rreeccffiillee==``aawwkk ''//^^XX--vvii--rreeccoovveerr--ppaatthh:://{{pprriinntt $$22}}'' << $$ii``
iiff tteesstt !! --nn $$rreeccffiillee --aa --ss $$rreeccffiillee;; tthheenn
$$SSEENNDDMMAAIILL --tt << $$ii
eellssee
rrmm $$ii
ffii
ddoonnee
ffii
NNvvii//NNeexx RReeffeerreennccee UUSSDD::1133--77
If you are not using the default value for the rreeccddiirr
option, be sure to substitute the value you're using for the
RREECCDDIIRR value in the recovery script.
If the path of your system's sseennddmmaaiill program (or what-
ever mailer you're using) is not //uussrr//lliibb//sseennddmmaaiill, be sure
to substitute the correct pathname for the SSEENNDDMMAAIILL value in
the recovery script. Consult the manual page for details on
recovering preserved or aborted editing sessions.
44.. SSiizziinngg tthhee SSccrreeeenn
The size of the screen can be set in a number of ways.
EExx/vvii takes the following steps until values are obtained
for both the number of rows and number of columns in the
screen.
(1) If the environmental variable LLIINNEESS exists, it is
used to specify the number of rows in the screen.
(2) If the environmental variable CCOOLLUUMMNNSS exists, it is
used to specify the number of columns in the screen.
(3) The TIOCGWINSZ _i_o_c_t_l(2) is attempted on the standard
error file descriptor.
(4) The termcap entry (or terminfo entry on System V
machines) is checked for the "li" entry (rows) and
the "co" entry (columns).
(5) The number of rows is set to 24, and the number of
columns is set to 80.
If a window change size signal (SIGWINCH) is received,
the new window size is retrieved using the TIOCGWINSZ
_i_o_c_t_l(2) call, and all other information is ignored.
55.. CChhaarraacctteerr DDiissppllaayy
In both eexx and vvii printable characters as defined by
_i_s_p_r_i_n_t(3) are displayed using the local character set.
Non-printable characters, for which _i_s_c_n_t_r_l(3) returns
true, and which are less than octal \076, are displayed as
the string "^^<<cchhaarraacctteerr>>", where <<cchhaarraacctteerr>> is the charac-
ter that is the original character's value offset from the
"@@" character. For example, the octal character \001 is
displayed as "^^AA". If _i_s_c_n_t_r_l(3) returns true for the octal
character \177, it is displayed as the string "^^??". All
other characters are displayed as either hexadecimal values,
in the form "00xx<<hhiigghh--hhaallffbbyyttee>> ...... 00xx<<llooww--hhaallffbbyyttee>>", or as
octal values, in the form "\\<<hhiigghh--oonnee--oorr--ttwwoo--bbiittss>> ......
\\<<llooww--tthhrreeee--bbiittss>>". The display of unknown characters is
UUSSDD::1133--88 NNvvii//NNeexx RReeffeerreennccee
based on the value of the ooccttaall option.
In vvii command mode, the cursor is always positioned on
the last column of characters which take up more than one
column on the screen. In vvii text input mode, the cursor is
positioned on the first column of characters which take up
more than one column on the screen.
66.. MMuullttiippllee SSccrreeeennss
NNvvii supports multiple screens by dividing the window
into regions. It also supports stacks of screens by permit-
ting the user to change the set of screens that are cur-
rently displayed.
The command sspplliitt divides the current screen into two
regions of approximately equal size. If a list of files are
specified as arguments to the sspplliitt command, the list of
files to be edited is initialized as if the nneexxtt command had
been used. If no files are specified, the new screen will
begin by editing the same file as the previous screen.
When more than one screen is editing a file, changes in
any screen are reflected in all other screens editing the
same file. Exiting any screen without saving any changes
(or explicitly discarding them) is permitted until the last
screen editing the file is exited.
The rreessiizzee command permits resizing of individual
screens. Screens may be grown, shrunk or set to an absolute
number of rows.
The ^^WW command is used to switch between screens. Each
^^WW moves to the next lower screen in the window, or to the
first screen in the window if there are no lower screens.
The bbgg command "backgrounds" the current screen. The
screen disappears from the window, and the rows it occupied
are taken over by a neighboring screen. It is an error to
attempt to background the only screen in the window.
The ddiissppllaayy ssccrreeeennss command displays the names of the
files associated with the current backgrounded screens in
the window.
The ffgg [[ffiillee]] command "foregrounds" the first screen in
the list of backgrounded screens that is associated with its
argument. If no file argument is specified, the first
screen on the list is foregrounded. Foregrounding consists
of backgrounding the current screen, and replacing its space
in the window with the foregrounded screen.
NNvvii//NNeexx RReeffeerreennccee UUSSDD::1133--99
If the last screen in the window is exited, and there
are backgrounded screens, the first screen on the list of
backgrounded screens takes over the window.
77.. RReegguullaarr EExxpprreessssiioonnss aanndd RReeppllaacceemmeenntt SSttrriinnggss
Regular expressions are used in line addresses, as the
first part of the eexx ssuubbssttiittuuttee, gglloobbaall, and vvgglloobbaall com-
mands, and in search patterns.
The regular expressions supported by eexx/vvii are, by
default, the Basic Regular Expressions (BRE's) described in
the IEEE POSIX Standard 1003.2. The eexxtteennddeedd option causes
all regular expressions to be interpreted as the Extended
Regular Expressions (ERE's) described by the same standard.
(See _r_e___f_o_r_m_a_t(7) for more information.) Generally speak-
ing, BRE's are the Regular Expressions found in _e_d(1) and
_g_r_e_p(1), and ERE's are the Regular Expressions found in
_e_g_r_e_p(1).
The following is not intended to provide a description
of Regular Expressions. The information here only describes
strings and characters which have special meanings in the
eexx/vvii version of RE's, or options which change the meanings
of characters that normally have special meanings in RE's.
(1) An empty RE (e.g. "////" or "????" is equivalent to the
last RE used.
(2) The construct "\\<<" matches the beginning of a word.
(3) The construct "\\>>" matches the end of a word.
(4) The character "~~" matches the replacement part of the
last ssuubbssttiittuuttee command.
When the mmaaggiicc option is _n_o_t set, the only characters
with special meanings are a "^^" character at the beginning
of an RE, a "$$" character at the end of an RE, and the
escaping character "\\". The characters "..", "**", "[[" and
"~~" are treated as ordinary characters unless preceded by a
"\\"; when preceded by a "\\" they regain their special mean-
ing.
Replacement strings are the second part of a ssuubbssttiittuuttee
command.
The character "&&" (or "\\&&" if the mmaaggiicc option is _n_o_t
set) in the replacement string stands for the text matched
by the RE that is being replaced. The character "~~" (or
"\\~~" if the mmaaggiicc option is _n_o_t set) stands for the replace-
ment part of the previous ssuubbssttiittuuttee command. It is only
valid after a ssuubbssttiittuuttee command has been performed.
UUSSDD::1133--1100 NNvvii//NNeexx RReeffeerreennccee
The string "\\##", where "##" is an integer value from 1
to 9, stands for the text matched by the portion of the RE
enclosed in the "##"'th set of escaped parentheses, e.g.
"\\((" and "\\))". For example, "ss//aabbcc\\((..**\\))ddeeff//\\11//" deletes
the strings "aabbcc" and "ddeeff" from the matched pattern.
The strings "\\ll", "\\uu", "\\LL" and "\\UU" can be used to
modify the case of elements in the replacement string. The
string "\\ll" causes the next character to be converted to
lowercase; the string "\\uu" behaves similarly, but converts
to uppercase (e.g. ss//aabbcc//\\UU&&// replaces the string aabbcc with
AABBCC). The strings "\\LL" causes characters up to the end of
the string or the next occurrence of the strings "\\ee" or
"\\EE" to be converted to lowercase; the string "\\UU" behaves
similarly, but converts to uppercase.
If the entire replacement pattern is "%%", then the last
replacement pattern is used again.
In vvii, inserting a <<ccoonnttrrooll--MM>> into the replacement
string will cause the matched line to be split into two
lines at that point. (The <<ccoonnttrrooll--MM>> will be discarded.)
88.. GGeenneerraall EEddiittoorr DDeessccrriippttiioonn
When eexx or vvii are executed, the text of a file is read
(or a temporary file is created), and then all editing
changes happen within the context of the copy of the file.
_N_o _c_h_a_n_g_e_s _a_f_f_e_c_t _t_h_e _a_c_t_u_a_l _f_i_l_e _u_n_t_i_l _t_h_e _f_i_l_e _i_s _w_r_i_t_t_e_n
_o_u_t, either using a write command or another command which
is affected by the aauuttoowwrriittee option.
All files are locked (using the _f_l_o_c_k(2) or _f_c_n_t_l(2)
interfaces) during the edit session, to avoid inadvertently
making modifications to multiple copies of the file. If a
lock cannot be obtained for a file because it is locked by
another process, the edit session is read-only (as if the
rreeaaddoonnllyy option or the --RR flag had been specified). If a
lock cannot be obtained for other reasons, the edit session
will continue, but the file status information (see the
<<ccoonnttrrooll--GG>> command) will reflect this fact.
Both eexx and vvii are modeful editors, i.e. they have two
modes, "command" mode and "text input" mode. The former is
intended to permit you to enter commands which modifies
already existing text. The latter is intended to permit you
to enter new text. When eexx first starts running, it is in
command mode, and usually displays a prompt (see the pprroommpptt
option for more information). The prompt is a single colon
("::") character. There are three commands that switch eexx
into text input mode: aappppeenndd, cchhaannggee and iinnsseerrtt. Once in
input mode, entering a line containing only a single period
("..") terminates text input mode and returns to command
NNvvii//NNeexx RReeffeerreennccee UUSSDD::1133--1111
mode, where the prompt is redisplayed.
When vvii first starts running, it is in command mode as
well. There are eleven commands that switch vvii into text
input mode: AA, aa, CC, cc, II, ii, OO, oo, RR, SS and ss. Once in
input mode, entering an <<eessccaappee>> character terminates text
input mode and returns to command mode.
The following words have special meanings in both the
eexx and vvii command descriptions:
<<iinntteerrrruupptt>>
The interrupt character is used to interrupt the cur-
rent operation. Normally <<ccoonnttrrooll--CC>>, whatever charac-
ter is set for the current terminal is used.
<<lliitteerraall nneexxtt>>
The literal next character is used to escape the subse-
quent character from any special meaning. This charac-
ter is always <<ccoonnttrrooll--VV>>. If the terminal is not set
up to do XON/XOFF flow control, then <<ccoonnttrrooll--QQ>> is
used to mean literal next as well.
ccuurrrreenntt ppaatthhnnaammee
The pathname of the file currently being edited by vi.
When the percent character ("%%") appears in a file name
entered as part of an eexx command argument, it is
replaced by the current pathname. (The "%%" character
can be escaped by preceding it with a backslash.)
aalltteerrnnaattee ppaatthhnnaammee
The name of the last file name mentioned in an eexx com-
mand, or, the previous current pathname if the last
file mentioned becomes the current file. When the hash
mark character ("##") appears in a file name entered as
part of an eexx command argument, it is replaced by the
alternate pathname. (The "##" character can be escaped
by preceding it with a backslash.)
bbuuffffeerr
One of a number of named areas for saving copies of
text. Commands that change or delete text can save the
changed or deleted text into a specific buffer, for
later use, if the command allows it (i.e. the eexx cchhaannggee
command cannot save the changed text in a named
buffer). Buffers are named with a single character,
preceded by a double quote, e.g. ""<<cchhaarraacctteerr>>. His-
toric implementations of eexx/vvii limited <<cchhaarraacctteerr>> to
the alphanumeric characters; nneexx/nnvvii permits the use of
any character.
Buffers named by uppercase characters are the same as
buffers named by lowercase characters, e.g. the buffer
UUSSDD::1133--1122 NNvvii//NNeexx RReeffeerreennccee
named by the English character "AA" is the same as the
buffer named by the character "aa", with the exception
that, if the buffer contents are being changed (as with
a text deletion or vvii cchhaannggee command), the text is
_a_p_p_e_n_d_e_d to the buffer, instead of replacing the cur-
rent contents.
The buffers named by the numeric characters (in
English, "11" through "99"), are special, in that if at
least one line is changed or deleted in the file, (or a
command changes or deletes a region that crosses a line
boundary) a copy of the text is placed into the numeric
buffer "11", regardless of the user specifying another
buffer in which to save it. Before this copy is done,
the previous contents of buffer "11" are moved into
buffer "22", "22" into buffer "33", and so on. The con-
tents of buffer "99" are discarded. In vvii, text may be
explicitly stored into the numeric buffers. In this
case, the buffer rotation described above occurs before
the replacement of the buffer's contents. (Text cannot
be explicitly stored into the numeric buffers in eexx
because of ambiguities that this would cause in the eexx
command syntax.)
When a vvii command synopsis shows both a [[bbuuffffeerr]] and a
[[ccoouunntt]], they may be presented in any order.
Finally, all buffers are either "line" or "character"
oriented. All eexx commands which store text into
buffers are line oriented. Some vvii commands which
store text into buffers are line oriented, and some are
character oriented; the description for each applicable
vvii command notes whether text copied into buffers using
the command is line or character oriented. In addi-
tion, the vvii command ddiissppllaayy bbuuffffeerrss displays the cur-
rent orientation for each buffer. Generally, the only
importance attached to this orientation is that if the
buffer is subsequently inserted into the text, line
oriented buffers create new lines for each of the lines
they contain, and character oriented buffers create new
lines for any lines _o_t_h_e_r than the first and last lines
they contain. The first and last lines are inserted
into the text at the current cursor position, becoming
part of the current line. If there is more than one
line in the buffer, however, the current line itself
will be split.
uunnnnaammeedd bbuuffffeerr
The unnamed buffer is a text storage area which is used
by commands that take a buffer as an argument, when no
buffer is specified by the user. There is no way to
explicitly reference this buffer.
NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--1133
99.. VVii DDeessccrriippttiioonn
VVii takes up the entire screen to display the edited
file, except for the bottom line of the screen. The bottom
line of the screen is used to enter eexx commands, and for vvii
error and informational messages. If no other information
is being displayed, the default display can show the current
cursor row and cursor column, an indication of whether the
file has been modified, and the current mode of the editor.
See the rruulleerr, sshhoowwddiirrttyy and sshhoowwmmooddee options for more
information.
Empty lines do not have any special representation on
the screen, but lines on the screen that would logically
come after the end of the file are displayed as a single
tilde ("~~") character. To differentiate between empty lines
and lines consisting of only whitespace characters, use the
lliisstt option. Historically, implementations of vvii have also
displayed some lines as single asterisk ("@@") characters.
These were lines that were not correctly displayed, i.e.
lines on the screen that did not correspond to lines in the
file, or lines that did not fit on the current screen. NNvvii
never displays lines in this fashion.
VVii is a modeful editor, i.e. it has two modes, "com-
mand" mode and "text input" mode. When vvii first starts, it
is in command mode. There are several commands that change
vvii into text input mode. The <<eessccaappee>> character is used to
resolve the text input into the file, and exit back into
command mode. In vvii command mode, the cursor is always
positioned on the last column of characters which take up
more than one column on the screen. In vvii text insert mode,
the cursor is positioned on the first column of characters
which take up more than one column on the screen.
Generally, if the cursor line and cursor column are not
on the screen, then the screen is scrolled (if the target
cursor is close) or repainted (if the target cursor is far
away) so that the cursor is on the screen. If the screen is
scrolled, it is moved a minimal amount, and the cursor line
will usually appear at the top or bottom of the screen. In
the screen is repainted, the cursor line will appear in the
center of the screen, unless the cursor is sufficiently
close to the beginning or end of the file that this is not
possible. If the lleeffttrriigghhtt option is set, the screen may be
scrolled or repainted in a horizontal direction as well as
in a vertical one.
A major difference between the historical vvii presenta-
tion and nnvvii is in the scrolling and screen oriented posi-
tion commands, <<ccoonnttrrooll--BB>>, <<ccoonnttrrooll--DD>>, <<ccoonnttrrooll--EE>>, <<ccoonn--
ttrrooll--FF>>, <<ccoonnttrrooll--UU>>, <<ccoonnttrrooll--YY>>, HH, LL and MM. In histori-
cal implementations of vvii, these commands acted on physical
UUSSDD::1133--1144 NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss))
(as opposed to logical, or screen) lines. For lines that
were sufficiently long in relation to the size of the
screen, this meant that single line scroll commands might
repaint the entire screen, scrolling or screen positioning
command might not change the screen or move the cursor at
all, and some lines simply could not be displayed, even
though vvii would edit the file that contained them. In nnvvii,
these commands act on logical, i.e. screen lines. You are
unlikely to notice any difference unless you are editing
files with lines significantly longer than a screen width.
VVii keeps track of the currently "most attractive" cur-
sor position. Each command description (for commands that
can change the current cursor position), specifies if the
cursor is set to a specific location in the line, or if it
is moved to the "most attractive cursor position". The lat-
ter means that the cursor is moved to the cursor position
that is vertically as close as possible to the current cur-
sor position. If the current line is shorter than the cur-
sor position vvii would select, the cursor is positioned on
the last character in the line. (If the line is empty, the
cursor is positioned on the first column of the line.) If a
command moves the cursor to the most attractive position, it
does not alter the current cursor position, and a subsequent
movement will again attempt to move the cursor to that posi-
tion. Therefore, although a movement to a line shorter than
the currently most attractive position will cause the cursor
to move to the end of that line, a subsequent movement to a
longer line will cause the cursor to move back to the most
attractive position.
In addition, the $$ command makes the end of each line
the most attractive cursor position rather than a specific
column.
Each vvii command described below notes where the cursor
ends up after it is executed. This position is described in
terms of characters on the line, i.e. "the previous charac-
ter", or, "the last character in the line". This is to
avoid needing to continually refer to on what part of the
character the cursor rests.
The following words have special meaning for vvii com-
mands.
pprreevviioouuss ccoonntteexxtt
The position of the cursor before the command which
caused the last absolute movement was executed. Each
vvii command described in the next section that is con-
sidered an absolute movement is so noted. In addition,
specifying _a_n_y address to an eexx command is considered
an absolute movement.
NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--1155
mmoottiioonn
A second vvii command can be used as an optional trailing
argument to the vvii !!, <<, >>, cc, dd, yy, and (depending on
the ttiillddeeoopp option) ~~ commands. This command indicates
the end of the region of text that's affected by the
command. The motion command may be either the command
character repeated (in which case it means the current
line) or a cursor movement command. In the latter
case, the region affected by the command is from the
starting or stopping cursor position which comes first
in the file, to immediately before the starting or
stopping cursor position which comes later in the file.
Commands that operate on lines instead of using begin-
ning and ending cursor positions operate on all of the
lines that are wholly or partially in the region. In
addition, some other commands become line oriented
depending on where in the text they are used. The com-
mand descriptions below note these special cases.
The following commands may all be used as motion compo-
nents for vvii commands:
<<ccoonnttrrooll--AA>> <<ccoonnttrrooll--HH>> <<ccoonnttrrooll--JJ>> <<ccoonnttrrooll--MM>>
<<ccoonnttrrooll--NN>> <<ccoonnttrrooll--PP>> <<ssppaaccee>> $$
%% ''<<cchhaarraacctteerr>> (( ))
++ ,, -- //
00 ;; ?? BB
EE FF GG HH
LL MM NN TT
WW [[[[ ]]]] ^^
__ ``<<cchhaarraacctteerr>> bb ee
ff hh jj kk
ll nn tt ww
{{ || }}
The optional count prefix available for some of the vvii
commands that take motion commands, or the count prefix
available for the vvii commands that are used as motion
components, may be included and is _a_l_w_a_y_s considered
part of the motion argument. For example, the commands
"cc22ww" and "22ccww" are equivalent, and the region affected
by the cc command is two words of text. In addition, if
the optional count prefix is specified for both the vvii
command and its motion component, the effect is multi-
plicative and is considered part of the motion argu-
ment. For example, the commands "44ccww" and "22cc22ww" are
equivalent, and the region affected by the cc command is
four words of text.
UUSSDD::1133--1166 NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss))
ccoouunntt
A positive number used as an optional argument to most
commands, either to give a size or a position (for dis-
play or movement commands), or as a repeat count (for
commands that modify text). The count argument is
always optional and defaults to 1 unless otherwise
noted in the command description.
When a vvii command synopsis shows both a [[bbuuffffeerr]] and
[[ccoouunntt]], they may be presented in any order.
bbiiggwwoorrdd
A set of non-whitespace characters preceded and fol-
lowed by whitespace characters or the beginning or end
of the file or line.
Groups of empty lines (or lines containing only whites-
pace characters) are treated as a single bigword.
wwoorrdd
Generally, in languages where it is applicable, vvii rec-
ognizes two kinds of words. First, a sequence of let-
ters, digits and underscores, delimited at both ends
by: characters other than letters, digits, or under-
scores; the beginning or end of a line; the beginning
or end of the file. Second, a sequence of characters
other than letters, digits, underscores, or whitespace
characters, delimited at both ends by: a letter, digit,
underscore, or whitespace character; the beginning or
end of a line; the beginning or end of the file.
Groups of empty lines (or lines containing only whites-
pace characters) are treated as a single word.
ppaarraaggrraapphh
An area of text that begins with either the beginning
of a file, an empty line, or a section boundary, and
continues until either an empty line, section boundary,
or the end of the file.
Groups of empty lines (or lines containing only whites-
pace characters) are treated as a single paragraph.
Additional paragraph boundaries can be defined using
the ppaarraaggrraapphh option.
sseeccttiioonn
An area of text that starts with the beginning of the
file or a line whose first character is an open brace
("{{") and continues until the next section or the end
of the file.
Additional section boundaries can be defined using the
NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--1177
sseeccttiioonnss option.
sseenntteennccee
An area of text that begins with either the beginning
of the file or the first nonblank character following
the previous sentence, paragraph, or section boundary
and continues until the end of the file or a or a
period ("..") exclamation point ("!!") or question mark
("??") character, followed by either an end-of-line or
two whitespace characters. Any number of closing
parentheses ("))"), brackets ("]]") or double-quote ("""")
characters can appear between the period, exclamation
point, or question mark and the whitespace characters
or end-of-line.
Groups of empty lines (or lines containing only whites-
pace characters) are treated as a single sentence.
1100.. VVii CCoommmmaannddss
The following section describes the commands available
in the command mode of the vvii editor. In each entry below,
the tag line is a usage synopsis for the command character.
In addition, the final line and column the cursor rests
upon, and any options which affect the command are noted.
[[ccoouunntt]] <<ccoonnttrrooll--AA>>
Search forward ccoouunntt times for the current word. The
current word begins at the first non-whitespace charac-
ter on or after the current cursor position, and
extends up to the next non-word character or the end of
the line. The search is literal, i.e. no characters in
the word have any special meaning in terms of Regular
Expressions. It is an error if no matching pattern is
found between the starting position and the end of the
file.
The <<ccoonnttrrooll--AA>> command is an absolute movement. The
<<ccoonnttrrooll--AA>> command may be used as the motion component
of other vvii commands, in which case any text copied
into a buffer is character oriented.
Line: Set to the line where the word is found.
Column: Set to the first character of the word.
Options: Affected by the eexxtteennddeedd, iiggnnoorreeccaassee and wwrraapp--
ssccaann options.
[[ccoouunntt]] <<ccoonnttrrooll--BB>>
Page backward ccoouunntt screens. Two lines of overlap are
maintained by displaying the window starting at line
((ttoopp__lliinnee -- ccoouunntt ** wwiinnddooww__ssiizzee)) ++ 22, where wwiinnddooww__ssiizzee
is the value of the wwiinnddooww option. (In the case of
split screens, this size is corrected to the current
UUSSDD::1133--1188 NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss))
screen size.) This is an error if the movement is past
the beginning of the file.
The <<ccoonnttrrooll--BB>> command is an absolute movement.
Line: Set to the last line of text displayed on the
screen.
Column: Set to the first nonblank character of the
line.
Options: None.
[[ccoouunntt]] <<ccoonnttrrooll--DD>>
Scroll forward ccoouunntt lines. If ccoouunntt is not specified,
scroll forward the number of lines specified by the
last <<ccoonnttrrooll--DD>> or <<ccoonnttrrooll--UU>> command. If this is
the first <<ccoonnttrrooll--DD>> or <<ccoonnttrrooll--UU>> command, scroll
forward half the number of lines in the screen. (In
the case of split screens, the default scrolling dis-
tance is corrected to half the current screen size.)
This is an error if the movement is past the end of the
file.
The <<ccoonnttrrooll--DD>> command is an absolute movement.
Line: Set to the current line plus the number of
lines scrolled.
Column: Set to the first nonblank character of the
line.
Options: None.
[[ccoouunntt]] <<ccoonnttrrooll--EE>>
Scroll forward ccoouunntt lines, leaving the cursor on the
current line and column, if possible. This is an error
if the movement is past the end of the file.
Line: Unchanged unless the current line scrolls off
the screen, in which case it is set to the
first line on the screen.
Column: Unchanged unless the current line scrolls off
the screen, in which case it is set to the
most attractive cursor position.
Options: None.
[[ccoouunntt]] <<ccoonnttrrooll--FF>>
Page forward ccoouunntt screens. Two lines of overlap are
maintained by displaying the window starting at line
ttoopp__lliinnee ++ ccoouunntt ** wwiinnddooww__ssiizzee -- 22, where wwiinnddooww__ssiizzee
is the value of the wwiinnddooww option. (In the case of
split screens, this size is corrected to the current
screen size.) This is an error if the movement is past
the end of the file.
The <<ccoonnttrrooll--FF>> command is an absolute movement.
NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--1199
Line: Set to the first line on the screen.
Column: Set to the first nonblank character of the
current line.
Options: None.
<<ccoonnttrrooll--GG>>
Display the file information. The information includes
the current pathname, the current line, the number of
total lines in the file, the current line as a percent-
age of the total lines in the file, if the file has
been modified, was able to be locked, if the file's
name has been changed, and if the edit session is read-
only.
Line: Unchanged.
Column: Unchanged.
Options: None.
<<ccoonnttrrooll--HH>>
[[ccoouunntt]] hh
Move the cursor back ccoouunntt characters in the current
line. This is an error if the cursor is on the first
character in the line.
The <<ccoonnttrrooll--HH>> and hh commands may be used as the
motion component of other vvii commands, in which case
any text copied into a buffer is character oriented.
Line: Unchanged.
Column: Set to the ccuurrrreenntt -- ccoouunntt character, or, the
first character in the line if ccoouunntt is
greater than or equal to the number of charac-
ters in the line before the cursor.
Options: None.
[[ccoouunntt]] <<ccoonnttrrooll--JJ>>
[[ccoouunntt]] <<ccoonnttrrooll--NN>>
[[ccoouunntt]] jj
Move the cursor down ccoouunntt lines without changing the
current column. This is an error if the movement is
past the end of the file.
The <<ccoonnttrrooll--JJ>>, <<ccoonnttrrooll--NN>> and jj commands may be used
as the motion component of other vvii commands, in which
case any text copied into a buffer is line oriented.
Line: Set to the current line plus ccoouunntt.
Column: The most attractive cursor position.
Options: None.
<<ccoonnttrrooll--LL>>
<<ccoonnttrrooll--RR>>
Repaint the screen.
UUSSDD::1133--2200 NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss))
Line: Unchanged.
Column: Unchanged.
Options: None.
[[ccoouunntt]] <<ccoonnttrrooll--MM>>
[[ccoouunntt]] ++
Move the cursor down ccoouunntt lines to the first nonblank
character of that line. This is an error if the move-
ment is past the end of the file.
The <<ccoonnttrrooll--MM>> and ++ commands may be used as the
motion component of other vvii commands, in which case
any text copied into a buffer is line oriented.
Line: Set to the current line plus ccoouunntt.
Column: Set to the first nonblank character in the
line.
Options: None.
[[ccoouunntt]] <<ccoonnttrrooll--PP>>
[[ccoouunntt]] kk
Move the cursor up ccoouunntt lines, without changing the
current column. This is an error if the movement is
past the beginning of the file.
The <<ccoonnttrrooll--PP>> and kk commands may be used as the
motion component of other vvii commands, in which case
any text copied into a buffer is line oriented.
Line: Set to the current line minus count.
Column: The most attractive cursor position.
Options: None.
<<ccoonnttrrooll--TT>>
Return to the most recent tag context. The <<ccoonnttrrooll--TT>>
command is an absolute movement.
Line: Set to the context of the previous tag com-
mand.
Column: Set to the context of the previous tag com-
mand.
Options: None.
<<ccoonnttrrooll--UU>>
Scroll backward ccoouunntt lines. If ccoouunntt is not speci-
fied, scroll backward the number of lines specified by
the last <<ccoonnttrrooll--DD>> or <<ccoonnttrrooll--UU>> command. If this
is the first <<ccoonnttrrooll--DD>> or <<ccoonnttrrooll--UU>> command, scroll
backward half the number of lines in the screen. (In
the case of split screens, the default scrolling dis-
tance is corrected to half the current screen size.)
This is an error if the movement is past the beginning
of the file.
NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--2211
The <<ccoonnttrrooll--UU>> command is an absolute movement.
Line: Set to the current line minus the amount
scrolled.
Column: Set to the first nonblank character in the
line.
Options: None.
<<ccoonnttrrooll--WW>>
Switch to the next lower screen in the window, or, to
the first screen if there are no lower screens in the
window.
Line: Set to the previous cursor position in the
window.
Column: Set to the previous cursor position in the
window.
Options: None.
<<ccoonnttrrooll--YY>>
Scroll backward ccoouunntt lines, leaving the current line
and column as is, if possible. This is an error if the
movement is past the beginning of the file.
Line: Unchanged unless the current line scrolls off
the screen, in which case it is set to the
last line of text displayed on the screen.
Column: Unchanged unless the current line scrolls off
the screen, in which case it is the most
attractive cursor position.
Options: None.
<<ccoonnttrrooll--ZZ>>
Suspend the current editor session. If the file has
been modified since it was last completely written, and
the aauuttoowwrriittee option is set, the file is written before
the editor session is suspended. If this write fails,
the editor session is not suspended.
Line: Unchanged.
Column: Unchanged.
Options: Affected by the aauuttoowwrriittee option.
<<eessccaappee>>
Execute eexx commands or cancel partial commands. If an
eexx command is being entered (e.g. //, ??, :: or !!), the
command is executed. If a partial command has been
entered, e.g. or the command is cancelled. Otherwise,
it is an error.
Line: When an eexx command is being executed, the cur-
rent line is set as described for that com-
mand. Otherwise, unchanged.
UUSSDD::1133--2222 NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss))
Column: When an eexx command is being executed, the cur-
rent column is set as described for that com-
mand. Otherwise, unchanged.
Options: None.
<<ccoonnttrrooll--]]>>
Push a tag reference onto the tag stack. The tags
files (see the ttaaggss option for more information) are
searched for a tag matching the current word. The cur-
rent word begins at the first non-whitespace character
on or after the current cursor position, and extends up
to the next non-word character or the end of the line.
If a matching tag is found, the current file is dis-
carded and the file containing the tag reference is
edited.
If the current file has been modified since it was last
completely written, the command will fail. The <<ccoonn--
ttrrooll--]]>> command is an absolute movement.
Line: Set to the line containing the matching tag
string.
Column: Set to the start of the matching tag string.
Options: Affected by the ttaaggss and ttaagglleennggtthh options.
<<ccoonnttrrooll--^^>>
Switch to the most recently edited file.
If the file has been modified since it was last com-
pletely written, and the aauuttoowwrriittee option is set, the
file is written out. If this write fails, the command
will fail. Otherwise, if the current file has been
modified since it was last completely written, the com-
mand will fail.
Line: Set to the line the cursor was on when the
file was last edited.
Column: Set to the column the cursor was on when the
file was last edited.
Options: Affected by the aauuttoowwrriittee option.
[[ccoouunntt]] <<ssppaaccee>>
[[ccoouunntt]] ll
Move the cursor forward ccoouunntt characters without chang-
ing the current line. This is an error if the cursor
is on the last character in the line.
The <<ssppaaccee>> and ll commands may be used as the motion
component of other vvii commands, in which case any text
copied into a buffer is character oriented. In addi-
tion, these commands may be used as the motion compo-
nents of other commands when the cursor is on the last
character in the line, without error.
NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--2233
Line: Unchanged.
Column: Set to the current character plus the next
ccoouunntt characters, or to the last character on
the line if ccoouunntt is greater than the number
of characters in the line after the current
character.
Options: None.
[[ccoouunntt]] !! mmoottiioonn sshheellll--aarrgguummeenntt((ss))
Replace text with results from a shell command. Pass
the lines specified by the ccoouunntt and mmoottiioonn arguments
as standard input to the program named by the sshheellll
option, and replace those lines with the output (both
standard error and standard output) of that command.
After the motion is entered, vvii prompts for arguments
to the shell command.
Within those arguments, "%%" and "##" characters are
expanded to the current and alternate pathnames,
respectively. The "!!" character is expanded with the
command text of the previous !! or ::!! commands.
(Therefore, the command !!!! repeats the previous !!
command.) The special meanings of "%%", "##" and "!!"
can be overridden by escaping them with a backslash.
If no !! or ::!! command has yet been executed, it is an
error to use an unescaped "!!" character. The !! com-
mand does _n_o_t do shell expansion on the strings pro-
vided as arguments. If any of the above expansions
change the arguments the user entered, the command is
redisplayed at the bottom of the screen.
VVii then executes the program named by the sshheellll option,
with a --cc flag followed by the arguments (which are
bundled into a single argument).
The !! command is permitted in an empty file.
If the file has been modified since it was last com-
pletely written, the !! command will warn you.
Line: The first line of the replaced text.
Column: The first column of the replaced text.
Options: Affected by the sshheellll option.
[[ccoouunntt]] ## ++||--||##
Increment or decrement the current number. The current
number begins at the first non-number character on or
before the current cursor position, or the beginning of
the line, and extends up to the first non-number char-
acter on or after the current cursor position or the
end of the line. If the trailing character is a ++, the
number is incremented by ccoouunntt. If the trailing
UUSSDD::1133--2244 NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss))
character is a --, the number is decremented by ccoouunntt.
If the trailing character is a ##, the previous incre-
ment or decrement is repeated.
The format of the number (decimal, hexadecimal, and
octal, and leading 0's) is retained unless the new
value cannot be represented in the previous format.
Line: Unchanged.
Column: Set to the first character in the cursor word.
Options: None.
[[ccoouunntt]] $$
Move the cursor to the end of a line. If ccoouunntt is
specified, the cursor moves down ccoouunntt -- 11 lines.
It is not an error to use the $$ command when the cursor
is on the last character in the line or when the line
is empty.
The $$ command may be used as the motion component of
other vvii commands, in which case any text copied into a
buffer is character oriented, unless the cursor is at,
or before the first nonblank character in the line, in
which case it is line oriented. It is not an error to
use the $$ command as a motion component when the cursor
is on the last character in the line, although it is an
error when the line is empty.
Line: Set to the current line plus ccoouunntt minus 1.
Column: Set to the last character in the line.
Options: None.
%%
Move to the matching character. The cursor moves to
the parenthesis or curly brace which _m_a_t_c_h_e_s the paren-
thesis or curly brace found at the current cursor posi-
tion or which is the closest one to the right of the
cursor on the line. It is an error to execute the %%
command on a line without a parenthesis or curly brace.
Historically, any ccoouunntt specified to the %% command was
ignored.
The %% command is an absolute movement. The %% command
may be used as the motion component of other vvii com-
mands, in which case any text copied into a buffer is
character oriented, unless the starting point of the
region is at or before the first nonblank character on
its line, and the ending point is at or after the last
nonblank character on its line, in which case it is
line oriented.
NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--2255
Line: Set to the line containing the matching char-
acter.
Column: Set to the matching character.
Options: None.
&&
Repeat the previous substitution command on the current
line.
Historically, any ccoouunntt specified to the && command was
ignored.
Line: Unchanged.
Column: Unchanged if the cursor was on the last char-
acter in the line, otherwise, set to the first
nonblank character in the line.
Options: Affected by the eeddccoommppaattiibbllee, eexxtteennddeedd,
iiggnnoorreeccaassee and mmaaggiicc options.
''<<cchhaarraacctteerr>>
``<<cchhaarraacctteerr>>
Return to a context marked by the character <<cchhaarraacc--
tteerr>>. If <<cchhaarraacctteerr>> is the "''" or "``" character,
return to the previous context. If <<cchhaarraacctteerr>> is any
other character, return to the context marked by that
character (see the mm command for more information). If
the command is the '' command, only the line value is
restored, and the cursor is placed on the first non-
blank character of that line. If the command is the ``
command, both the line and column values are restored.
It is an error if the context no longer exists because
of line deletion. (Contexts follow lines that are
moved, or which are deleted and then restored.)
The '' and `` commands are both absolute movements. They
may be used as a motion component for other vvii com-
mands. For the '' command, any text copied into a
buffer is line oriented. For the `` command, any text
copied into a buffer is character oriented, unless it
both starts and stops at the first character in the
line, in which case it is line oriented. In addition,
when using the `` command as a motion component, com-
mands which move backward and started at the first
character in the line, or move forward and ended at the
first character in the line, are corrected to the last
character of the starting and ending lines, respec-
tively.
Line: Set to the line from the context.
Column: Set to the first nonblank character in the
line, for the '' command, and set to the con-
text's column for the `` command.
UUSSDD::1133--2266 NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss))
Options: None.
[[ccoouunntt]] ((
Back up ccoouunntt sentences.
The (( command is an absolute movement. The (( command
may be used as the motion component of other vvii com-
mands, in which case any text copied into a buffer is
character oriented, unless the starting and stopping
points of the region are the first character in the
line, in which case it is line oriented. In the latter
case, the stopping point of the region is adjusted to
be the end of the line immediately before it, and not
the original cursor position.
Line: Set to the line containing the beginning of
the sentence.
Column: Set to the first nonblank character of the
sentence.
Options: None.
[[ccoouunntt]] ))
Move forward ccoouunntt sentences.
The )) command is an absolute movement. The )) command
may be used as the motion component of other vvii com-
mands, in which case any text copied into a buffer is
character oriented, unless the starting point of the
region is the first character in the line, in which
case it is line oriented. In the latter case, if the
stopping point of the region is also the first charac-
ter in the line, it is adjusted to be the end of the
line immediately before it.
Line: Set to the line containing the beginning of
the sentence.
Column: Set to the first nonblank character of the
sentence.
Options: None.
[[ccoouunntt]] ,,
Reverse find character ccoouunntt times. Reverse the last
FF, ff, TT or tt command, searching the other way in the
line, ccoouunntt times.
The ,, command may be used as the motion component of
other vvii commands, in which case any text copied into a
buffer is character oriented.
Line: Unchanged.
Column: Set to the searched-for character.
Options: None.
NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--2277
[[ccoouunntt]] --
Move to first nonblank of the previous line, ccoouunntt
times.
This is an error if the movement is past the beginning
of the file.
The -- command may be used as the motion component of
other vvii commands, in which case any text copied into a
buffer is line oriented.
Line: Set to the current line minus ccoouunntt.
Column: Set to the first nonblank character in the
line.
Options: None.
[[ccoouunntt]] ..
Repeat the last vvii command that modified text. The
repeated command may be a command and motion component
combination. If ccoouunntt is specified, it replaces _b_o_t_h
the count specified for the repeated command, and, if
applicable, for the repeated motion component. If
ccoouunntt is not specified, the counts originally specified
to the command being repeated are used again.
As a special case, if the .. command is executed imme-
diately after the uu command, the change log is rolled
forward or backward, depending on the action of the uu
command.
Line: Set as described for the repeated command.
Column: Set as described for the repeated command.
Options: None.
//RREE<<ccaarrrriiaaggee--rreettuurrnn>>
//RREE// [[ooffffsseett]]<<ccaarrrriiaaggee--rreettuurrnn>>
??RREE<<ccaarrrriiaaggee--rreettuurrnn>>
??RREE?? [[ooffffsseett]]<<ccaarrrriiaaggee--rreettuurrnn>>
NN
nn
Search forward or backward for a regular expression.
The commands beginning with a slash ("//") character are
forward searches, the commands beginning with a ques-
tion mark ("??") are backward searches. VVii prompts
with the leading character on the last line of the
screen for a string. It then searches forward or back-
ward in the file for the next occurrence of the string,
which is interpreted as a Basic Regular Expression.
The // and ?? commands are absolute movements. They may
be used as the motion components of other vvii commands,
in which case any text copied into a buffer is charac-
ter oriented, unless the search started and ended on
UUSSDD::1133--2288 NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss))
the first column of a line, in which case it is line
oriented. In addition, forward searches ending at the
first character of a line, and backward searches begin-
ning at the first character in the line, are corrected
to begin or end at the last character of the previous
line. (Note, forward and backward searches can occur
for both // and ?? commands, if the wwrraappssccaann option is
set.)
If an offset from the matched line is specified (i.e. a
trailing "//" or "??" character is followed by a signed
offset), the buffer will always be line oriented (e.g.
"//ssttrriinngg//++00" will always guarantee a line orientation).
The nn command repeats the previous search.
The NN command repeats the previous search, but in the
reverse direction.
Missing RE's (e.g. "////<<ccaarrrriiaaggee--rreettuurrnn>>", "//<<ccaarrrriiaaggee--
rreettuurrnn>>", "????<<ccaarrrriiaaggee--rreettuurrnn>>", or "??<<ccaarrrriiaaggee--
rreettuurrnn>>" search for the last search RE, in the indi-
cated direction.
Searches may be interrupted using the <<iinntteerrrruupptt>> char-
acter.
Line: Set to the line in which the match occurred.
Column: Set to the first character of the matched
string.
Options: Affected by the eeddccoommppaattiibbllee, eexxtteennddeedd,
iiggnnoorreeccaassee, mmaaggiicc, and wwrraappssccaann options.
00
Move to the first character in the current line. It is
not an error to use the 00 command when the cursor is on
the first character in the line,
The 00 command may be used as the motion component of
other vvii commands, in which case it is an error if the
cursor is on the first character in the line.
Line: Unchanged.
Column: Set to the first character in the line.
Options: None.
::
Execute an ex command. VVii prompts for an eexx command on
the last line of the screen, using a colon ("::") char-
acter. The command is terminated by a <<ccaarrrriiaaggee--
rreettuurrnn>>, <<nneewwlliinnee>> or <<eessccaappee>> character; all of these
characters may be escaped by using a <<lliitteerraall nneexxtt>>
character. The command is then executed.
NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--2299
If the eexx command writes to the screen, vvii will prompt
the user for a <<ccaarrrriiaaggee--rreettuurrnn>> before continuing when
the eexx command finishes. Large amounts of output from
the eexx command will be paged for the user, and the user
prompted for a <<ccaarrrriiaaggee--rreettuurrnn>> or <<ssppaaccee>> key to con-
tinue. In some cases, a quit (normally a "q" charac-
ter) or <<iinntteerrrruupptt>> may be entered to interrupt the eexx
command.
When the eexx command finishes, and the user is prompted
to resume visual mode, it is also possible to enter
another "::" character followed by another eexx command.
Line: The current line is set as described for the
eexx command.
Column: The current column is set as described for the
eexx command.
Options: None.
[[ccoouunntt]] ;;
Repeat the last character find ccoouunntt times. The last
character find is one of the FF, ff, TT or tt commands.
The ;; command may be used as the motion component of
other vvii commands, in which case any text copied into a
buffer is character oriented.
Line: Unchanged.
Column: Set to the searched-for character.
Options: None.
[[ccoouunntt]] << mmoottiioonn
[[ccoouunntt]] >> mmoottiioonn
Shift lines left or right. Shift the number of lines
in the region specified by the motion component, times
ccoouunntt, left (for the << command) or right (for the >>
command) by the number of columns specified by the
sshhiiffttwwiiddtthh option. Only whitespace characters are
deleted when shifting left; once the first character in
the line contains a nonblank character, the sshhiifftt will
succeed, but the line will not be modified.
Line: Unchanged.
Column: Set to the first nonblank character in the
line.
Options: Affected by the sshhiiffttwwiiddtthh option.
@@ bbuuffffeerr
Execute a named buffer. Execute the named buffer as vvii
commands. The buffer may include eexx commands, too, but
they must be expressed as a :: command. If the buffer
is line oriented, <<nneewwlliinnee>> characters are logically
appended to each line of the buffer. If the buffer is
UUSSDD::1133--3300 NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss))
character oriented, <<nneewwlliinnee>> characters are logically
appended to all but the last line in the buffer.
If the buffer name is "@@", or "**", then the last buffer
executed shall be used. It is an error to specify "@@@@"
or "****" if there were no buffer previous executions.
The text of a macro may contain an @@ command, and it is
possible to create infinite loops in this manner. (The
<<iinntteerrrruupptt>> character may be used to interrupt the
loop.)
Line: The current line is set as described for the
command(s).
Column: The current column is set as described for the
command(s).
Options: None.
[[ccoouunntt]] AA
Enter input mode, appending the text after the end of
the line. If ccoouunntt is specified, the text is repeat-
edly input ccoouunntt -- 11 more times after input mode is
exited.
Line: Set to the last line upon which characters
were entered.
Column: Set to the last character entered.
Options: Affected by the aallttwweerraassee, aauuttooiinnddeenntt, bbeeaauu--
ttiiffyy, sshhoowwmmaattcchh, ttttyywweerraassee and wwrraappmmaarrggiinn
options.
[[ccoouunntt]] BB
Move backward ccoouunntt bigwords. Move the cursor backward
to the beginning of a bigword by repeating the follow-
ing algorithm: if the current position is at the begin-
ning of a bigword or the character at the current posi-
tion cannot be part of a bigword, move to the first
character of the preceding bigword. Otherwise, move to
the first character of the bigword at the current posi-
tion. If no preceding bigword exists on the current
line, move to the first character of the last bigword
on the first preceding line that contains a bigword.
The BB command may be used as the motion component of
other vvii commands, in which case any text copied into a
buffer is character oriented.
Line: Set to the line containing the word selected.
Column: Set to the first character of the word
selected.
Options: None.
[[bbuuffffeerr]] [[ccoouunntt]] CC
Change text from the current position to the end-of-
NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--3311
line. If ccoouunntt is specified, the input text replaces
from the current position to the end-of-line, plus
ccoouunntt -- 11 subsequent lines.
Line: Set to the last line upon which characters
were entered.
Column: Set to the last character entered.
Options: Affected by the aallttwweerraassee, aauuttooiinnddeenntt, bbeeaauu--
ttiiffyy, sshhoowwmmaattcchh, ttttyywweerraassee and wwrraappmmaarrggiinn
options.
[[bbuuffffeerr]] DD
Delete text from the current position to the end-of-
line.
It is not an error to execute the DD command on an empty
line.
Line: Unchanged.
Column: Set to the character before the current char-
acter, or, column 1 if the cursor was on col-
umn 1.
Options: None.
[[ccoouunntt]] EE
Move forward ccoouunntt end-of-bigwords. Move the cursor
forward to the end of a bigword by repeating the fol-
lowing algorithm: if the current position is the end of
a bigword or the character at that position cannot be
part of a bigword, move to the last character of the
following bigword. Otherwise, move to the last charac-
ter of the bigword at the current position. If no suc-
ceeding bigword exists on the current line, move to the
last character of the first bigword on the next follow-
ing line that contains a bigword.
The EE command may be used as the motion component of
other vvii commands, in which case any text copied into a
buffer is character oriented.
Line: Set to the line containing the word selected.
Column: Set to the last character of the word
selected.
Options: None.
[[ccoouunntt]] FF <<cchhaarraacctteerr>>
Search ccoouunntt times backward through the current line
for <<cchhaarraacctteerr>>.
The FF command may be used as the motion component of
other vvii commands, in which case any text copied into a
buffer is character oriented.
UUSSDD::1133--3322 NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss))
Line: Unchanged.
Column: Set to the searched-for character.
Options: None.
[[ccoouunntt]] GG
Move to line ccoouunntt, or the last line of the file if
ccoouunntt not specified.
The GG command is an absolute movement. The GG command
may be used as the motion component of other vvii com-
mands, in which case any text copied into a buffer is
line oriented.
Line: Set to ccoouunntt, if specified, otherwise, the
last line.
Column: Set to the first nonblank character in the
line.
Options: None.
[[ccoouunntt]] HH
Move to the screen line ccoouunntt -- 11 lines below the top
of the screen.
The HH command is an absolute movement. The HH command
may be used as the motion component of other vvii com-
mands, in which case any text copied into a buffer is
line oriented.
Line: Set to the line ccoouunntt -- 11 lines below the top
of the screen.
Column: Set to the first nonblank character of the
_s_c_r_e_e_n line.
Options: None.
[[ccoouunntt]] II
Enter input mode, inserting the text at the beginning
of the line. If ccoouunntt is specified, the text input is
repeatedly input ccoouunntt -- 11 more times.
Line: Set to the last line upon which characters
were entered.
Column: Set to the last character entered.
Options: None.
[[ccoouunntt]] JJ
Join lines. If ccoouunntt is specified, ccoouunntt lines are
joined; a minimum of two lines are always joined,
regardless of the value of ccoouunntt.
If the current line ends with a whitespace character,
all whitespace is stripped from the next line. Other-
wise, if the next line starts with a open parenthesis
("((") do nothing. Otherwise, if the current line ends
NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--3333
with a question mark ("??"), period ("..") or exclama-
tion point ("!!"), insert two spaces. Otherwise, insert
a single space.
It is not an error to join lines past the end of the
file, i.e. lines that do not exist.
Line: Unchanged.
Column: Set to the character after the last character
of the next-to-last joined line.
Options: None.
[[ccoouunntt]] LL
Move to the screen line ccoouunntt -- 11 lines above the bot-
tom of the screen.
The LL command is an absolute movement. The LL command
may be used as the motion component of other vvii com-
mands, in which case any text copied into a buffer is
line oriented.
Line: Set to the line ccoouunntt -- 11 lines above the bot-
tom of the screen.
Column: Set to the first nonblank character of the
_s_c_r_e_e_n line.
Options: None.
MM
Move to the screen line in the middle of the screen.
The MM command is an absolute movement. The MM command
may be used as the motion component of other vvii com-
mands, in which case any text copied into a buffer is
line oriented.
Historically, any ccoouunntt specified to the MM command was
ignored.
Line: Set to the line in the middle of the screen.
Column: Set to the first nonblank character of the
_s_c_r_e_e_n line.
Options: None.
[[ccoouunntt]] OO
Enter input mode, appending text in a new line above
the current line. If ccoouunntt is specified, the text
input is repeatedly input ccoouunntt -- 11 more times.
Historically, any ccoouunntt specified to the OO command was
ignored.
Line: Set to the last line upon which characters
were entered.
UUSSDD::1133--3344 NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss))
Column: Set to the last character entered.
Options: Affected by the aallttwweerraassee, aauuttooiinnddeenntt, bbeeaauu--
ttiiffyy, sshhoowwmmaattcchh, ttttyywweerraassee and wwrraappmmaarrggiinn
options.
[[bbuuffffeerr]] PP
Insert text from a buffer. Text from the buffer (the
unnamed buffer by default) is inserted before the cur-
rent column or, if the buffer is line oriented, before
the current line.
Line: Set to the lowest numbered line insert, if the
buffer is line oriented, otherwise unchanged.
Column: Set to the first nonblank character of the
appended text, if the buffer is line oriented,
otherwise, the last character of the appended
text.
Options: None.
QQ
Exit vvii (or visual) mode and switch to eexx mode.
Line: Unchanged.
Column: No longer relevant.
Options: None.
[[ccoouunntt]] RR
Enter input mode, replacing the characters in the cur-
rent line. If ccoouunntt is specified, the text input is
repeatedly input ccoouunntt -- 11 more times.
If the end of the current line is reached, no more
characters are replaced and any further characters
input are appended to the line.
Line: Set to the last line upon which characters
were entered.
Column: Set to the last character entered.
Options: Affected by the aallttwweerraassee, aauuttooiinnddeenntt, bbeeaauu--
ttiiffyy, sshhoowwmmaattcchh, ttttyywweerraassee and wwrraappmmaarrggiinn
options.
[[bbuuffffeerr]] [[ccoouunntt]] SS
Substitute ccoouunntt lines.
Line: Set to the last line upon which characters
were entered.
Column: Set to the last character entered.
Options: Affected by the aallttwweerraassee, aauuttooiinnddeenntt, bbeeaauu--
ttiiffyy, sshhoowwmmaattcchh, ttttyywweerraassee and wwrraappmmaarrggiinn
options.
NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--3355
[[ccoouunntt]] TT <<cchhaarraacctteerr>>
Search backward, ccoouunntt times, through the current line
for the character _a_f_t_e_r the specified <<cchhaarraacctteerr>>.
The TT command may be used as the motion component of
other vvii commands, in which case any text copied into a
buffer is character oriented.
Line: Unchanged.
Column: Set to the character _a_f_t_e_r the searched-for
character.
Options: None.
UU
Restore the current line to its state before the cursor
last moved to it.
Line: Unchanged.
Column: The first character in the line.
Options: None.
[[ccoouunntt]] WW
Move forward ccoouunntt bigwords. Move the cursor forward
to the beginning of a bigword by repeating the follow-
ing algorithm: if the current position is within a big-
word or the character at that position cannot be part
of a bigword, move to the first character of the next
bigword. If no subsequent bigword exists on the cur-
rent line, move to the first character of the first
bigword on the first following line that contains a
bigword.
The WW command may be used as the motion component of
other vvii commands, in which case any text copied into a
buffer is character oriented.
Line: The line containing the word selected.
Column: The first character of the word selected.
Options: None.
[[bbuuffffeerr]] [[ccoouunntt]] XX
Delete ccoouunntt characters before the cursor. If the num-
ber of characters to be deleted is greater than or
equal to the number of characters to the beginning of
the line, all of the characters before the current cur-
sor position, to the beginning of the line, are
deleted.
Line: Unchanged.
Column: Set to the current character minus ccoouunntt, or
the first character if count is greater than
the number of characters in the line before
the cursor.
UUSSDD::1133--3366 NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss))
Options: None.
[[bbuuffffeerr]] [[ccoouunntt]] YY
Copy (or "yank") ccoouunntt lines into the specified buffer.
Line: Unchanged.
Column: Unchanged.
Options: None.
ZZZZ
Write the file and exit vvii. The file is only written
if it has been modified since the last complete write
of the file to any file.
The ZZZZ command will exit the editor after writing the
file, if there are no further files to edit. Entering
two "quit" commands (i.e. wwqq, qquuiitt, xxiitt or ZZZZ) in a
row will override this check and the editor will exit,
ignoring any files that have not yet been edited.
Line: Unchanged.
Column: Unchanged.
Options: None.
[[ccoouunntt]] [[[[
Back up ccoouunntt section boundaries.
The [[[[ command is an absolute movement. The [[[[ command
may be used as the motion component of other vvii com-
mands, in which case any text copied into a buffer is
character oriented, unless the starting position is
column 0, in which case it is line oriented.
This is an error if the movement is past the beginning
of the file.
Line: Set to the previous line that is ccoouunntt section
boundaries back, or the first line of the file
if no more section boundaries exist preceding
the current line.
Column: Set to the first nonblank character in the
line.
Options: Affected by the sseeccttiioonnss option.
[[ccoouunntt]] ]]]]
Move forward ccoouunntt section boundaries.
The ]]]] command is an absolute movement. The ]]]] command
may be used as the motion component of other vvii com-
mands, in which case any text copied into a buffer is
character oriented, unless the starting position is
column 0, in which case it is line oriented.
NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--3377
This is an error if the movement is past the end of the
file.
Line: Set to the line that is ccoouunntt section bound-
aries forward, or to the last line of the file
if no more section boundaries exist following
the current line.
Column: Set to the first nonblank character in the
line.
Options: Affected by the sseeccttiioonnss option.
^^
Move to first nonblank character on the current line.
The ^^ command may be used as the motion component of
other vvii commands, in which case any text copied into a
buffer is character oriented.
Line: Unchanged.
Column: Set to the first nonblank character of the
current line.
Options: None.
[[ccoouunntt]] __
Move down ccoouunntt -- 11 lines, to the first nonblank char-
acter. The __ command may be used as the motion compo-
nent of other vvii commands, in which case any text
copied into a buffer is line oriented.
It is not an error to execute the __ command when the
cursor is on the first character in the line.
Line: The current line plus ccoouunntt -- 11.
Column: The first nonblank character in the line.
Options: None.
[[ccoouunntt]] aa
Enter input mode, appending the text after the cursor.
If ccoouunntt is specified, the text input is repeatedly
input ccoouunntt -- 11 more times.
Line: Set to the last line upon which characters
were entered.
Column: Set to the last character entered.
Options: Affected by the aallttwweerraassee, aauuttooiinnddeenntt, bbeeaauu--
ttiiffyy, sshhoowwmmaattcchh, ttttyywweerraassee and wwrraappmmaarrggiinn
options.
[[ccoouunntt]] bb
Move backward ccoouunntt words. Move the cursor backward to
the beginning of a word by repeating the following
algorithm: if the current position is at the beginning
of a word, move to the first character of the preceding
UUSSDD::1133--3388 NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss))
word. Otherwise, the current position moves to the
first character of the word at the current position.
If no preceding word exists on the current line, move
to the first character of the last word on the first
preceding line that contains a word.
The bb command may be used as the motion component of
other vvii commands, in which case any text copied into a
buffer is character oriented.
Line: Set to the line containing the word selected.
Column: Set to the first character of the word
selected.
Options: None.
[[bbuuffffeerr]] [[ccoouunntt]] cc mmoottiioonn
Change a region of text. If only part of a single line
is affected, then the last character being changed is
marked with a "$$". Otherwise, the region of text is
deleted, and input mode is entered.
If ccoouunntt is specified, it is applied to the mmoottiioonn.
Line: Set to the last line upon which characters
were entered.
Column: Set to the last character entered.
Options: Affected by the aallttwweerraassee, aauuttooiinnddeenntt, bbeeaauu--
ttiiffyy, sshhoowwmmaattcchh, ttttyywweerraassee and wwrraappmmaarrggiinn
options.
[[bbuuffffeerr]] [[ccoouunntt]] dd mmoottiioonn
Delete a region of text. If ccoouunntt is specified, it is
applied to the mmoottiioonn.
Line: Set to the line where the region starts.
Column: Set to the first character in the line after
the last character in the region. If no such
character exists, set to the last character
before the region.
Options: None.
[[ccoouunntt]] ee
Move forward ccoouunntt end-of-words. Move the cursor for-
ward to the end of a word by repeating the following
algorithm: if the current position is the end of a
word, move to the last character of the following word.
Otherwise, move to the last character of the word at
the current position. If no succeeding word exists on
the current line, move to the last character of the
first word on the next following line that contains a
word.
The ee command may be used as the motion component of
NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--3399
other vvii commands, in which case any text copied into a
buffer is character oriented.
Line: Set to the line containing the word selected.
Column: Set to the last character of the word
selected.
Options: None.
[[ccoouunntt]] ff <<cchhaarraacctteerr>>
Search forward, ccoouunntt times, through the rest of the
current line for <<cchhaarraacctteerr>>.
The ff command may be used as the motion component of
other vvii commands, in which case any text copied into a
buffer is character oriented.
Line: Unchanged.
Column: Set to the searched-for character.
Options: None.
[[ccoouunntt]] ii
Enter input mode, inserting the text before the cursor.
If ccoouunntt is specified, the text input is repeatedly
input ccoouunntt -- 11 more times.
Line: Set to the last line upon which characters
were entered.
Column: Set to the last character entered.
Options: Affected by the aallttwweerraassee, aauuttooiinnddeenntt, bbeeaauu--
ttiiffyy, sshhoowwmmaattcchh, ttttyywweerraassee and wwrraappmmaarrggiinn
options.
mm <<cchhaarraacctteerr>>
Save the current context (line and column) as <<cchhaarraacc--
tteerr>>. The exact position is referred to by "``<<cchhaarraacc--
tteerr>>". The line is referred to by "''<<cchhaarraacctteerr>>".
Historically, <<cchhaarraacctteerr>> was restricted to lower-case
letters only, nnvvii permits the use of any character.
Line: Unchanged.
Column: Unchanged.
Options: None.
[[ccoouunntt]] oo
Enter input mode, appending text in a new line under
the current line. If ccoouunntt is specified, the text
input is repeatedly input ccoouunntt -- 11 more times.
Historically, any ccoouunntt specified to the oo command was
ignored.
UUSSDD::1133--4400 NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss))
Line: Set to the last line upon which characters
were entered.
Column: Set to the last character entered.
Options: Affected by the aallttwweerraassee, aauuttooiinnddeenntt, bbeeaauu--
ttiiffyy, sshhoowwmmaattcchh, ttttyywweerraassee and wwrraappmmaarrggiinn
options.
[[bbuuffffeerr]] pp
Append text from a buffer. Text from the buffer (the
unnamed buffer by default) is appended after the cur-
rent column or, if the buffer is line oriented, after
the current line.
Line: Set to the first line appended, if the buffer
is line oriented, otherwise unchanged.
Column: Set to the first nonblank character of the
appended text if the buffer is line oriented,
otherwise, the last character of the appended
text.
Options: None.
[[ccoouunntt]] rr <<cchhaarraacctteerr>>
Replace characters. The next ccoouunntt characters in the
line are replaced with <<cchhaarraacctteerr>>. Replacing charac-
ters with <<nneewwlliinnee>> characters results in creating new,
empty lines into the file.
If <<cchhaarraacctteerr>> is <<eessccaappee>>, the command is cancelled.
Line: Unchanged unless the replacement character is
a <<nneewwlliinnee>>, in which case it is set to the
current line plus ccoouunntt -- 11.
Column: Set to the last character replaced, unless the
replacement character is a <<nneewwlliinnee>>, in which
case the cursor is in column 1 of the last
line inserted.
Options: None.
[[bbuuffffeerr]] [[ccoouunntt]] ss
Substitute ccoouunntt characters in the current line start-
ing with the current character.
Line: Set to the last line upon which characters
were entered.
Column: Set to the last character entered.
Options: Affected by the aallttwweerraassee, aauuttooiinnddeenntt, bbeeaauu--
ttiiffyy, sshhoowwmmaattcchh, ttttyywweerraassee and wwrraappmmaarrggiinn
options.
[[ccoouunntt]] tt <<cchhaarraacctteerr>>
Search forward, ccoouunntt times, through the current line
for the character immediately _b_e_f_o_r_e <<cchhaarraacctteerr>>.
NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--4411
The tt command may be used as the motion component of
other vvii commands, in which case any text copied into a
buffer is character oriented.
Line: Unchanged.
Column: Set to the character _b_e_f_o_r_e the searched-for
character.
Options: None.
uu
Undo the last change made to the file. If repeated,
the uu command alternates between these two states, and
is its own inverse. When used after an insert that
inserted text on more than one line, the lines are
saved in the numeric buffers.
The .. command, when used immediately after the uu com-
mand, causes the change log to be rolled forward or
backward, depending on the action of the uu command.
Line: Set to the position of the first line changed,
if the reversal affects only one line or rep-
resents an addition or change; otherwise, the
line preceding the deleted text.
Column: Set to the cursor position before the change
was made.
Options: None.
[[ccoouunntt]] ww
Move forward ccoouunntt words. Move the cursor forward to
the beginning of a word by repeating the following
algorithm: if the current position is at the beginning
of a word, move to the first character of the next
word. If no subsequent word exists on the current
line, move to the first character of the first word on
the first following line that contains a word.
The ww command may be used as the motion component of
other vvii commands, in which case any text copied into a
buffer is character oriented.
Line: Set to the line containing the word selected.
Column: Set to the first character of the word
selected.
Options: None.
[[bbuuffffeerr]] [[ccoouunntt]] xx
Delete ccoouunntt characters. The deletion is at the cur-
rent character position. If the number of characters
to be deleted is greater than or equal to the number of
characters to the end of the line, all of the charac-
ters from the current cursor position to the end of the
line are deleted.
UUSSDD::1133--4422 NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss))
Line: Unchanged.
Column: Unchanged unless the last character in the
line is deleted and the cursor is not already
on the first character in the line, in which
case it is set to the previous character.
Options: None.
[[bbuuffffeerr]] [[ccoouunntt]] yy mmoottiioonn
Copy (or "yank") a text region specified by the ccoouunntt
and motion into a buffer. If ccoouunntt is specified, it is
applied to the mmoottiioonn.
Line: Unchanged, unless the region covers more than
a single line, in which case it is set to the
line where the region starts.
Column: Unchanged, unless the region covers more than
a single line, in which case it is set to the
character were the region starts.
Options: None.
[[ccoouunntt11]] zz [[ccoouunntt22]] ttyyppee
Redraw the screen with a window ccoouunntt22 lines long, with
line ccoouunntt11 placed as specified by the ttyyppee character.
If ccoouunntt11 is not specified, it defaults to the current
line. If ccoouunntt22 is not specified, it defaults to the
current window size.
The following ttyyppee characters may be used:
+ If ccoouunntt11 is specified, place the line ccoouunntt11
at the top of the screen. Otherwise, display
the screen after the current screen, similarly
to the <<ccoonnttrrooll--FF>> command.
<carriage-return>
Place the line ccoouunntt11 at the top of the
screen.
. Place the line ccoouunntt11 in the center of the
screen.
- Place the line ccoouunntt11 at the bottom of the
screen.
^ If ccoouunntt11 is specified, place the line that is
at the top of the screen when ccoouunntt11 is at the
bottom of the screen, at the bottom of the
screen, i.e. display the screen before the
screen before ccoouunntt11. Otherwise, display the
screen before the current screen, similarly to
the <<ccoonnttrrooll--BB>> command.
Line: Set to ccoouunntt11 unless ccoouunntt11 is not specified
and the ttyyppee character was either "^^" or "++",
in which case it is set to the line before the
first line on the previous screen or the line
after the last line on the previous screen,
NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--4433
respectively.
Column: Set to the first nonblank character in the
line.
Options: None.
[[ccoouunntt]] {{
Move backward ccoouunntt paragraphs.
The {{ command is an absolute movement. The {{ command
may be used as the motion component of other vvii com-
mands, in which case any text copied into a buffer is
character oriented, unless the starting character is
the first character on its line, in which case it is
line oriented.
Line: Set to the line containing the beginning of
the previous paragraph.
Column: Set to the first nonblank character in the
line.
Options: Affected by the ppaarraaggrraapphh option.
[[ccoouunntt]] ||
Move to a specific _c_o_l_u_m_n position on the current line.
The || command may be used as the motion component of
other vvii commands, in which case any text copied into a
buffer is character oriented. It is an error to use
the || command as a motion component and for the cursor
not to move.
Line: Unchanged.
Column: Set to the character occupying the column
position identified by ccoouunntt, if the position
exists in the line. If the column length of
the current line is less than ccoouunntt, the cur-
sor is moved to the last character in the
line.
Options: None.
[[ccoouunntt]] }}
Move forward ccoouunntt paragraphs.
The }} command is an absolute movement. The }} command
may be used as the motion component of other vvii com-
mands, in which case any text copied into a buffer is
character oriented, unless the starting character is at
or before any nonblank characters in its line, in which
case it is line oriented.
Line: Set to the line containing the beginning of
the next paragraph.
Column: Set to the first nonblank character in the
line.
UUSSDD::1133--4444 NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss))
Options: Affected by the ppaarraaggrraapphh option.
[[ccoouunntt]] ~~
Reverse the case of the next ccoouunntt character(s). This
is the historic semantic for the ~~ command and it is
only in effect if the ttiillddeeoopp option is not set.
Lowercase alphabetic characters are changed to upper-
case, and uppercase characters are changed to lower-
case. No other characters are affected.
Historically, the ~~ command did not take an associated
count, nor did it move past the end of the current
line. As it had no associated motion it was difficult
to change the case of large blocks of text. In nnvvii, if
the cursor is on the last character of a line, and
there are more lines in the file, the cursor moves to
the next line.
It is not an error to specify a count larger than the
number of characters between the cursor and the end of
the file.
Line: Set to the line of the character after ccoouunntt
characters, or, end of file.
Column: Set to the character after ccoouunntt characters,
or, end-of-file.
Options: Affected by the ttiillddeeoopp option.
[[ccoouunntt]] ~~ mmoottiioonn
Reverse the case of the characters in a text region
specified by the ccoouunntt and mmoottiioonn. Only in effect if
the ttiillddeeoopp option is set.
Lowercase characters are changed to uppercase, and
uppercase characters are changed to lowercase. No
other characters are affected.
Line: Set to the line of the character after the
last character in the region.
Column: Set to the character after the last character
in the region.
Options: Affected by the ttiillddeeoopp option.
<<iinntteerrrruupptt>>
Interrupt the current operation. Many of the poten-
tially long-running vvii commands may be interrupted
using the terminal interrupt character. These opera-
tions include searches, file reading and writing, fil-
ter operations and map character expansion. Interrupts
are also enabled when running commands outside of vvii.
If the <<iinntteerrrruupptt>> character is used to interrupt while
NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--4455
entering an eexx command, the command is aborted, the
cursor returns to its previous position, and vvii remains
in command mode.
Generally, if the <<iinntteerrrruupptt>> character is used to
interrupt any operation, any changes made before the
interrupt are left in place.
Line: Dependent on the operation being interrupted.
Column: Dependent on the operation being interrupted.
Options: None.
1111.. VVii TTeexxtt IInnppuutt CCoommmmaannddss
The following section describes the commands
available in the text input mode of the vvii editor.
Historically, vvii implementations only permitted
the characters inserted on the current line to be
erased. In addition, only the <<ccoonnttrrooll--DD>> erase char-
acter and the "00<<ccoonnttrrooll--DD>>" and "^^<<ccoonnttrrooll--DD>>" erase
strings could erase autoindent characters. This imple-
mentation permits erasure to continue past the begin-
ning of the current line, and back to where text input
mode was entered. In addition, autoindent characters
may be erased using the standard erase characters. For
the line and word erase characters, reaching the
autoindent characters forms a "soft" boundary, denoting
the end of the current word or line erase. Repeating
the word or line erase key will erase the autoindent
characters.
Historically, vvii always used <<ccoonnttrrooll--HH>> and <<ccoonn--
ttrrooll--WW>> as character and word erase characters, respec-
tively, regardless of the current terminal settings.
This implementation accepts, in addition to these two
characters, the current terminal characters for those
operations.
<<nnuull>>
If the first character of the input is a <<nnuull>>,
the previous input is replayed, as if just
entered.
<<ccoonnttrrooll--DD>>
If the previous character on the line was an
autoindent character, erase it. Otherwise, if the
user is entering the first character in the line,
<<ccoonnttrrooll--DD>> is ignored. Otherwise, a literal
<<ccoonnttrrooll--DD>> character is entered.
^^<<ccoonnttrrooll--DD>>
If the previous character on the line was an
UUSSDD::1133--4466 NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss))
autoindent character, erase all of the autoindent
characters on the line. In addition, the autoin-
dent level is reset to 0.
00<<ccoonnttrrooll--DD>>
If the previous character on the line was an
autoindent character, erase all of the autoindent
characters on the line.
<<ccoonnttrrooll--TT>>
Insert sufficient <<ttaabb>> and <<ssppaaccee>> characters to
move the cursor forward to a column immediately
after the next column which is an even multiple of
the sshhiiffttwwiiddtthh option.
Historically, vvii did not permit the <<ccoonnttrrooll--TT>>
command to be used unless the cursor was at the
first column of a new line or it was preceded only
by autoindent characters. NNvvii permits it to be
used at any time during insert mode.
<<eerraassee>>
<<ccoonnttrrooll--HH>>
Erase the last character.
<<lliitteerraall nneexxtt>>
Quote the next character. The next character will
not be mapped (see the mmaapp command for more infor-
mation) or interpreted specially. A carat ("^^")
character will be displayed immediately as a
placeholder, but will be replaced by the next
character.
<<eessccaappee>>
Resolve all text input into the file, and return
to command mode.
<<lliinnee eerraassee>>
Erase the current line.
<<ccoonnttrrooll--WW>>
<<wwoorrdd eerraassee>>
Erase the last word. The definition of word is
dependent on the aallttwweerraassee and ttttyywweerraassee options.
<<ccoonnttrrooll--XX>>[[00--99AA--FFaa--ff]]**
Insert a character with the specified hexadecimal
value into the text.
<<iinntteerrrruupptt>>
Interrupt text input mode, returning to command
mode. If the <<iinntteerrrruupptt>> character is used to
interrupt inserting text into the file, it is as
NNvvii//NNeexx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--4477
if the <<eessccaappee>> character was used; all text input
up to the interruption is resolved into the file.
1122.. EExx AAddddrreessssiinngg
Addressing in eexx (and when eexx commands are exe-
cuted from vvii) relates to the current line. In gen-
eral, the current line is the last line affected by a
command. The exact effect on the current line is dis-
cussed under the description of each command. When the
file contains no lines, the current line is zero.
Addresses are constructed by one or more of the
following methods:
(1) The address ".." refers to the current line.
(2) The address "$$" refers to the last line of the
file.
(3) The address "NN", where NN is a positive number,
refers to the N-th line of the file.
(4) The address "''<<cchhaarraacctteerr>>" or "``<<cchhaarraacctteerr>>"
refers to the line marked with the name <<cchhaarraacc--
tteerr>>. (See the kk or mm commands for more infor-
mation on how to mark lines.)
(5) A regular expression (RE) enclosed by slashes
("//") is an address, and it refers to the first
line found by searching forward from the line
_a_f_t_e_r the current line toward the end of the
file, and stopping at the first line containing
a string matching the RE. (The trailing slash
can be omitted at the end of the command line.)
If no RE is specified, i.e. the pattern is "////",
the last RE used in any command is used in the
search.
If the eexxtteennddeedd option is set, the RE is handled
as an extended RE, not a basic RE. If the wwrraapp--
ssccaann option is set, the search wraps around to
the beginning of the file and continues up to
and including the current line, so that the
entire file is searched.
The form "\\//" is accepted for historic reasons,
and is identical to "////".
(6) An RE enclosed in question marks ("??")
addresses the first line found by searching
backward from the line _p_r_e_c_e_d_i_n_g the current
UUSSDD::1133--4488 NNvvii//NNeexx RReeffeerreennccee
line, toward the beginning of the file and stop-
ping at the first line containing a string
matching the RE. (The trailing question mark
can be omitted at the end of a command line.)
If no RE is specified, i.e. the pattern is "????",
the last RE used in any command is used in the
search.
If the eexxtteennddeedd option is set, the RE is handled
as an extended RE, not a basic RE. If the wwrraapp--
ssccaann option is set, the search wraps around
from the beginning of the file to the end of the
file and continues up to and including the cur-
rent line, so that the entire file is searched.
The form "\\??" is accepted for historic reasons,
and is identical to "????".
(7) An address followed by a plus sign ("++") or a
minus sign ("--") followed by a number is an off-
set address and refers to the address plus (or
minus) the indicated number of lines. If the
address is omitted, the addition or subtraction
is done with respect to the current line.
(8) An address of "++" or "--" followed by a number is
an offset from the current line. For example,
"--55" is the same as "..--55".
(9) An address ending with "++" or "--" has 1 added to
or subtracted from the address, respectively.
As a consequence of this rule and of the previ-
ous rule, the address "--" refers to the line
preceding the current line. Moreover, trailing
"++" and "--" characters have a cumulative effect.
For example, "++++--++++" refers to the current line
plus 3.
(10) A percent sign ("%%") is equivalent to the
address range "11,,$$".
EExx commands require zero, one, or two addresses.
It is an error to specify an address to a command which
requires zero addresses.
If the user provides more than the expected number
of addresses to any eexx command, the first addresses
specified are discarded. For example, "11,,22,,33,,55"print
prints lines 3 through 5, because the pprriinntt command
only takes two addresses.
NNvvii//NNeexx RReeffeerreennccee UUSSDD::1133--4499
The addresses in a range are separated from each
other by a comma (",,") or a semicolon (";;"). In the
latter case, the current line ("..") is set to the
first address, and only then is the second address cal-
culated. This feature can be used to determine the
starting line for forward and backward searches (see
rules (5) and (6) above). The second address of any
two-address sequence corresponds to a line that fol-
lows, in the file, the line corresponding to the first
address. The first address must be less than or equal
to the second address. The first address must be
greater than or equal to the first line of the file,
and the last address must be less than or equal to the
last line of the file.
1133.. EExx DDeessccrriippttiioonn
The following words have special meanings for eexx
commands.
<<eeooff>>
The end-of-file character is used to scroll the
screen in the eexx editor. This character is nor-
mally <<ccoonnttrrooll--DD>>, however, whatever character is
set for the current terminal is used.
lliinnee
A single-line address, given in any of the forms
described in the section entitled "EExx AAddddrreessssiinngg".
The default for lliinnee is the current line.
rraannggee
A line, or a pair of line addresses, separated by
a comma or semicolon. (See the section entitled
"EExx AAddddrreessssiinngg" for more information.) The
default for range is the current line _o_n_l_y, i.e.
"..,,..". A percent sign ("%%") stands for the range
"11,,$$". The starting address must be less than, or
equal to, the ending address.
ccoouunntt
A positive integer, specifying the number of lines
to be affected by the command; the default is 1.
Generally, a count past the end-of-file may be
specified, e.g. the command "pp 33000000" in a 10 line
file is acceptable, and will print from the cur-
rent line through the last line in the file.
ffllaaggss
One or more of the characters "#", "p", and "l".
When a command that accepts these flags completes,
the addressed line(s) are written out as if by the
corresponding ##, ll or pp commands. In addition,
UUSSDD::1133--5500 NNvvii//NNeexx RReeffeerreennccee ((EExx CCoommmmaannddss))
any number of "++" or "--" characters can be speci-
fied before, after, or during the flags, in which
case the line written is not necessarily the one
affected by the command, but rather the line
addressed by the offset address specified. The
default for ffllaaggss is none.
ffiillee
A pattern used to derive a pathname; the default
is the current file. File names are subjected to
normal _s_h(1) word expansions.
Anywhere a file name is specified, it is also pos-
sible to use the special string "//ttmmpp". This will be
replaced with a temporary file name which can be used
for temporary work, e.g. "::ee //ttmmpp" creates and edits a
new file.
If both a count and a range are specified for com-
mands that use either, the starting line for the com-
mand is the _l_a_s_t line addressed by the range, and
ccoouunntt- subsequent lines are affected by the command,
e.g. the command "22,,33pp44" prints out lines 3, 4, 5 and
6.
When only a line or range is specified, with no
command, the implied command is either a lliisstt, nnuummbbeerr
or pprriinntt command. The command used is the most recent
of the three commands to have been used (including any
use as a flag). If none of these commands have been
used before, the pprriinntt command is the implied command.
When no range or count is specified and the command
line is a blank line, the current line is incremented
by 1 and then the current line is displayed.
Zero or more whitespace characters may precede or
follow the addresses, count, flags, or command name.
Any object following a command name (such as buffer,
file, etc.), that begins with an alphabetic character,
should be separated from the command name by at least
one whitespace character.
Any character, including <<ccaarrrriiaaggee--rreettuurrnn>>, "%%"
and "##" retain their literal value when preceded by a
backslash.
1144.. EExx CCoommmmaannddss
The following section describes the commands
available in the eexx editor. In each entry below, the
tag line is a usage synopsis for the command.
NNvvii//NNeexx RReeffeerreennccee ((EExx CCoommmmaannddss)) UUSSDD::1133--5511
Each command can be entered as the abbreviation
(those characters in the synopsis command word preced-
ing the "[" character), the full command (all charac-
ters shown for the command word, omitting the "[" and
"]" characters), or any leading subset of the full com-
mand down to the abbreviation. For example, the args
command (shown as "aarr[[ggss]]" in the synopsis) can be
entered as "aarr", "aarrgg" or "aarrggss".
Each eexx command described below notes the new cur-
rent line after it is executed, as well as any options
that affect the command.
""
A comment. Command lines beginning with the dou-
ble-quote character ("""") are ignored. This per-
mits comments in editor scripts and startup files.
<<eenndd--ooff--ffiillee>>
Scroll the screen. Write the next N lines, where
N is the value of the ssccrroollll option. The command
is the end-of-file terminal character, which may
be different on different terminals. Tradition-
ally, it is the <<ccoonnttrrooll--DD>> key.
Historically, the eeooff command ignored any preced-
ing count, and the <<eenndd--ooff--ffiillee>> character was
ignored unless it was entered as the first charac-
ter of the command. This implementation treats it
as a command _o_n_l_y if entered as the first charac-
ter of the command line, and otherwise treats it
as any other character.
Line: Set to the last line written.
Options: None.
!! aarrgguummeenntt((ss))
[[rraannggee]]!! aarrgguummeenntt((ss))
Execute a shell command, or filter lines through a
shell command. In the first synopsis, the remain-
der of the line after the "!!" character is passed
to the program named by the sshheellll option, as a
single argument.
Within the rest of the line, "%%" and "##" are
expanded into the current and alternate pathnames,
respectively. The character "!!" is expanded with
the command text of the previous !! command.
(Therefore, the command !!!! repeats the previous !!
command.) The special meanings of "%%", "##", and
"!!" can be overridden by escaping them with a
backslash. If no !! or ::!! command has yet been
executed, it is an error to use an unescaped "!!"
UUSSDD::1133--5522 NNvvii//NNeexx RReeffeerreennccee ((EExx CCoommmmaannddss))
character. The !! command does _n_o_t do shell
expansion on the strings provided as arguments.
If any of the above expansions change the command
the user entered, the command is redisplayed at
the bottom of the screen.
EExx then executes the program named by the sshheellll
option, with a --cc flag followed by the arguments
(which are bundled into a single argument).
The !! command is permitted in an empty file.
If the file has been modified since it was last
completely written, the command will warn you.
A single "!!" character is displayed when the com-
mand completes.
In the second form of the !! command, the remain-
der of the line after the "!!" is passed to the
program named by the sshheellll option, as described
above. The specified lines are passed to the pro-
gram as standard input, and the standard and stan-
dard error output of the program replace the orig-
inal lines.
Line: Unchanged if no range was specified, oth-
erwise set to the first line of the
range.
Options: Affected by the aauuttoowwrriittee and wwrriitteeaannyy
options.
[[rraannggee]] nnuu[[mmbbeerr]] [[ccoouunntt]] [[ffllaaggss]]
[[rraannggee]] ## [[ccoouunntt]] [[ffllaaggss]]
Display the selected lines, each preceded with its
line number.
The line number format is "%6d", followed by two
spaces.
Line: Set to the last line displayed.
Options: None.
@@ bbuuffffeerr
** bbuuffffeerr
Execute a buffer. Each line in the named buffer
is executed as an eexx command. If no buffer is
specified, or if the specified buffer is "@@" or
"**", the last buffer executed is used.
[[rraannggee]] <<[[<< ......]] [[ccoouunntt]] [[ffllaaggss]]
Shift lines left or right. The specified lines
are shifted to the left (for the << command) or
NNvvii//NNeexx RReeffeerreennccee ((EExx CCoommmmaannddss)) UUSSDD::1133--5533
right (for the >> command), by the number of
columns specified by the sshhiiffttwwiiddtthh option. Only
leading whitespace characters are deleted when
shifting left; once the first column of the line
contains a nonblank character, the sshhiifftt command
will succeed, but the line will not be modified.
If the command character << or >> is repeated more
than once, the command is repeated once for each
additional command character.
Line: If the current line is set to one of the
lines that are affected by the command,
it is unchanged. Otherwise, it is set to
the first nonblank character of the low-
est numbered line shifted.
Options: Affected by the sshhiiffttwwiiddtthh option.
[[lliinnee]] == [[ffllaaggss]]
Display the line number. Display the line number
of lliinnee (which defaults to the last line in the
file).
Line: Unchanged.
Options: None.
[[rraannggee]] >>[[>> ......]] [[ccoouunntt]] [[ffllaaggss]]
Shift right. The specified lines are shifted to
the right by the number of columns specified by
the sshhiiffttwwiiddtthh option, by inserting tab and space
characters. Empty lines are not changed.
If the command character ">>" is repeated more than
once, the command is repeated once for each addi-
tional command character.
Line: Set to the last line modified by the com-
mand.
Options: None.
aabb[[bbrreevv]] llhhss rrhhss
Add an abbreviation to the current abbreviation
list. In vvii, if llhhss is entered such that it is
preceded and followed by characters that cannot be
part of a word, it is replaced by the string rrhhss.
Line: Unchanged.
Options: None.
[[lliinnee]] aa[[ppppeenndd]][[!!]]
The input text is appended to the specified line.
If line 0 is specified, the text is inserted at
the beginning of the file. Set to the last line
UUSSDD::1133--5544 NNvvii//NNeexx RReeffeerreennccee ((EExx CCoommmmaannddss))
input. If no lines are input, then set to lliinnee,
or to the first line of the file if a lliinnee of 0
was specified. Following the command name with a
"!!" character causes the aauuttooiinnddeenntt option to be
toggled for the duration of the command.
Line: Unchanged.
Options: Affected by the aallttwweerraassee, aauuttooiinnddeenntt,
bbeeaauuttiiffyy, sshhoowwmmaattcchh, ttttyywweerraassee and wwrraapp--
mmaarrggiinn options.
aarr[[ggss]]
Display the argument list. The current argument
is displayed inside of "[[" and "]]" characters.
The argument list is the list of operands speci-
fied on startup, which can be replaced using the
nneexxtt command.
Line: Unchanged.
Options: None.
bbgg
VVii mode only. Background the current screen.
Line: Set to the current line when the screen
was last edited.
Options: None.
[[rraannggee]] cc[[hhaannggee]][[!!]] [[ccoouunntt]]
Replace the lines with input text. Following the
command name with a "!!" character causes the
aauuttooiinnddeenntt option to be toggled for the duration
of the command.
Line: Set to the last line input, or, if no
lines were input, set to the line before
the target line, or to the first line of
the file if there are no lines preceding
the target line.
Options: Affected by the aallttwweerraassee, aauuttooiinnddeenntt,
bbeeaauuttiiffyy, sshhoowwmmaattcchh, ttttyywweerraassee and wwrraapp--
mmaarrggiinn options.
cchhdd[[iirr]][[!!]] [[ddiirreeccttoorryy]]
ccdd[[!!]] [[ddiirreeccttoorryy]]
Change the current working directory. The ddiirreecc--
ttoorryy argument is subjected to _s_h(1) word expan-
sions. When invoked with no directory argument
and the HHOOMMEE environment variable is set, the
directory named by the HHOOMMEE environment variable
becomes the new current directory. Otherwise, the
new current directory becomes the directory
returned by the _g_e_t_p_w_e_n_t(3) routine.
NNvvii//NNeexx RReeffeerreennccee ((EExx CCoommmmaannddss)) UUSSDD::1133--5555
The cchhddiirr command will fail if the file has been
modified since the last complete write of the
file. You can override this check by appending a
"!!" character to the command.
Line: Unchanged.
Options: Affected by the ccddppaatthh option.
[[rraannggee]] ccoo[[ppyy]] lliinnee [[ffllaaggss]]
[[rraannggee]] tt lliinnee [[ffllaaggss]]
Copy the specified lines (range) after the desti-
nation line. Line 0 may be specified to insert
the lines at the beginning of the file.
Line: Unchanged.
Options: None.
[[rraannggee]] dd[[eelleettee]] [[bbuuffffeerr]] [[ccoouunntt]] [[ffllaaggss]]
Delete the lines from the file. The deleted text
is saved in the specified buffer, or, if no buffer
is specified, in the unnamed buffer. If the com-
mand name is followed by a letter that could be
interpreted as either a buffer name or a flag
value (because neither a ccoouunntt or ffllaaggss values
were given), eexx treats the letter as a ffllaaggss value
if the letter immediately follows the command
name, without any whitespace separation. If the
letter is preceded by whitespace characters, it
treats it as a buffer name.
Line: Set to the line following the deleted
lines, or to the last line if the deleted
lines were at the end.
Options: None.
ddii[[ssppllaayy]] bb[[uuffffeerrss]] || ss[[ccrreeeennss]] || tt[[aaggss]]
Display buffers, screens or tags. The ddiissppllaayy
command takes one of three additional arguments,
which are as follows:
b[uffers]
Display all buffers (including named,
unnamed, and numeric) that contain text.
s[creens]
Display the file names of all background
screens.
t[ags] Display the tags stack.
Line: Unchanged.
Options: None.
ee[[ddiitt]][[!!]] [[++ccmmdd]] [[ffiillee]]
UUSSDD::1133--5566 NNvvii//NNeexx RReeffeerreennccee ((EExx CCoommmmaannddss))
eexx[[!!]] [[++ccmmdd]] [[ffiillee]]
Edit a different file. If the current buffer has
been modified since the last complete write, the
command will fail. You can override this by
appending a "!!" character to the command name.
If the "++ccmmdd" option is specified, that eexx command
will be executed in the new file. Any eexx command
may be used, although the most common use of this
feature is to specify a line number or search pat-
tern to set the initial location in the new file.
Line: If you have previously edited the file,
the current line will be set to your last
position in the file. If that position
does not exist, or you have not previ-
ously edited the file, the current line
will be set to the first line of the file
if you are in vvii mode, and the last line
of the file if you are in eexx.
Options: Affected by the aauuttoowwrriittee and wwrriitteeaannyy
options.
eexxuu[[ssaaggee]] [[ccoommmmaanndd]]
Display usage for an eexx command. If ccoommmmaanndd is
specified, a usage statement for that command is
displayed. Otherwise, usage statements for all eexx
commands are displayed.
Line: Unchanged.
Options: None.
ff[[iillee]] [[ffiillee]]
Display and optionally change the file name. If a
file name is specified, the current pathname is
changed to the specified name. The current path-
name, the number of lines, and the current posi-
tion in the file are displayed.
Line: Unchanged.
Options: None.
ffgg [[nnaammee]]
VVii mode only. Foreground the specified screen.
Swap the current screen with the specified back-
grounded screen. If no screen is specified, the
first background screen is foregrounded.
Line: Set to the current line when the screen
was last edited.
Options: None.
NNvvii//NNeexx RReeffeerreennccee ((EExx CCoommmmaannddss)) UUSSDD::1133--5577
[[rraannggee]] gg[[lloobbaall]] //ppaatttteerrnn// [[ccoommmmaannddss]]
[[rraannggee]] vv //ppaatttteerrnn// [[ccoommmmaannddss]]
Apply commands to lines matching (or not matching)
a pattern. The lines within the given range that
match ("gg[[lloobbaall]]"), or do not match ("vv") the
given pattern are selected. Then, the specified
eexx command(s) are executed with the current line
("..") set to each selected line. If no range is
specified, the entire file is searched for match-
ing, or not matching, lines.
Multiple commands can be specified, one per line,
by escaping each <<nneewwlliinnee>> character with a back-
slash, or by separating commands with a "||" char-
acter. If no commands are specified, the command
defaults to the pprriinntt command.
For the aappppeenndd, cchhaannggee and iinnsseerrtt commands, the
input text must be part of the global command
line. In this case, the terminating period can be
omitted if it ends the commands.
The vviissuuaall command may also be specified as one of
the eexx commands. In this mode, input is taken
from the terminal. Entering a QQ command in vvii
mode causes the next line matching the pattern to
be selected and vvii to be reentered, until the list
is exhausted.
The gglloobbaall, vv and uunnddoo commands cannot be used as
part of these commands.
The editor options aauuttoopprriinntt, aauuttooiinnddeenntt, and
rreeppoorrtt are turned off for the duration of the
gglloobbaall and vv commands.
Line: The last line modified.
Options: None.
hhee[[llpp]]
Display a help message.
Line: Unchanged.
Options: None.
[[lliinnee]] ii[[nnsseerrtt]][[!!]]
The input text is inserted before the specified
line. Following the command name with a "!!"
character causes the aauuttooiinnddeenntt option setting to
be toggled for the duration of this command.
Line: Set to the last line input; if no lines
were input, set to the line before the
UUSSDD::1133--5588 NNvvii//NNeexx RReeffeerreennccee ((EExx CCoommmmaannddss))
target line, or to the first line of the
file if there are no lines preceding the
target line.
Options: Affected by the aallttwweerraassee, aauuttooiinnddeenntt,
bbeeaauuttiiffyy, sshhoowwmmaattcchh, ttttyywweerraassee and wwrraapp--
mmaarrggiinn options.
[[rraannggee]] jj[[ooiinn]][[!!]] [[ccoouunntt]] [[ffllaaggss]]
Join lines of text together.
A ccoouunntt specified to the command specifies that
the last line of the rraannggee plus ccoouunntt subsequent
lines will be joined. (Note, this differs by one
from the general rule where only ccoouunntt- subsequent
lines are affected.)
If the current line ends with a whitespace charac-
ter, all whitespace is stripped from the next
line. Otherwise, if the next line starts with a
open parenthesis ("(("), do nothing. Otherwise, if
the current line ends with a question mark ("??"),
period ("..") or exclamation point ("!!"), insert
two spaces. Otherwise, insert a single space.
Appending a "!!" character to the command name
causes a simpler join with no white-space process-
ing.
Line: Unchanged.
Options: None.
[[rraannggee]] ll[[iisstt]] [[ccoouunntt]] [[ffllaaggss]]
Display the lines unambiguously. Tabs are dis-
played as "^^II", and the end of the line is marked
with a "$$" character.
Line: Set to the last line displayed.
Options: None.
mmaapp[[!!]] [[llhhss rrhhss]]
Define or display maps (for vvii only).
If "llhhss" and "rrhhss" are not specified, the current
set of command mode maps are displayed. If a "!!"
character is appended to to the command, the text
input mode maps are displayed.
Otherwise, when the "llhhss" character sequence is
entered in vvii, the action is as if the correspond-
ing "rrhhss" had been entered. If a "!!" character
is appended to the command name, the mapping is
effective during text input mode, otherwise, it is
effective during command mode. This allows "llhhss"
NNvvii//NNeexx RReeffeerreennccee ((EExx CCoommmmaannddss)) UUSSDD::1133--5599
to have two different macro definitions at the
same time: one for command mode and one for input
mode.
Whitespace characters require escaping with a
<<lliitteerraallnext> character to be entered in the llhhss
string in visual mode.
Normally, keys in the rrhhss string are remapped (see
the rreemmaapp option), and it is possible to create
infinite loops. However, keys which map to them-
selves are not further remapped, regardless of the
setting of the rreemmaapp option. For example, the
command "::mmaapp nn nnzz.." maps the "nn" key to the nn
and zz commands.
To exit an infinitely looping map, use the termi-
nal <<iinntteerrrruupptt>> character.
Line: Unchanged.
Options: None.
[[lliinnee]] mmaa[[rrkk]] <<cchhaarraacctteerr>>
[[lliinnee]] kk <<cchhaarraacctteerr>>
Mark the line with the mark <<cchhaarraacctteerr>>. The
expressions "''<<cchhaarraacctteerr>>" and "``<<cchhaarraacctteerr>>" can
then be used as an address in any command that
uses one.
Line: Unchanged.
Options: None.
[[rraannggee]] mm[[oovvee]] lliinnee
Move the specified lines after the target line. A
target line of 0 places the lines at the beginning
of the file.
Line: Set to the first of the moved lines.
Options: None.
mmkk[[eexxrrcc]][[!!]] ffiillee
Write the abbreviations, editor options and maps
to the specified file. Information is written in
a form which can later be read back in using the
eexx ssoouurrccee command. If ffiillee already exists, the
mmkkeexxrrcc command will fail. This check can be over-
ridden by appending a "!!" character to the com-
mand.
Line: Unchanged.
Options: None.
UUSSDD::1133--6600 NNvvii//NNeexx RReeffeerreennccee ((EExx CCoommmmaannddss))
nn[[eexxtt]][[!!]] [[ffiillee ......]]
Edit the next file from the argument list. The
nneexxtt command will fail if the file has been modi-
fied since the last complete write. This check
can be overridden by appending the "!!" character
to the command name. The argument list can
optionally be replaced by specifying a new one as
arguments to this command. In this case, editing
starts with the first file on the new list.
Line: Set as described for the eeddiitt command.
Options: Affected by the options aauuttoowwrriittee and
wwrriitteeaannyy.
[[lliinnee]] oo[[ppeenn]] //ppaatttteerrnn// [[ffllaaggss]]
Enter open mode. Open mode is the same as being
in vvii, but with a one-line window. All the stan-
dard vvii commands are available. If a match is
found for the optional RE argument, the cursor is
set to the start of the matching pattern.
_T_h_i_s _c_o_m_m_a_n_d _i_s _n_o_t _y_e_t _i_m_p_l_e_m_e_n_t_e_d_.
Line: Unchanged, unless the optional RE is
specified, in which case it is set to the
line where the matching pattern is found.
Options: Affected by the ooppeenn option.
pprree[[sseerrvvee]]
Save the file in a form that can later be recov-
ered using the eexx --rr option. When the file is
preserved, an email message is sent to the user.
Line: Unchanged.
Options: None.
pprreevv[[iioouuss]][[!!]]
Edit the previous file from the argument list.
The pprreevviioouuss command will fail if the file has
been modified since the last complete write. This
check can be overridden by appending the "!!"
character to the command name.
Line: Set as described for the eeddiitt command.
Options: Affected by the options aauuttoowwrriittee and
wwrriitteeaannyy. None.
[[rraannggee]] pp[[rriinntt]] [[ccoouunntt]] [[ffllaaggss]]
Display the specified lines.
Line: Set to the last line displayed.
Options: None.
NNvvii//NNeexx RReeffeerreennccee ((EExx CCoommmmaannddss)) UUSSDD::1133--6611
[[lliinnee]] ppuu[[tt]] [[bbuuffffeerr]]
Append buffer contents to the current line. If a
buffer is specified, its contents are appended to
the line, otherwise, the contents of the unnamed
buffer are used.
Line: Set to the line after the current line.
Options: None.
qq[[uuiitt]][[!!]]
End the editing session. If the file has been
modified since the last complete write, the qquuiitt
command will fail. This check may be overridden
by appending a "!!" character to the command.
If there are more files to edit, the qquuiitt command
will fail. Appending a "!!" character to the com-
mand name or entering two qquuiitt commands (i.e. wwqq,
qquuiitt, xxiitt or ZZZZ) in a row) will override this
check and the editor will exit.
Line: Unchanged.
Options: None.
[[lliinnee]] rr[[eeaadd]][[!!]] [[ffiillee]]
Read a file. A copy of the specified file is
appended to the line. If lliinnee is 0, the copy is
inserted at the beginning of the file. If no file
is specified, the current file is read; if there
is no current file, then ffiillee becomes the current
file. If there is no current file and no ffiillee is
specified, then the rreeaadd command will fail.
If ffiillee is preceded by a "!!" character, ffiillee is
treated as if it were a shell command, and passed
to the program named by the SSHHEELLLL environment
variable. The standard and standard error outputs
of that command are read into the file after the
specified line. The special meaning of the "!!"
character can be overridden by escaping it with a
backslash ("\\") character.
Line: When executed from eexx, the current line
is set to the last line read. When exe-
cuted from vvii, the current line is set to
the first line read.
Options: None.
rreecc[[oovveerr]] ffiillee
Recover ffiillee if it was previously saved. If no
saved file by that name exists, the rreeccoovveerr com-
mand behaves similarly to the eeddiitt command.
UUSSDD::1133--6622 NNvvii//NNeexx RReeffeerreennccee ((EExx CCoommmmaannddss))
Line: Set as described for the eeddiitt command.
Options: None.
rreess[[iizzee]] [[++||--]]ssiizzee
VVii mode only. Grow or shrink the current screen.
If ssiizzee is a positive, signed number, the current
screen is grown by that many lines. If ssiizzee is a
negative, signed number, the current screen is
shrunk by that many lines. If ssiizzee is not signed,
the current screen is set to the specified ssiizzee.
Applicable only to split screens.
Line: Unchanged.
Options: None.
rreeww[[iinndd]][[!!]]
Rewind the argument list. If the current file has
been modified since the last complete write, the
rreewwiinndd command will fail. This check may be over-
ridden by appending the "!!" character to the com-
mand.
Otherwise, the current file is set to the first
file in the argument list.
Line: Set as described for the eeddiitt command.
Options: Affected by the aauuttoowwrriittee and wwrriitteeaannyy
options.
ssee[[tt]] [[ooppttiioonn[[==[[vvaalluuee]]]] ......]] [[nnooooppttiioonn ......]] [[ooppttiioonn??
......]] [[aallll]]
Display or set editor options. When no arguments
are specified, the editor option tteerrmm, and any
editor options whose values have been changed from
the default settings are displayed. If the argu-
ment aallll is specified, the values of all of editor
options are displayed.
Specifying an option name followed by the charac-
ter "??" causes the current value of that option
to be displayed. The "??" can be separated from
the option name by whitespace characters. The "??"
is necessary only for Boolean valued options.
Boolean options can be given values by the form
"sseett ooppttiioonn" to turn them on, or "sseett nnooooppttiioonn" to
turn them off. String and numeric options can be
assigned by the form "sseett ooppttiioonn==vvaalluuee". Any
whitespace characters in strings can be included
literally by preceding each with a backslash.
More than one option can be set or listed by a
single set command, by specifying multiple argu-
ments, each separated from the next by whitespace
characters.
NNvvii//NNeexx RReeffeerreennccee ((EExx CCoommmmaannddss)) UUSSDD::1133--6633
Line: Unchanged.
Options: None.
sshh[[eellll]]
Run a shell program. The program named by the
sshheellll option is run with a --ii (for interactive)
flag. Editing is resumed when that program exits.
Line: Unchanged.
Options: None.
ssoo[[uurrccee]] ffiillee
Read and execute eexx commands from a file. SSoouurrccee
commands may be nested.
Line: Unchanged.
Options: None.
sspp[[lliitt]] [[ffiillee ......]]
VVii mode only. Split the screen. The current
screen is split into two screens, of approximately
equal size. If the cursor is in the lower half of
the screen, the screen will split up, i.e. the new
screen will be above the old one. If the cursor
is in the upper half of the screen, the new screen
will be below the old one.
If ffiillee is specified, the new screen is editing
that file, otherwise, both screens are editing the
same file, and changes in each will be be
reflected in the other. The argument list for the
new screen consists of the list of files specified
as arguments to this command, or, the current
pathname if no files are specified.
Line: If ffiillee is specified, set as for the eeddiitt
command, otherwise unchanged.
Options: None.
[[rraannggee]] ss[[uubbssttiittuuttee]] [[//ppaatttteerrnn//rreeppllaaccee//]] [[ooppttiioonnss]]
[[ccoouunntt]] [[ffllaaggss]]
[[rraannggee]] && [[ooppttiioonnss]] [[ccoouunntt]] [[ffllaaggss]]
[[rraannggee]] ~~ [[ooppttiioonnss]] [[ccoouunntt]] [[ffllaaggss]]
Make substitutions. Replace the first instance of
ppaatttteerrnn with the string rreeppllaaccee on the specified
line(s). If the "//ppaatttteerrnn//rreeppll//" argument is not
specified, the "//ppaatttteerrnn//rreeppll//" from the previous
ssuubbssttiittuuttee command is used.
If ooppttiioonnss includes the letter "cc" (confirm), you
will be prompted for confirmation before each
replacement is done. An affirmative response (in
English, a "yy" character) causes the replacement
UUSSDD::1133--6644 NNvvii//NNeexx RReeffeerreennccee ((EExx CCoommmmaannddss))
to be made. A quit response (in English, a "qq"
character) causes the ssuubbssttiittuuttee command to be
terminated. Any other response causes the
replacement not to be made, and the ssuubbssttiittuuttee
command continues. If ooppttiioonnss includes the letter
"gg" (global), all nonoverlapping instances of ppaatt--
tteerrnn in the line are replaced.
The && version of the command is the same as not
specifying a pattern or replacement string to the
ssuubbssttiittuuttee command, and the "&&" is replaced by the
pattern and replacement information from the pre-
vious substitute command.
The ~~ version of the command is the same as && and
ss, except that the search pattern used is the last
RE used in _a_n_y command, not necessarily the one
used in the last ssuubbssttiittuuttee command.
For example, in the sequence
ss//rreedd//bblluuee//
//ggrreeeenn
~~
the "~~" is equivalent to "ss//ggrreeeenn//bblluuee//".
The ssuubbssttiittuuttee command may be interrupted, using
the terminal interrupt character. All substitu-
tions completed before the interrupt are retained.
Line: Set to the last line upon which a substi-
tution was made.
Options: None.
ssuu[[ssppeenndd]][[!!]]
sstt[[oopp]][[!!]]
<<ccoonnttrrooll--ZZ>>
Suspend the edit session. Appending a "!!" char-
acter to these commands turns off the aauuttoowwrriittee
option for the command.
Line: Unchanged.
Options: Affected by the aauuttoowwrriittee option.
ttaa[[gg]][[!!]] ttaaggssttrriinngg
Edit the file containing the specified tag.
Search for the tagstring, which can be in a dif-
ferent file. If the tag is in a different file,
then the new file is edited. If the current file
has been modified since the last complete write,
the ttaagg command will fail. This check can be
overridden by appending the "!!" character to the
NNvvii//NNeexx RReeffeerreennccee ((EExx CCoommmmaannddss)) UUSSDD::1133--6655
command name.
The ttaagg command searches for ttaaggssttrriinngg in the tags
file(s) specified by the option. (See _c_t_a_g_s(1)
for more information on tags files.)
Line: Set to the line indicated by the tag.
Options: Affected by the aauuttoowwrriittee, ttaagglleennggtthh,
ttaaggss and wwrriitteeaannyy options.
ttaaggpp[[oopp]][[!!]] [[ffiillee || nnuummbbeerr]]
Pop to the specified tag in the tags stack. If
neither ffiillee or nnuummbbeerr is specified, the ttaaggppoopp
command pops to the most recent entry on the tags
stack. If ffiillee or nnuummbbeerr is specified, the ttaaggppoopp
command pops to the most recent entry in the tags
stack for that file, or numbered entry in the tags
stack, respectively. (See the ddiissppllaayy command for
information on displaying the tags stack.)
If the file has been modified since the last com-
plete write, the ttaaggppoopp command will fail. This
check may be overridden by appending a "!!" char-
acter to the command name.
Line: Set to the line indicated by the tag.
Options: Affected by the aauuttoowwrriittee, and wwrriitteeaannyy
options.
ttaaggtt[[oopp]][[!!]]
Pop to the least recent tag on the tags stack,
clearing the tags stack.
If the file has been modified since the last com-
plete write, the ttaaggppoopp command will fail. This
check may be overridden by appending a "!!" char-
acter to the command name.
Line: Set to the line indicated by the tag.
Options: Affected by the aauuttoowwrriittee, and wwrriitteeaannyy
options.
uunnaa[[bbbbrreevv]] llhhss
Delete an abbreviation. Delete llhhss from the cur-
rent list of abbreviations.
Line: Unchanged.
Options: None.
uu[[nnddoo]]
Undo the last change made to the file. Changes
made by gglloobbaall, vv, vviissuuaall and map sequences are
considered a single command. If repeated, the uu
UUSSDD::1133--6666 NNvvii//NNeexx RReeffeerreennccee ((EExx CCoommmmaannddss))
command alternates between these two states, and
is its own inverse.
Line: Set to the last line modified by the com-
mand.
Options: None.
uunnmm[[aapp]][[!!]] llhhss
Unmap a mapped string. Delete the command mode
map definition for llhhss. If a "!!" character is
appended to the command name, delete the text
input mode map definition instead.
Line: Unchanged.
Options: None.
vvee[[rrssiioonn]]
Display the version of the eexx//vvii editor.
[[lliinnee]] vvii[[ssuuaall]] [[ttyyppee]] [[ccoouunntt]] [[ffllaaggss]]
EExx mode only. Enter vvii. The ttyyppee is optional,
and can be "--", "++" or "^^", as in the eexx zz com-
mand, to specify the the position of the specified
line in the screen window. (The default is to
place the line at the top of the screen window.)
A ccoouunntt specifies the number of lines that will
initially be displayed. (The default is the value
of the wwiinnddooww editor option.)
Line: Unchanged unless lliinnee is specified, in
which case it is set to that line.
Options: None.
vvii[[ssuuaall]][[!!]] [[++ccmmdd]] [[ffiillee]]
VVii mode only. Edit a new file. Identical to the
"eeddiitt[[!!]] [[++ccmmdd]] [[ffiillee]]" command.
vviiuu[[ssaaggee]] [[ccoommmmaanndd]]
Display usage for a vvii command. If ccoommmmaanndd is
specified, a usage statement for that command is
displayed. Otherwise, usage statements for all vvii
commands are displayed.
Line: Unchanged.
Options: None.
[[rraannggee]] ww[[rriittee]][[!!]] [[>>>>]] [[ffiillee]]
[[rraannggee]] ww[[rriittee]] [[!!]] [[ffiillee]]
[[rraannggee]] wwnn[[!!]] [[>>>>]] [[ffiillee]]
[[rraannggee]] wwqq[[!!]] [[>>>>]] [[ffiillee]]
Write the file. The specified lines (the entire
file, if no range is given) is written to ffiillee.
If ffiillee is not specified, the current pathname is
NNvvii//NNeexx RReeffeerreennccee ((EExx CCoommmmaannddss)) UUSSDD::1133--6677
used. If ffiillee is specified, and it exists, or if
the current pathname was set using the ffiillee com-
mand, and the file already exists, these commands
will fail. Appending a "!!" character to the com-
mand name will override this check and the write
will be attempted, regardless.
Specifying the optional ">>>>" string will cause the
write to be appended to the file, in which case no
tests are made for the file already existing.
If the file is preceded by a "!!" character, the
program named in the SHELL environment variable is
invoked with file as its second argument, and the
specified lines are passed as standard input to
that command. The "!!" in this usage must be sep-
arated from command name by at least one whites-
pace character. The special meaning of the "!!"
may be overridden by escaping it with a backslash
("\\") character.
The wwqq version of the write command will exit the
editor after writing the file, if there are no
further files to edit. Appending a "!!" character
to the command name or entering two "quit" com-
mands (i.e. wwqq, qquuiitt, xxiitt or ZZZZ) in a row) will
override this check and the editor will exit,
ignoring any files that have not yet been edited.
The wwnn version of the write command will move to
the next file after writing the file, unless the
write fails.
Line: Unchanged.
Options: Affected by the rreeaaddoonnllyy and wwrriitteeaannyy
options.
[[rraannggee]] xx[[iitt]][[!!]] [[ffiillee]]
Write the file if it has been modified. The spec-
ified lines are written to ffiillee, if the file has
been modified since the last complete write to any
file. If no rraannggee is specified, the entire file
is written.
The xxiitt command will exit the editor after writing
the file, if there are no further files to edit.
Appending a "!!" character to the command name or
entering two "quit" commands (i.e. wwqq, qquuiitt, xxiitt
or ZZZZ) in a row) will override this check and the
editor will exit, ignoring any files that have not
yet been edited.
UUSSDD::1133--6688 NNvvii//NNeexx RReeffeerreennccee ((EExx CCoommmmaannddss))
Line: Unchanged.
Options: Affected by the rreeaaddoonnllyy and wwrriitteeaannyy
options.
[[rraannggee]] yyaa[[nnkk]] [[bbuuffffeerr]] [[ccoouunntt]]
Copy the specified lines to a buffer. If no
buffer is specified, the unnamed buffer is used.
Line: Unchanged.
Options: None.
[[lliinnee]] zz [[ttyyppee]] [[ccoouunntt]] [[ffllaaggss]]
Adjust the window. If no ttyyppee is specified, then
ccoouunntt lines following the specified line are dis-
played. The default ccoouunntt is the value of the
wwiinnddooww option. The ttyyppee argument changes the
position at which lliinnee is displayed on the screen
by changing the number of lines displayed before
and after lliinnee. The following ttyyppee characters may
be used:
- Place the line at the bottom of the
screen.
+ Place the line at the top of the screen.
. Place the line in the middle of the
screen.
^ Write out count lines starting ccoouunntt ** 22
lines before lliinnee; the net effect of this
is that a "zz^^" command following a zz com-
mand writes the previous page.
= Center lliinnee on the screen with a line of
hyphens displayed immediately before and
after it. The number of preceding and
following lines of text displayed are
reduced to account for those lines.
Line: Set to the last line displayed, with the
exception of the ttyyppee, where the current
line is set to the line specified by the
command.
Options: Affected by the option.
1155.. SSeett OOppttiioonnss
There are a large number of options that may be
set (or unset) to change the editor's behavior. This
section describes the options, their abbreviations and
their default values.
In each entry below, the first part of the tag
line is the full name of the option, followed by any
equivalent abbreviations. (Regardless of the abbrevia-
tions, it is only necessary to use the minimum number
NNvvii//NNeexx RReeffeerreennccee UUSSDD::1133--6699
of characters necessary to distinguish an abbreviation
from all other commands for it to be accepted, in
nneexx/nnvvii. Historically, only the full name and the
official abbreviations were accepted by eexx/vvii. Using
full names in your startup files and environmental
variables will probably make them more portable.) The
part in square brackets is the default value of the
option. Most of the options are boolean, i.e. they are
either on or off, and do not have an associated value.
Options apply to both eexx and vvii modes, unless oth-
erwise specified.
For information on modifying the options or to
display the options and their current values, see the
"set" command in the section entitled "EExx CCoommmmaannddss".
aallttwweerraassee [[ooffff]]
VVii only. Change how vvii does word erase during
text input. When this option is set, text is bro-
ken up into three classes: alphabetic, numeric and
underscore characters, other nonblank characters,
and blank characters. Changing from one class to
another marks the end of a word. In addition, the
class of the first character erased is ignored
(which is exactly what you want when erasing path-
name components).
aauuttooiinnddeenntt,, aaii [[ooffff]]
If this option is set, whenever you create a new
line (using the vvii AA, aa, CC, cc, II, ii, OO, oo, RR, rr,
SS, and ss commands, or the eexx aappppeenndd, cchhaannggee, and
iinnsseerrtt commands) the new line is automatically
indented to align the cursor with the first non-
blank character of the line from which you created
it. Lines are indented using tab characters to
the extent possible (based on the value of the
ttaabbssttoopp option) and then using space characters as
necessary. For commands inserting text into the
middle of a line, any blank characters to the
right of the cursor are discarded, and the first
nonblank character to the right of the cursor is
aligned as described above.
The indent characters are themselves somewhat spe-
cial. If you do not enter more characters on the
new line before moving to another line, or enter-
ing <<eessccaappee>>, the indent character will be deleted
and the line will be empty. For example, if you
enter <<ccaarrrriiaaggee--rreettuurrnn>> twice in succession, the
line created by the first <<ccaarrrriiaaggee--rreettuurrnn>> will
not have any characters in it, regardless of the
indentation of the previous or subsequent line.
UUSSDD::1133--7700 NNvvii//NNeexx RReeffeerreennccee
Indent characters also require that you enter
additional erase characters to delete them. For
example, if you have an indented line, containing
only blanks, the first <<wwoorrdd--eerraassee>> character you
enter will erase up to end of the indent charac-
ters, and the second will erase back to the begin-
ning of the line. (Historically, only the <<ccoonn--
ttrrooll--DD>> key would erase the indent characters.
Both the <<ccoonnttrrooll--DD>> key and the usual erase keys
work in nnvvii.) In addition, if the cursor is posi-
tioned at the end of the indent characters, the
keys "00<<ccoonnttrrooll--DD>>" will erase all of the indent
characters for the current line, resetting the
indentation level to 0. Similarly, the keys
"^^<<ccoonnttrrooll--DD>>" will erase all of the indent char-
acters for the current line, leaving the indenta-
tion level for future created lines unaffected.
Finally, if the aauuttooiinnddeenntt option is set, the SS
and cccc commands change from the first nonblank of
the line to the end of the line, instead of from
the beginning of the line to the end of the line.
aauuttoopprriinntt,, aapp [[ooffff]]
EExx only. Cause the current line to be automati-
cally displayed after the eexx commands <<, >>, ccooppyy,
ddeelleettee, jjooiinn, mmoovvee, ppuutt, tt, UUnnddoo, and uunnddoo. This
automatic display is suppressed during gglloobbaall and
vvgglloobbaall commands, and for any command where
optional flags are used to explicitly display the
line.
aauuttoowwrriittee,, aaww [[ooffff]]
If this option is set, the vvii !!, ^^^^, ^^]] and <<ccoonn--
ttrrooll--ZZ>> commands, and the eexx eeddiitt, nneexxtt, rreewwiinndd,
ssttoopp, ssuussppeenndd, ttaagg, ttaaggppoopp, and ttaaggttoopp commands
automatically write the current file back to the
current file name if it has been modified since it
was last written. If the write fails, the command
fails and goes no further.
Appending the optional force flag character "!!"
to the eexx commands nneexxtt, rreewwiinndd, ssttoopp, ssuussppeenndd,
ttaagg, ttaaggppoopp, and ttaaggttoopp stops the automatic write
from being attempted.
(Historically, the nneexxtt command ignored the
optional force flag.) Note, the eexx commands eeddiitt,
qquuiitt, sshheellll, and xxiitt are _n_o_t affected by the
aauuttoowwrriittee option.
bbeeaauuttiiffyy,, bbff [[ooffff]]
If this option is set, all control characters that
NNvvii//NNeexx RReeffeerreennccee UUSSDD::1133--7711
are not currently being specially interpreted,
other than <<ttaabb>>, <<nneewwlliinnee>>, and <<ffoorrmm--ffeeeedd>>, are
discarded from commands read in by eexx from command
files, and from input text entered to vvii (either
into the file or to the colon command line). Text
files read by eexx/vvii are _n_o_t affected by the bbeeaauu--
ttiiffyy option.
ccddppaatthh [[eennvviirroonnmmeenntt vvaarriiaabbllee CCDDPPAATTHH,, oorr ccuurrrreenntt ddiirreecc--
ttoorryy]]
This option is used to specify a colon separated
list of directories which are used as path pre-
fixes for any relative path names used as argu-
ments for the ccdd command. The value of this
option defaults to the value of the environmental
variable CCDDPPAATTHH if it is set, otherwise to the
current directory. For compatibility with the
POSIX 1003.2 shell, the ccdd command does _n_o_t check
the current directory as a path prefix for rela-
tive path names unless it is explicitly specified.
It may be so specified by entering an empty string
or a ".." character into the CCDDPPAATTHH variable or
the option value.
ccoolluummnnss,, ccoo [[8800]]
The number of columns in the screen. Setting this
option causes eexx/vvii to set (or reset) the environ-
mental variable CCOOLLUUMMNNSS. See the section entitled
"SSiizziinngg tthhee SSccrreeeenn" more information.
ccoommmmeenntt [[ooffff]]
VVii only. If the first non-empty line of the file
begins with the string "//**", this option causes vvii
to skip to the end of that C-language comment
(probably a terribly boring legal notice) before
displaying the file.
ddiirreeccttoorryy,, ddiirr [[eennvviirroonnmmeenntt vvaarriiaabbllee TTMMPPDDIIRR,, oorr //ttmmpp]]
The directory where temporary files are created.
The environmental variable TTMMPPDDIIRR is used as the
default value if it exists, otherwise //ttmmpp is
used.
eeddccoommppaattiibbllee,, eedd [[ooffff]]
Remember the values of the "c" and "g" suffices to
the ssuubbssttiittuuttee commands, instead of initializing
them as unset for each new command. Specifying
pattern and replacement strings to the ssuubbssttiittuuttee
command unsets the "c" and "g" suffices as well.
eerrrroorrbbeellllss,, eebb [[ooffff]]
EExx only. EExx error messages are normally presented
in inverse video. If that is not possible for the
UUSSDD::1133--7722 NNvvii//NNeexx RReeffeerreennccee
terminal, setting this option causes error mes-
sages to be announced by ringing the terminal
bell.
eexxrrcc,, eexx [[ooffff]]
If this option is turned off in the system or
$HOME startup files, the local startup files are
never read (unless they are the same as the system
or $HOME startup files). Turning it on has no
effect, i.e. the normal checks for local startup
files are performed, regardless. See the section
entitled "SSttaarrttuupp IInnffoorrmmaattiioonn" for more informa-
tion.
eexxtteennddeedd [[ooffff]]
This option causes all regular expressions to be
treated as POSIX 1003.2 Extended Regular Expres-
sions (which are similar to historic _e_g_r_e_p(1)
style expressions).
ffllaasshh [[oonn]]
This option causes the screen to flash instead of
beeping the keyboard, on error, if the terminal
has the capability.
hhaarrddttaabbss,, hhtt [[88]]
This option defines the spacing between hardware
tab settings, i.e. the tab expansion done by the
operating system and/or the terminal itself. As
nneexx/nnvvii never writes <<ttaabb>> characters to the ter-
minal, unlike historic versions of eexx/vvii, this
option does not currently have any affect.
iiggnnoorreeccaassee,, iicc [[ooffff]]
This option causes regular expressions, both in eexx
commands and in searches, to be evaluated in a
case-insensitive manner.
kkeeyyttiimmee [[66]]
The 10th's of a second eexx/vvii waits for a subse-
quent key to complete a key mapping.
lleeffttrriigghhtt [[ooffff]]
VVii only. This option causes the screen to be
scrolled left-right to view lines longer than the
screen, instead of the traditional vvii screen
interface which folds long lines at the right-hand
margin of the terminal.
lliinneess,, llii [[2244]]
VVii only. The number of lines in the screen. Set-
ting this option causes eexx/vvii to set (or reset)
the environmental variable LLIINNEESS. See the section
NNvvii//NNeexx RReeffeerreennccee UUSSDD::1133--7733
entitled "SSiizziinngg tthhee SSccrreeeenn" for more information.
lliisspp [[ooffff]]
VVii only. This option changes the behavior of the
vvii ((, )), {{, }}, [[[[ and ]]]] commands to match the
Lisp language. Also, the aauuttooiinnddeenntt option's
behavior is changed to be appropriate for Lisp.
_T_h_i_s _o_p_t_i_o_n _i_s _n_o_t _y_e_t _i_m_p_l_e_m_e_n_t_e_d_.
lliisstt [[ooffff]]
This option causes lines to be displayed in an
unambiguous fashion. Specifically, tabs are dis-
played as control characters, i.e. "^^II", and the
ends of lines are marked with a "$$" character.
mmaaggiicc [[oonn]]
This option is on by default. Turning the mmaaggiicc
option off causes all regular expression charac-
ters except for "^^" and "$$", to be treated as
ordinary characters. To re-enable characters
individually, when the mmaaggiicc option is off, pre-
cede them with a backslash "\\" character. See the
section entitled "RReegguullaarr EExxpprreessssiioonnss aanndd RReeppllaaccee--
mmeenntt SSttrriinnggss" for more information.
mmaattcchhttiimmee [[77]]
VVii only. The 10th's of a second eexx/vvii pauses on
the matching character when the sshhoowwmmaattcchh option
is set.
mmeessgg [[oonn]]
This option allows other users to contact you
using the _t_a_l_k(1) and _w_r_i_t_e(1) utilities, while
you are editing. EExx/vvii does not turn message on,
i.e. if messages were turned off when the editor
was invoked, they will stay turned off. This
option only permits you to disallow messages for
the edit session. See the _m_e_s_g(1) utility for
more information.
mmooddeelliinneess,, mmooddeelliinnee [[ooffff]]
If the mmooddeelliinneess option is set, eexx/vvii has histori-
cally scanned the first and last five lines of
each file as it is read for editing, looking for
any eexx commands that have been placed in those
lines. After the startup information has been
processed, and before the user starts editing the
file, any commands embedded in the file are exe-
cuted.
Commands were recognized by the letters "e" or "v"
followed by "x" or "i", at the beginning of a line
UUSSDD::1133--7744 NNvvii//NNeexx RReeffeerreennccee
or following a tab or space character, and fol-
lowed by a ":", an eexx command, and another ":".
This option is a security problem of immense pro-
portions, and should not be used under any circum-
stances.
_T_h_i_s _o_p_t_i_o_n _w_i_l_l _n_e_v_e_r _b_e _i_m_p_l_e_m_e_n_t_e_d_.
nnuummbbeerr,, nnuu [[ooffff]]
Precede each line displayed with its current line
number.
ooccttaall [[ooffff]]
Display unknown characters as octal numbers,
instead of the default hexadecimal.
ooppeenn [[oonn]]
EExx only. If this option is not set, the ooppeenn and
vviissuuaall commands are disallowed.
ooppttiimmiizzee,, oopptt [[oonn]]
VVii only. Throughput of text is expedited by set-
ting the terminal not to do automatic carriage
returns when printing more than one (logical) line
of output, greatly speeding output on terminals
without addressable cursors when text with leading
white space is printed.
_T_h_i_s _o_p_t_i_o_n _i_s _n_o_t _y_e_t _i_m_p_l_e_m_e_n_t_e_d_.
ppaarraaggrraapphhss,, ppaarraa [[IIPPLLPPPPPPQQPPPP LLIIppppllppiippbbpp]]
VVii only. Define additional paragraph boundaries
for the {{ and }} commands. The value of this
option must be a character string consisting of
zero or more character pairs.
In the text to be edited, the character string
<<nneewwlliinnee>>..<<cchhaarr--ppaaiirr>>, (where <<cchhaarr--ppaaiirr>> is one
of the character pairs in the option's value)
defines a paragraph boundary. For example, if the
option were set to LLaaAA<<ssppaaccee>>####, then all of the
following additional paragraph boundaries would be
recognized:
<newline>.La
<newline>.A<space>
<newline>.##
pprroommpptt [[oonn]]
EExx only. This option causes eexx to prompt for
NNvvii//NNeexx RReeffeerreennccee UUSSDD::1133--7755
command input with a "::" character; when it is not
set, no prompt is displayed.
rreeaaddoonnllyy,, rroo [[ooffff]]
This option causes a force flag to be required to
attempt to write the file back to the original
file name. Setting this option is equivalent to
using the --RR command line option, or editing a
file which lacks write permission.
rreeccddiirr [[//vvaarr//ttmmpp//vvii..rreeccoovveerr]]
The directory where recovery files are stored.
If you change the value of rreeccddiirr, be careful to
choose a directory whose contents are not regu-
larly deleted. Bad choices include directories in
memory based filesystems, or //ttmmpp, on most sys-
tems, as their contents are removed when the
machine is rebooted.
Public directories like //uussrr//ttmmpp and //vvaarr//ttmmpp are
usually safe, although some sites periodically
prune old files from them. There is no require-
ment that you use a public directory, e.g. a sub-
directory of your home directory will work fine.
Finally, if you change the value of rreeccddiirr, you
must modify the recovery script to operate in your
chosen recovery area.
See the section entitled "RReeccoovveerryy" for further
information.
rreeddrraaww,, rree [[ooffff]]
VVii only. The editor simulates (using great
amounts of output), an intelligent terminal on a
dumb terminal (e.g. during insertions in vvii the
characters to the right of the cursor are
refreshed as each input character is typed).
_T_h_i_s _o_p_t_i_o_n _i_s _n_o_t _y_e_t _i_m_p_l_e_m_e_n_t_e_d_.
rreemmaapp [[oonn]]
If this option is set, it is possible to define
macros in terms of other macros. Otherwise, each
key is only remapped up to one time. For example,
if "AA" is mapped to "BB", and "BB" is mapped to "CC",
The keystroke "AA" will be mapped to "CC" if the
rreemmaapp option is set, and to "BB" if it is not set.
rreeppoorrtt [[55]]
Set the threshold of the number of lines that need
to be changed or yanked before a message will be
UUSSDD::1133--7766 NNvvii//NNeexx RReeffeerreennccee
displayed to the user. For everything but the
yank command, the value is the largest value about
which the editor is silent, i.e. by default, 6
lines must be deleted before the user is notified.
However, if the number of lines yanked is greater
than _o_r _e_q_u_a_l _t_o the set value, it is reported to
the user.
rruulleerr [[ooffff]]
VVii only. Display a row/column ruler on the colon
command line.
ssccrroollll,, ssccrr [[wwiinnddooww // 22]]
Set the number of lines scrolled by the vvii <<ccoonn--
ttrrooll--DD>> and <<ccoonnttrrooll--UU>> commands.
Historically, the eexx zz command, when specified
without a count, used two times the size of the
scroll value; the POSIX 1003.2 standard specified
the window size, which is a better choice.
sseeccttiioonnss,, sseecctt [[NNHHSSHHHH HHUUnnhhsshh]]
VVii only. Define additional section boundaries for
the [[[[ and ]]]] commands. The sseeccttiioonnss option
should be set to a character string consisting of
zero or more character pairs. In the text to be
edited, the character string <<nneewwlliinnee>>..<<cchhaarr--
ppaaiirr>>, (where <<cchhaarr--ppaaiirr>> is one of the character
pairs in the option's value), defines a section
boundary in the same manner that ppaarraaggrraapphh option
boundaries are defined.
sshheellll,, sshh [[eennvviirroonnmmeenntt vvaarriiaabbllee SSHHEELLLL,, oorr //bbiinn//sshh]]
Select the shell used by the editor. The speci-
fied path is the pathname of the shell invoked by
the vvii !! shell escape command and by the eexx sshheellll
command. This program is also used to resolve any
shell meta-characters in eexx commands.
sshhiiffttwwiiddtthh,, ssww [[88]]
Set the autoindent and shift command indentation
width. This width is used by the aauuttooiinnddeenntt
option and by the <<, >>, and sshhiifftt commands.
sshhoowwddiirrttyy [[ooffff]]
VVii only. Display an asterisk on the colon command
line if the file has been modified.
sshhoowwmmaattcchh,, ssmm [[ooffff]]
VVii only. This option causes vvii, when a "}}" or "))"
is entered, to briefly move the cursor the match-
ing "{{" or "((". See the mmaattcchhttiimmee option for more
information.
NNvvii//NNeexx RReeffeerreennccee UUSSDD::1133--7777
sshhoowwmmooddee [[ooffff]]
VVii only. This option causes vvii to display a
string identifying the current editor mode on the
colon command line.
ssiiddeessccrroollll [[1166]]
VVii only. Sets the number of columns that are
shifted to the left or right, when vvii is doing
left-right scrolling and the left or right margin
is crossed. See the lleeffttrriigghhtt option for more
information.
sslloowwooppeenn,, ssllooww [[ooffff]]
This option affects the display algorithm used by
vvii, holding off display updating during input of
new text to improve throughput when the terminal
in use is slow and unintelligent.
_T_h_i_s _o_p_t_i_o_n _i_s _n_o_t _y_e_t _i_m_p_l_e_m_e_n_t_e_d_.
ssoouurrcceeaannyy [[ooffff]]
If this option is turned on, vvii historically read
startup files that were owned by someone other
than the editor user. See the section entitled
"SSttaarrttuupp IInnffoorrmmaattiioonn" for more information. This
option is a security problem of immense propor-
tions, and should not be used under any circum-
stances.
_T_h_i_s _o_p_t_i_o_n _w_i_l_l _n_e_v_e_r _b_e _i_m_p_l_e_m_e_n_t_e_d_.
ttaabbssttoopp,, ttss [[88]]
This option sets tab widths for the editor dis-
play.
ttaagglleennggtthh,, ttll [[00]]
This option sets the maximum number of characters
that are considered significant in a tag name.
Setting the value to 0 makes all of the characters
in the tag name significant.
ttaaggss,, ttaagg [[ttaaggss //vvaarr//ddbb//lliibbcc..ttaaggss //ssyyss//kkeerrnn//ttaaggss]]
Sets the list of tags files, in search order,
which are used when the editor searches for a tag.
tteerrmm,, ttttyyttyyppee,, ttttyy [[eennvviirroonnmmeenntt vvaarriiaabbllee TTEERRMM]]
Set the terminal type. Setting this option causes
eexx/vvii to set (or reset) the environmental variable
TTEERRMM.
tteerrssee [[ooffff]]
This option has historically made editor messages
less verbose. It has no effect in this
UUSSDD::1133--7788 NNvvii//NNeexx RReeffeerreennccee
implementation. See the vveerrbboossee option for more
information.
ttiillddeeoopp
Modify the ~~ command to take an associated motion.
ttiimmeeoouutt,, ttoo [[oonn]]
If this option is set, eexx/vvii waits for a specific
period for a subsequent key to complete a key map-
ping (see the kkeeyyttiimmee option). If the option is
not set, the editor waits until enough keys are
entered to resolve the ambiguity, regardless of
how long it takes.
ttttyywweerraassee [[ooffff]]
VVii only. This option changes how vvii does word
erase during text input. If this option is set,
text is broken up into two classes, blank charac-
ters and nonblank characters. Changing from one
class to another marks the end of a word.
vveerrbboossee [[ooffff]]
VVii only. VVii historically bells the terminal for
many obvious mistakes, e.g. trying to move past
the left-hand margin, or past the end of the file.
If this option is set, an error message is dis-
played for all errors.
ww330000 [[nnoo ddeeffaauulltt]]
VVii only. Set the window size if the baud rate is
less than 1200 baud. See the wwiinnddooww option for
more information.
ww11220000 [[nnoo ddeeffaauulltt]]
VVii only. Set the window size if the baud rate is
equal to 1200 baud. See the wwiinnddooww option for
more information.
ww99660000 [[nnoo ddeeffaauulltt]]
VVii only. Set the window size if the baud rate is
greater than 1200 baud. See the wwiinnddooww option for
more information.
wwaarrnn [[oonn]]
EExx only. This option causes a warning message to
the terminal if the file has been modified, since
it was last written, before a !! command.
wwiinnddooww,, ww,, wwii [[eennvviirroonnmmeenntt vvaarriiaabbllee LLIINNEESS]]
This option determines the default number of lines
in a screenful, as written by the zz command. It
also determines the number of lines scrolled by
the vvii commands <<ccoonnttrrooll--FF>> and <<ccoonnttrrooll--BB>>. The
NNvvii//NNeexx RReeffeerreennccee UUSSDD::1133--7799
value of window can be unrelated to the real
screen size, although it starts out as the number
of lines on the screen (see the section entitled
"SSiizziinngg tthhee SSccrreeeenn" for more information). Set-
ting the value of the wwiinnddooww option is the same as
using the --ww command line option.
If the value of the wwiinnddooww option (as set by the
wwiinnddooww, ww330000, ww11220000 or ww99660000 options) is smaller
than the actual size of the screen, large screen
movements will result in displaying only that
smaller number of lines on the screen. (Further
movements in that same area will result in the
screen being filled.) This can provide a perfor-
mance improvement when viewing different places in
one or more files over a slow link.
wwrraappmmaarrggiinn,, wwmm [[00]]
VVii only. If the value of the wwrraappmmaarrggiinn option is
non-zero, vvii will split lines so that they end at
least that number of characters before the right-
hand margin of the screen. (Note, the value of
wwrraappmmaarrggiinn is _n_o_t a text length. In a screen that
is 80 columns wide, the command "::sseett wwrraappmmaarr--
ggiinn==88" attempts to keep the lines less than or
equal to 72 columns wide.)
Lines are split at the previous whitespace charac-
ter closest to the number. Any trailing whites-
pace characters before that character are deleted.
If the line is split because of an inserted
<<ssppaaccee>> or <<ttaabb>> character, and you then enter
another <<ssppaaccee>> character, it is discarded.
If wrapmargin is set to 0, or if there is no blank
character upon which to split the line, the line
is not broken.
wwrraappssccaann,, wwss [[oonn]]
This option causes searches to wrap around the end
or the beginning of the file, and back to the
starting point. Otherwise, the end or beginning
of the file terminates the search.
wwrriitteeaannyy,, wwaa [[ooffff]]
If this option is set, file-overwriting checks
that would usually be made before the wwrriittee and
xxiitt commands, or before an automatic write (see
the aauuttoowwrriittee option), are not made. This allows
a write to any file, provided the file permissions
allow it.
UUSSDD::1133--8800 NNvvii//NNeexx RReeffeerreennccee
1166.. AAddddiittiioonnaall FFeeaattuurreess iinn NNeexx//NNvvii
There are a few features in nneexx/nnvvii that are not
found in historic versions of eexx/vvii. Some of the more
interesting of those features are as follows:
88--bbiitt cclleeaann ddaattaa,, llaarrggee lliinneess,, ffiilleess
NNeexx/nnvvii will edit any format file. Line lengths
are limited by available memory, and file sizes
are limited by available disk space. The vvii text
input mode command <<ccoonnttrrooll--XX>> can insert any pos-
sible character value into the text.
SSpplliitt ssccrreeeennss
The sspplliitt command divides the screen into multiple
editing regions. The <<ccoonnttrrooll--WW>> command rotates
between the foreground screens. The rreessiizzee com-
mand can be used to grow or shrink a particular
screen.
BBaacckkggrroouunndd aanndd ffoorreeggrroouunndd ssccrreeeennss
The bbgg command backgrounds the current screen, and
the ffgg command foregrounds backgrounded screens.
The ddiissppllaayy command can be used to list the back-
ground screens.
TTaagg ssttaacckkss
Tags are now maintained in a stack. The <<ccoonnttrrooll--
TT>> command returns to the previous tag location.
The ttaaggppoopp command returns to the most recent tag
location by default, or, optionally to a specific
tag number in the tag stack, or the most recent
tag from a specified file. The ddiissppllaayy command
can be used to list the tags stack. The ttaaggttoopp
command returns to the top of the tag stack.
NNeeww ddiissppllaayyss
The ddiissppllaayy command can be used to display the
current buffers, the backgrounded screens, and the
tags stack.
IInnffiinniittee uunnddoo
Changes made during an edit session may be rolled
backward and forward. A .. command immediately
after a uu command continues either forward or
backward depending on whether the uu command was an
undo or a redo.
UUssaaggee iinnffoorrmmaattiioonn
The eexxuussaaggee and vviiuussaaggee commands provide usage
information for all of the eexx and vvii commands by
default, or, optionally, for a specific command or
key.
NNvvii//NNeexx RReeffeerreennccee UUSSDD::1133--8811
EExxtteennddeedd RReegguullaarr EExxpprreessssiioonnss
The eexxtteennddeedd option causes Regular Expressions to
be interpreted as as Extended Regular Expressions,
(i.e. _e_g_r_e_p(1) style Regular Expressions).
WWoorrdd sseeaarrcchh
The <<ccoonnttrrooll--AA>> command searches for the word ref-
erenced by the cursor.
NNuummbbeerr iinnccrreemmeenntt
The ## command increments or decrements the number
referenced by the cursor.
PPrreevviioouuss ffiillee
The pprreevviioouuss command edits the previous file from
the argument list.
LLeefftt--rriigghhtt ssccrroolllliinngg
The lleeffttrriigghhtt option causes nnvvii to do left-right
screen scrolling, instead of the traditional vvii
line wrapping.
UUSSDD::1133--8822 NNvvii//NNeexx RReeffeerreennccee
1177.. IInnddeexx
! 15, 34 @ 20, 35 columns 47
"" 34 A 20 comment 47
# 16, 35 B 20 copy 36
$ 16 C 21 count 10, 33
% 16 D 21 current pathname 8
& 17, 42 E 21 d 26
( 17 F 21 delete 37
) 17 G 21 directory 47
* 35 H 21 display 37
+ 13 I 22 e 26
, 18 J 22 edcompatible47
/RE/ 18 L 22 edit 37
0 19 M 22 errorbells 47
0<control-D>31 N 18 exrc 47
: 19 O 22 extended 48
; 19 P 23 exusage 37
< 20, 35 Q 23 f 26
<control-A> 11 R 23 fg 37
<control-B> 11 S 23 file 33, 37
<control-1D2>, 31 T 23 flags 33
<control-E> 12 U 23 flash 48
<control-F> 12 W 24 global 38
<control-G> 12 X 24 hardtabs 48
<control-1H2>, 31 Y 24 help 38
<control-J> 13 ZZ 24 i 26
<control-L> 13 [[ 24 ignorecase 48
<control-M> 13 - 18 insert 38
<control-N> 13 ]] 25 j 13
<control-P> 13 ^ 25 join 38
<control-R> 13 ^<control-D>31 k 13, 39
<control-1T4>, 31 _ 25 keytime 48
<control-U> 14 `<character>17 l 15
<control-1W4>, 31 a 25 leftright 48
<control-X> 31 abbrev 35 line 33
<control-Y> 14 alternate pathname 8 lines 48
<control-1Z4>, 43 altwerase 46 lisp 48
<control-]> 15 append 36 list 39, 48
<control-^> 15 args 36 m 27
<end-of-file> 34 autoindent 46 magic 48
<eof> 33 autoprint 46 map 39
<erase> 31 autowrite 47 mark 39
<escape>14, 31 b 25 matchtime 48
<inter7r,up3t0>, 31 beautify 47 mesg 48
<line erase>31 bg 36 mkexrc 39
<literal next> 7, 31 bigword 10 modelines 49
<nul> 30 buffer 8 motion 10
<space> 15 c 26 move 39
<word erase>31 cd 36 n 18
= 35 cdpath 47 next 40
> 20, 35 change 36 number 35, 49
?RE? 18 chdir 36 o 27
NNvvii//NNeexx RReeffeerreennccee UUSSDD::1133--8833
octal 49 tildeop 51
open 40, 49 timeout 51
optimize 49 ttywerase 52
p 27 u 28
paragraph 11 unabbrev 44
paragraphs 49 undo 44
preserve 40 unmap 44
previous 40 unnamed buffer 8
previous context 9 v 38
print 40 verbose 52
prompt 49 version 44
put 40 visual 44
quit 41 viusage 44
r 27 w 28
range 33 w1200 52
read 41 w300 52
readonly 49 w9600 52
recdir 49 warn 52
recover 41 window 52
redraw 50 wn 44
remap 50 word 10
report 50 wq 44
resize 41 wrapmargin 52
rewind 41 wrapscan 52
ruler 50 write 44
s 27 writeany 53
scroll 50 x 28
section 11 xit 45
sections 50 y 28
sentence 11 yank 45
set 41 z 28, 45
shell 42, 50 { 29
shiftwidth 50 | 29
showdirty 51 } 29
showmatch 51 ~ 29, 30, 42
showmode 51
sidescroll 51
slowopen 51
source 42
sourceany 51
split 42
stop 43
substitute 42
suspend 43
t 27, 36
tabstop 51
tag 43
taglength 51
tagpop 43
tags 51
tagtop 43
term 51
terse 51
UUSSDD::1133--22 NNvvii//NNeexx RReeffeerreennccee
TTaabbllee ooff CCoonntteennttss
Description ...................................... 3
Startup Information .............................. 3
Recovery ......................................... 4
Sizing the Screen ................................ 7
Character Display ................................ 7
Multiple Screens ................................. 8
Regular Expressions and Replacement Strings ...... 9
General Editor Description ....................... 10
Vi Description ................................... 12
Vi Commands ...................................... 17
Vi Text Input Commands ........................... 45
Ex Addressing .................................... 47
Ex Description ................................... 49
Ex Commands ...................................... 50
Set Options ...................................... 68
Additional Features in Nex/Nvi ................... 79
Index ............................................ 82
|