95 \fB/usr/xpg6/bin/vi\fR [\fB-|\fR \fB-s\fR] [\fB-l\fR] [\fB-L\fR] [\fB-R\fR] [\fB-r\fR [\fIfilename\fR]]
96 [\fB-S\fR] [\fB-t\fR \fItag\fR] [\fB-v\fR] [\fB-V\fR] [\fB-x\fR] [\fB-w\fR\fIn\fR] [\fB-C\fR]
97 [\fB+\fR\fIcommand\fR | \fB-c\fR \fIcommand\fR] \fIfilename\fR...
98 .fi
99
100 .LP
101 .nf
102 \fB/usr/xpg6/bin/view\fR [\fB-|\fR \fB-s\fR] [\fB-l\fR] [\fB-L\fR] [\fB-R\fR] [\fB-r\fR [\fIfilename\fR]]
103 [\fB-S\fR] [\fB-t\fR \fItag\fR] [\fB-v\fR] [\fB-V\fR] [\fB-x\fR] [\fB-w\fR\fIn\fR] [\fB-C\fR]
104 [\fB+\fR\fIcommand\fR | \fB-c\fR \fIcommand\fR] \fIfilename\fR...
105 .fi
106
107 .LP
108 .nf
109 \fB/usr/xpg6/bin/vedit\fR [\fB-|\fR \fB-s\fR] [\fB-l\fR] [\fB-L\fR] [\fB-R\fR] [\fB-r\fR [\fIfilename\fR]]
110 [\fB-S\fR] [\fB-t\fR \fItag\fR] [\fB-v\fR] [\fB-V\fR] [\fB-x\fR] [\fB-w\fR\fIn\fR] [\fB-C\fR]
111 [\fB+\fR\fIcommand\fR | \fB-c\fR \fIcommand\fR] \fIfilename\fR...
112 .fi
113
114 .SH DESCRIPTION
115 .sp
116 .LP
117 The \fBvi\fR (visual) utility is a display-oriented text editor based on an
118 underlying line editor \fBex\fR. It is possible to use the command mode of
119 \fBex\fR from within \fBvi\fR and to use the command mode of \fBvi\fR from
120 within \fBex\fR. The visual commands are described on this manual page; how to
121 set options (like automatically numbering lines and automatically starting a
122 new output line when you type carriage return) and all \fBex\fR line editor
123 commands are described on the \fBex\fR(1) manual page.
124 .sp
125 .LP
126 When using \fBvi\fR, changes you make to the file are reflected in what you see
127 on your terminal screen. The position of the cursor on the screen indicates the
128 position within the file.
129 .sp
130 .LP
131 The \fBview\fR invocation is the same as \fBvi\fR except that the
132 \fBreadonly\fR flag is set.
133 .sp
134 .LP
135 The \fBvedit\fR invocation is intended for beginners. It is the same as
136 \fBvi\fR except that the \fBreport\fR flag is set to \fB1\fR, the
137 \fBshowmode\fR and \fBnovice\fR flags are set, and \fBmagic\fR is turned off.
138 These defaults make it easier to learn how to use \fBvi\fR.
139 .SH OPTIONS
140 .sp
141 .LP
142 The following options are supporrted:
143 .SS "Invocation Options"
144 .sp
145 .LP
146 The following invocation options are interpreted by \fBvi\fR (previously
147 documented options are discussed under NOTES):
148 .sp
149 .ne 2
150 .na
151 \fB\fB\(mi\fR | \fB-s\fR\fR
152 .ad
153 .RS 25n
154 Suppresses all interactive user feedback. This is useful when processing editor
155 scripts.
156 .RE
157
158 .sp
159 .ne 2
160 .na
161 \fB\fB-C\fR\fR
162 .ad
163 .RS 25n
164 Encryption option. Same as the \fB-x\fR option, except that \fBvi\fR simulates
272 decrypt text using the algorithm of the \fBcrypt\fR command. The \fBX\fR
273 command makes an educated guess to determine whether text read in is encrypted
274 or not. The temporary buffer file is encrypted also, using a transformed
275 version of the key typed in for the \fB-x\fR option. If an empty encryption
276 key is entered (that is, if the return key is pressed right after the prompt),
277 the file is not encrypted. This is a good way to decrypt a file erroneously
278 encrypted with a mistyped encryption key, such as a backspace or undo key.
279 .RE
280
281 .sp
282 .ne 2
283 .na
284 \fB\fB-\fR\fIcommand\fR | \fB-c\fR \fIcommand\fR\fR
285 .ad
286 .RS 25n
287 Begins editing by executing the specified editor \fIcommand\fR (usually a
288 search or positioning command).
289 .RE
290
291 .SS "/usr/xpg4/bin/vi and /usr/xpg6/bin/vi"
292 .sp
293 .LP
294 If both the \fB-t\fR \fItag\fR and the \fB-c\fR \fIcommand\fR options are
295 given, the \fB-t\fR \fItag\fR optionis processed first. That is, the file
296 containing \fItag\fR is selected by \fB-t\fR and then the command is executed.
297 .SH OPERANDS
298 .sp
299 .LP
300 The following operands are supported:
301 .sp
302 .ne 2
303 .na
304 \fB\fIfilename\fR\fR
305 .ad
306 .RS 12n
307 A file to be edited.
308 .RE
309
310 .SH COMMAND SUMMARY
311 .sp
312 .LP
313 The \fBvi\fR command modes are summarized in this section.
314 .SS "vi Modes"
315 .sp
316 .ne 2
317 .na
318 \fBCommand\fR
319 .ad
320 .RS 13n
321 Normal and initial mode. Other modes return to command mode upon completion.
322 \fIESC\fR (escape) is used to cancel a partial command.
323 .RE
324
325 .sp
326 .ne 2
327 .na
328 \fBInput\fR
329 .ad
330 .RS 13n
331 Entered by setting any of the following options:
332 .sp
333 .in +2
334 .nf
335 a A i I o O c C s S R
336 .fi
337 .in -2
338 .sp
339
340 Arbitrary text can then be entered. Input mode is normally terminated with the
341 \fIESC\fR character, or, abnormally, with an interrupt.
342 .RE
343
344 .sp
345 .ne 2
346 .na
347 \fBLast line\fR
348 .ad
349 .RS 13n
350 Reading input for \fB: / ?\fR or \fB!\fR. Terminate by typing a carriage
351 return. An interrupt cancels termination.
352 .RE
353
354 .SS "Sample Commands"
355 .sp
356 .LP
357 In the descriptions, \fICR\fR stands for carriage return and \fIESC\fR stands
358 for the escape key.
359 .sp
360 .ne 2
361 .na
362 \fB\(<-, \(->\fR
363 .ad
364 .br
365 .na
366 \fBdown-arrow\fR
367 .ad
368 .br
369 .na
370 \fBup-arrow\fR
371 .ad
372 .RS 14n
373 arrow keys move the cursor
374 .RE
375
483
484 .sp
485 .ne 2
486 .na
487 \fB^U ^D\fR
488 .ad
489 .RS 14n
490 scroll up or down
491 .RE
492
493 .sp
494 .ne 2
495 .na
496 \fB:\fIcmd\fR\fICR\fR\fR
497 .ad
498 .RS 14n
499 any \fBex\fR or \fBed\fR command
500 .RE
501
502 .SS "Counts Before vi Commands"
503 .sp
504 .LP
505 Numbers can be typed as a prefix to some commands. They are interpreted in one
506 of these ways:
507 .sp
508 .ne 2
509 .na
510 \fBline/column number\fR
511 .ad
512 .RS 22n
513 z G |
514 .RE
515
516 .sp
517 .ne 2
518 .na
519 \fBscroll amount\fR
520 .ad
521 .RS 22n
522 ^D ^U
523 .RE
524
525 .sp
526 .ne 2
527 .na
528 \fBrepeat effect\fR
529 .ad
530 .RS 22n
531 most of the rest
532 .RE
533
534 .SS "Interrupting, Canceling"
535 .sp
536 .ne 2
537 .na
538 \fB\fIESC\fR\fR
539 .ad
540 .RS 7n
541 end insert or incomplete command
542 .RE
543
544 .sp
545 .ne 2
546 .na
547 \fB\fIDEL\fR\fR
548 .ad
549 .RS 7n
550 (delete or rubout) interrupts
551 .RE
552
553 .SS "File Manipulation"
554 .sp
555 .ne 2
556 .na
557 \fBZZ\fR
558 .ad
559 .RS 15n
560 if file modified, write and exit; otherwise, exit
561 .RE
562
563 .sp
564 .ne 2
565 .na
566 \fB:w\fICR\fR\fR
567 .ad
568 .RS 15n
569 write back changes
570 .RE
571
572 .sp
573 .ne 2
574 .na
711 .ad
712 .RS 15n
713 show current file and line
714 .RE
715
716 .sp
717 .ne 2
718 .na
719 \fB:ta \fItag\fR\fICR\fR\fR
720 .ad
721 .RS 15n
722 position cursor to \fItag\fR
723 .RE
724
725 .sp
726 .LP
727 In general, any \fBex\fR or \fBed\fR command (such as \fIsubstitute\fR or
728 \fIglobal\fR) can be typed, preceded by a colon and followed by a carriage
729 return.
730 .SS "Positioning Within a File"
731 .sp
732 .ne 2
733 .na
734 \fBF\fR
735 .ad
736 .RS 14n
737 forward screen
738 .RE
739
740 .sp
741 .ne 2
742 .na
743 \fB^B\fR
744 .ad
745 .RS 14n
746 backward screen
747 .RE
748
749 .sp
750 .ne 2
751 .na
875
876 .sp
877 .ne 2
878 .na
879 \fB}\fR
880 .ad
881 .RS 14n
882 end of paragraph
883 .RE
884
885 .sp
886 .ne 2
887 .na
888 \fB%\fR
889 .ad
890 .RS 14n
891 find matching \fB( )\fR or \fB{ }\fR
892 .RE
893
894 .SS "Adjusting the Screen"
895 .sp
896 .ne 2
897 .na
898 \fB^L\fR
899 .ad
900 .RS 16n
901 clear and redraw window
902 .RE
903
904 .sp
905 .ne 2
906 .na
907 \fB^R\fR
908 .ad
909 .RS 16n
910 clear and redraw window if \fB^L\fR is \(-> key
911 .RE
912
913 .sp
914 .ne 2
915 .na
957
958 .sp
959 .ne 2
960 .na
961 \fB^E\fR
962 .ad
963 .RS 16n
964 scroll window down one line
965 .RE
966
967 .sp
968 .ne 2
969 .na
970 \fB^Y\fR
971 .ad
972 .RS 16n
973 scroll window up one line
974 .RE
975
976 .SS "Marking and Returning"
977 .sp
978 .ne 2
979 .na
980 \fB\(ga\(ga\fR
981 .ad
982 .RS 12n
983 move cursor to previous context
984 .RE
985
986 .sp
987 .ne 2
988 .na
989 \fBa\'a\'\fR
990 .ad
991 .RS 12n
992 move cursor to first non-white space in line
993 .RE
994
995 .sp
996 .ne 2
997 .na
1003
1004 .sp
1005 .ne 2
1006 .na
1007 \fB\(ga\fIx\fR\fR
1008 .ad
1009 .RS 12n
1010 move cursor to mark \fIx\fR
1011 .RE
1012
1013 .sp
1014 .ne 2
1015 .na
1016 \fBa\'\fIx\fR\fR
1017 .ad
1018 .RS 12n
1019 move cursor to first non-white space in line marked by \fIx\fR
1020 .RE
1021
1022 .SS "Line Positioning"
1023 .sp
1024 .ne 2
1025 .na
1026 \fBH\fR
1027 .ad
1028 .RS 14n
1029 top line on screen
1030 .RE
1031
1032 .sp
1033 .ne 2
1034 .na
1035 \fBL\fR
1036 .ad
1037 .RS 14n
1038 last line on screen
1039 .RE
1040
1041 .sp
1042 .ne 2
1043 .na
1084 \fBor \fBj\fR\fR
1085 .ad
1086 .RS 14n
1087 next line, same column
1088 .RE
1089
1090 .sp
1091 .ne 2
1092 .na
1093 \fB\fBup-arrow\fR\fR
1094 .ad
1095 .br
1096 .na
1097 \fBor \fBk\fR\fR
1098 .ad
1099 .RS 14n
1100 previous line, same column
1101 .RE
1102
1103 .SS "Character Positioning"
1104 .sp
1105 .ne 2
1106 .na
1107 \fB^\fR
1108 .ad
1109 .RS 13n
1110 first non-white space character
1111 .RE
1112
1113 .sp
1114 .ne 2
1115 .na
1116 \fB0\fR
1117 .ad
1118 .RS 13n
1119 beginning of line
1120 .RE
1121
1122 .sp
1123 .ne 2
1124 .na
1220
1221 .sp
1222 .ne 2
1223 .na
1224 \fB\fIn\fR|\fR
1225 .ad
1226 .RS 13n
1227 move to column \fIn\fR
1228 .RE
1229
1230 .sp
1231 .ne 2
1232 .na
1233 \fB%\fR
1234 .ad
1235 .RS 13n
1236 find matching \fB( )\fR or \fB{ }\fR
1237 .RE
1238
1239 .SS "Words, Sentences, Paragraphs"
1240 .sp
1241 .ne 2
1242 .na
1243 \fBw\fR
1244 .ad
1245 .RS 5n
1246 forward a word
1247 .RE
1248
1249 .sp
1250 .ne 2
1251 .na
1252 \fBb\fR
1253 .ad
1254 .RS 5n
1255 back a word
1256 .RE
1257
1258 .sp
1259 .ne 2
1260 .na
1311
1312 .sp
1313 .ne 2
1314 .na
1315 \fBB\fR
1316 .ad
1317 .RS 5n
1318 back a blank-delimited word
1319 .RE
1320
1321 .sp
1322 .ne 2
1323 .na
1324 \fBE\fR
1325 .ad
1326 .RS 5n
1327 end of a blank-delimited word
1328 .RE
1329
1330 .SS "Corrections During Insert"
1331 .sp
1332 .ne 2
1333 .na
1334 \fB^H\fR
1335 .ad
1336 .RS 16n
1337 erase last character (backspace)
1338 .RE
1339
1340 .sp
1341 .ne 2
1342 .na
1343 \fB^W\fR
1344 .ad
1345 .RS 16n
1346 erase last word
1347 .RE
1348
1349 .sp
1350 .ne 2
1351 .na
1412
1413 .sp
1414 .ne 2
1415 .na
1416 \fB0^D\fR
1417 .ad
1418 .RS 16n
1419 backtab to beginning of line; reset left margin of \fIautoindent\fR
1420 .RE
1421
1422 .sp
1423 .ne 2
1424 .na
1425 \fB^V\fR
1426 .ad
1427 .RS 16n
1428 quote non-printable character
1429 .RE
1430
1431 .SS "Insert and Replace"
1432 .sp
1433 .ne 2
1434 .na
1435 \fBa\fR
1436 .ad
1437 .RS 12n
1438 append after cursor
1439 .RE
1440
1441 .sp
1442 .ne 2
1443 .na
1444 \fBA\fR
1445 .ad
1446 .RS 12n
1447 append at end of line
1448 .RE
1449
1450 .sp
1451 .ne 2
1452 .na
1485
1486 .sp
1487 .ne 2
1488 .na
1489 \fBr\fIx\fR\fR
1490 .ad
1491 .RS 12n
1492 replace single character with \fIx\fR
1493 .RE
1494
1495 .sp
1496 .ne 2
1497 .na
1498 \fBR\fItext\fR\fIESC\fR\fR
1499 .ad
1500 .RS 12n
1501 replace characters
1502 .RE
1503
1504 .SS "Operators"
1505 .sp
1506 .LP
1507 Operators are followed by a cursor motion and affect all text that would have
1508 been moved over. For example, since \fBw\fR moves over a word, \fBdw\fR deletes
1509 the word that would be moved over. Double the operator, for example \fBdd\fR,
1510 to affect whole lines.
1511 .sp
1512 .ne 2
1513 .na
1514 \fBd\fR
1515 .ad
1516 .RS 5n
1517 delete
1518 .RE
1519
1520 .sp
1521 .ne 2
1522 .na
1523 \fBc\fR
1524 .ad
1525 .RS 5n
1546
1547 .sp
1548 .ne 2
1549 .na
1550 \fB>\fR
1551 .ad
1552 .RS 5n
1553 right shift
1554 .RE
1555
1556 .sp
1557 .ne 2
1558 .na
1559 \fB!\fR
1560 .ad
1561 .RS 5n
1562 filter through command
1563 .RE
1564
1565 .SS "Miscellaneous Operations"
1566 .sp
1567 .ne 2
1568 .na
1569 \fBC\fR
1570 .ad
1571 .RS 5n
1572 change rest of line (\fBc$\fR)
1573 .RE
1574
1575 .sp
1576 .ne 2
1577 .na
1578 \fBD\fR
1579 .ad
1580 .RS 5n
1581 delete rest of line (\fBd$\fR)
1582 .RE
1583
1584 .sp
1585 .ne 2
1586 .na
1619
1620 .sp
1621 .ne 2
1622 .na
1623 \fBX\fR
1624 .ad
1625 .RS 5n
1626 delete characters before cursor \fBdh\fR)
1627 .RE
1628
1629 .sp
1630 .ne 2
1631 .na
1632 \fBY\fR
1633 .ad
1634 .RS 5n
1635 yank lines (\fByy\fR)
1636 .RE
1637
1638 .SS "Yank and Put"
1639 .sp
1640 .LP
1641 Put inserts the text most recently deleted or yanked; however, if a buffer is
1642 named (using the \fBASCII\fR lower-case letters \fBa\fR - \fBz\fR), the text in
1643 that buffer is put instead.
1644 .sp
1645 .ne 2
1646 .na
1647 \fB3yy\fR
1648 .ad
1649 .RS 7n
1650 yank 3 lines
1651 .RE
1652
1653 .sp
1654 .ne 2
1655 .na
1656 \fB3yl\fR
1657 .ad
1658 .RS 7n
1659 yank 3 characters
1688
1689 .sp
1690 .ne 2
1691 .na
1692 \fB"\fIx\fRy\fR
1693 .ad
1694 .RS 7n
1695 yank to buffer \fIx\fR
1696 .RE
1697
1698 .sp
1699 .ne 2
1700 .na
1701 \fB"\fIx\fRd\fR
1702 .ad
1703 .RS 7n
1704 delete into buffer \fIx\fR
1705 .RE
1706
1707 .SS "Undo, Redo, Retrieve"
1708 .sp
1709 .ne 2
1710 .na
1711 \fBu\fR
1712 .ad
1713 .RS 7n
1714 undo last change
1715 .RE
1716
1717 .sp
1718 .ne 2
1719 .na
1720 \fBU\fR
1721 .ad
1722 .RS 7n
1723 restore current line
1724 .RE
1725
1726 .sp
1727 .ne 2
1728 .na
1729 \fB\&.\fR
1730 .ad
1731 .RS 7n
1732 repeat last change
1733 .RE
1734
1735 .sp
1736 .ne 2
1737 .na
1738 \fB"\fId\fRp\fR
1739 .ad
1740 .RS 7n
1741 retrieve \fId\fR'th last delete
1742 .RE
1743
1744 .SH USAGE
1745 .sp
1746 .LP
1747 See \fBlargefile\fR(5) for the description of the behavior of \fBvi\fR and
1748 \fBview\fR when encountering files greater than or equal to 2 Gbyte ( 2^31
1749 bytes).
1750 .SH ENVIRONMENT VARIABLES
1751 .sp
1752 .LP
1753 See \fBenviron\fR(5) for descriptions of the following environment variables
1754 that affect the execution of \fBvi\fR: \fBLANG\fR, \fBLC_ALL\fR,
1755 \fBLC_COLLATE\fR, \fBLC_CTYPE\fR, \fBLC_TIME\fR, \fBLC_MESSAGES\fR,
1756 \fBNLSPATH\fR, \fBPATH\fR, \fBSHELL\fR, and \fBTERM\fR.
1757 .sp
1758 .ne 2
1759 .na
1760 \fB\fBCOLUMNS\fR\fR
1761 .ad
1762 .RS 11n
1763 Override the system-selected horizontal screen size.
1764 .RE
1765
1766 .sp
1767 .ne 2
1768 .na
1769 \fB\fBEXINIT\fR\fR
1770 .ad
1771 .RS 11n
1772 Determine a list of \fBex\fR commands that are executed on editor start-up,
1773 before reading the first file. The list can contain multiple commands by
1774 separating them using a vertical-line (\fB|\fR) character.
1775 .RE
1776
1777 .sp
1778 .ne 2
1779 .na
1780 \fB\fBLINES\fR\fR
1781 .ad
1782 .RS 11n
1783 Override the system-selected vertical screen size, used as the number of lines
1784 in a screenful and the vertical screen size in visual mode.
1785 .RE
1786
1787 .SH FILES
1788 .sp
1789 .ne 2
1790 .na
1791 \fB\fB/var/tmp\fR\fR
1792 .ad
1793 .sp .6
1794 .RS 4n
1795 default directory where temporary work files are placed; it can be changed
1796 using the \fBdirectory\fR option (see the \fBex\fR(1) command)
1797 .RE
1798
1799 .sp
1800 .ne 2
1801 .na
1802 \fB\fB/usr/share/lib/terminfo/?/*\fR\fR
1803 .ad
1804 .sp .6
1805 .RS 4n
1806 compiled terminal description database
1807 .RE
1808
1809 .sp
1810 .ne 2
1811 .na
1812 \fB\fB/usr/lib/.COREterm/?/*\fR\fR
1813 .ad
1814 .sp .6
1815 .RS 4n
1816 subset of compiled terminal description database
1817 .RE
1818
1819 .SH ATTRIBUTES
1820 .sp
1821 .LP
1822 See \fBattributes\fR(5) for descriptions of the following attributes:
1823 .SS "/usr/bin/vi, /usr/bin/view, /usr/bin/vedit"
1824 .sp
1825
1826 .sp
1827 .TS
1828 box;
1829 c | c
1830 l | l .
1831 ATTRIBUTE TYPE ATTRIBUTE VALUE
1832 _
1833 CSI Not enabled
1834 .TE
1835
1836 .SS "/usr/xpg4/bin/vi, /usr/xpg4/bin/view, /usr/xpg4/bin/vedit"
1837 .sp
1838
1839 .sp
1840 .TS
1841 box;
1842 c | c
1843 l | l .
1844 ATTRIBUTE TYPE ATTRIBUTE VALUE
1845 _
1846 CSI Enabled
1847 _
1848 Interface Stability Standard
1849 .TE
1850
1851 .SS "/usr/xpg6/bin/vi, /usr/xpg6/bin/view, /usr/xpg6/bin/vedit"
1852 .sp
1853
1854 .sp
1855 .TS
1856 box;
1857 c | c
1858 l | l .
1859 ATTRIBUTE TYPE ATTRIBUTE VALUE
1860 _
1861 CSI Enabled
1862 _
1863 Interface Stability Standard
1864 .TE
1865
1866 .SH SEE ALSO
1867 .sp
1868 .LP
1869 \fBIntro\fR(1), \fBctags\fR(1), \fBed\fR(1), \fBedit\fR(1), \fBex\fR(1),
1870 \fBattributes\fR(5), \fBenviron\fR(5), \fBlargefile\fR(5), \fBstandards\fR(5)
1871 .sp
1872 .LP
1873 \fISolaris Advanced User\&'s Guide\fR
1874 .SH AUTHOR
1875 .sp
1876 .LP
1877 \fBvi\fR and \fBex\fR were developed by The University of California, Berkeley
1878 California, Computer Science Division, Department of Electrical Engineering and
1879 Computer Science.
1880 .SH NOTES
1881 .sp
1882 .LP
1883 Two options, although they continue to be supported, have been replaced in the
1884 documentation by options that follow the Command Syntax Standard (see
1885 \fBIntro\fR(1)). An \fB-r\fR option that is not followed with an
1886 option-argument has been replaced by \fB-L\fR and \fB+\fR\fBcommand\fR has been
1887 replaced by \fB-c\fR \fBcommand\fR.
1888 .sp
1889 .LP
1890 The message \fBfile too large to recover with\fR \fB-r\fR \fBoption\fR, which
1891 is seen when a file is loaded, indicates that the file can be edited and saved
1892 successfully, but if the editing session is lost, recovery of the file with the
1893 \fB-r\fR option is not possible.
1894 .sp
1895 .LP
1896 The editing environment defaults to certain configuration options. When an
1897 editing session is initiated, \fBvi\fR attempts to read the \fBEXINIT\fR
1898 environment variable. If it exists, the editor uses the values defined in
1899 \fBEXINIT\fR; otherwise the values set in \fB$HOME/.exrc\fR are used. If
1900 \fB$HOME/.exrc\fR does not exist, the default values are used.
1901 .sp
|
95 \fB/usr/xpg6/bin/vi\fR [\fB-|\fR \fB-s\fR] [\fB-l\fR] [\fB-L\fR] [\fB-R\fR] [\fB-r\fR [\fIfilename\fR]]
96 [\fB-S\fR] [\fB-t\fR \fItag\fR] [\fB-v\fR] [\fB-V\fR] [\fB-x\fR] [\fB-w\fR\fIn\fR] [\fB-C\fR]
97 [\fB+\fR\fIcommand\fR | \fB-c\fR \fIcommand\fR] \fIfilename\fR...
98 .fi
99
100 .LP
101 .nf
102 \fB/usr/xpg6/bin/view\fR [\fB-|\fR \fB-s\fR] [\fB-l\fR] [\fB-L\fR] [\fB-R\fR] [\fB-r\fR [\fIfilename\fR]]
103 [\fB-S\fR] [\fB-t\fR \fItag\fR] [\fB-v\fR] [\fB-V\fR] [\fB-x\fR] [\fB-w\fR\fIn\fR] [\fB-C\fR]
104 [\fB+\fR\fIcommand\fR | \fB-c\fR \fIcommand\fR] \fIfilename\fR...
105 .fi
106
107 .LP
108 .nf
109 \fB/usr/xpg6/bin/vedit\fR [\fB-|\fR \fB-s\fR] [\fB-l\fR] [\fB-L\fR] [\fB-R\fR] [\fB-r\fR [\fIfilename\fR]]
110 [\fB-S\fR] [\fB-t\fR \fItag\fR] [\fB-v\fR] [\fB-V\fR] [\fB-x\fR] [\fB-w\fR\fIn\fR] [\fB-C\fR]
111 [\fB+\fR\fIcommand\fR | \fB-c\fR \fIcommand\fR] \fIfilename\fR...
112 .fi
113
114 .SH DESCRIPTION
115 .LP
116 The \fBvi\fR (visual) utility is a display-oriented text editor based on an
117 underlying line editor \fBex\fR. It is possible to use the command mode of
118 \fBex\fR from within \fBvi\fR and to use the command mode of \fBvi\fR from
119 within \fBex\fR. The visual commands are described on this manual page; how to
120 set options (like automatically numbering lines and automatically starting a
121 new output line when you type carriage return) and all \fBex\fR line editor
122 commands are described on the \fBex\fR(1) manual page.
123 .sp
124 .LP
125 When using \fBvi\fR, changes you make to the file are reflected in what you see
126 on your terminal screen. The position of the cursor on the screen indicates the
127 position within the file.
128 .sp
129 .LP
130 The \fBview\fR invocation is the same as \fBvi\fR except that the
131 \fBreadonly\fR flag is set.
132 .sp
133 .LP
134 The \fBvedit\fR invocation is intended for beginners. It is the same as
135 \fBvi\fR except that the \fBreport\fR flag is set to \fB1\fR, the
136 \fBshowmode\fR and \fBnovice\fR flags are set, and \fBmagic\fR is turned off.
137 These defaults make it easier to learn how to use \fBvi\fR.
138 .SH OPTIONS
139 .LP
140 The following options are supported:
141 .SS "Invocation Options"
142 .LP
143 The following invocation options are interpreted by \fBvi\fR (previously
144 documented options are discussed under NOTES):
145 .sp
146 .ne 2
147 .na
148 \fB\fB\(mi\fR | \fB-s\fR\fR
149 .ad
150 .RS 25n
151 Suppresses all interactive user feedback. This is useful when processing editor
152 scripts.
153 .RE
154
155 .sp
156 .ne 2
157 .na
158 \fB\fB-C\fR\fR
159 .ad
160 .RS 25n
161 Encryption option. Same as the \fB-x\fR option, except that \fBvi\fR simulates
269 decrypt text using the algorithm of the \fBcrypt\fR command. The \fBX\fR
270 command makes an educated guess to determine whether text read in is encrypted
271 or not. The temporary buffer file is encrypted also, using a transformed
272 version of the key typed in for the \fB-x\fR option. If an empty encryption
273 key is entered (that is, if the return key is pressed right after the prompt),
274 the file is not encrypted. This is a good way to decrypt a file erroneously
275 encrypted with a mistyped encryption key, such as a backspace or undo key.
276 .RE
277
278 .sp
279 .ne 2
280 .na
281 \fB\fB-\fR\fIcommand\fR | \fB-c\fR \fIcommand\fR\fR
282 .ad
283 .RS 25n
284 Begins editing by executing the specified editor \fIcommand\fR (usually a
285 search or positioning command).
286 .RE
287
288 .SS "/usr/xpg4/bin/vi and /usr/xpg6/bin/vi"
289 .LP
290 If both the \fB-t\fR \fItag\fR and the \fB-c\fR \fIcommand\fR options are
291 given, the \fB-t\fR \fItag\fR option is processed first. That is, the file
292 containing \fItag\fR is selected by \fB-t\fR and then the command is executed.
293 .SH OPERANDS
294 .LP
295 The following operands are supported:
296 .sp
297 .ne 2
298 .na
299 \fB\fIfilename\fR\fR
300 .ad
301 .RS 12n
302 A file to be edited.
303 .RE
304
305 .SH COMMAND SUMMARY
306 .LP
307 The \fBvi\fR command modes are summarized in this section.
308 .SS "vi Modes"
309 .ne 2
310 .na
311 \fBCommand\fR
312 .ad
313 .RS 13n
314 Normal and initial mode. Other modes return to command mode upon completion.
315 \fIESC\fR (escape) is used to cancel a partial command.
316 .RE
317
318 .sp
319 .ne 2
320 .na
321 \fBInput\fR
322 .ad
323 .RS 13n
324 Entered by setting any of the following options:
325 .sp
326 .in +2
327 .nf
328 a A i I o O c C s S R
329 .fi
330 .in -2
331 .sp
332
333 Arbitrary text can then be entered. Input mode is normally terminated with the
334 \fIESC\fR character, or, abnormally, with an interrupt.
335 .RE
336
337 .sp
338 .ne 2
339 .na
340 \fBLast line\fR
341 .ad
342 .RS 13n
343 Reading input for \fB: / ?\fR or \fB!\fR. Terminate by typing a carriage
344 return. An interrupt cancels termination.
345 .RE
346
347 .SS "Sample Commands"
348 .LP
349 In the descriptions, \fICR\fR stands for carriage return and \fIESC\fR stands
350 for the escape key.
351 .sp
352 .ne 2
353 .na
354 \fB\(<-, \(->\fR
355 .ad
356 .br
357 .na
358 \fBdown-arrow\fR
359 .ad
360 .br
361 .na
362 \fBup-arrow\fR
363 .ad
364 .RS 14n
365 arrow keys move the cursor
366 .RE
367
475
476 .sp
477 .ne 2
478 .na
479 \fB^U ^D\fR
480 .ad
481 .RS 14n
482 scroll up or down
483 .RE
484
485 .sp
486 .ne 2
487 .na
488 \fB:\fIcmd\fR\fICR\fR\fR
489 .ad
490 .RS 14n
491 any \fBex\fR or \fBed\fR command
492 .RE
493
494 .SS "Counts Before vi Commands"
495 .LP
496 Numbers can be typed as a prefix to some commands. They are interpreted in one
497 of these ways:
498 .sp
499 .ne 2
500 .na
501 \fBline/column number\fR
502 .ad
503 .RS 22n
504 z G |
505 .RE
506
507 .sp
508 .ne 2
509 .na
510 \fBscroll amount\fR
511 .ad
512 .RS 22n
513 ^D ^U
514 .RE
515
516 .sp
517 .ne 2
518 .na
519 \fBrepeat effect\fR
520 .ad
521 .RS 22n
522 most of the rest
523 .RE
524
525 .SS "Interrupting, Canceling"
526 .ne 2
527 .na
528 \fB\fIESC\fR\fR
529 .ad
530 .RS 7n
531 end insert or incomplete command
532 .RE
533
534 .sp
535 .ne 2
536 .na
537 \fB\fIDEL\fR\fR
538 .ad
539 .RS 7n
540 (delete or rubout) interrupts
541 .RE
542
543 .SS "File Manipulation"
544 .ne 2
545 .na
546 \fBZZ\fR
547 .ad
548 .RS 15n
549 if file modified, write and exit; otherwise, exit
550 .RE
551
552 .sp
553 .ne 2
554 .na
555 \fB:w\fICR\fR\fR
556 .ad
557 .RS 15n
558 write back changes
559 .RE
560
561 .sp
562 .ne 2
563 .na
700 .ad
701 .RS 15n
702 show current file and line
703 .RE
704
705 .sp
706 .ne 2
707 .na
708 \fB:ta \fItag\fR\fICR\fR\fR
709 .ad
710 .RS 15n
711 position cursor to \fItag\fR
712 .RE
713
714 .sp
715 .LP
716 In general, any \fBex\fR or \fBed\fR command (such as \fIsubstitute\fR or
717 \fIglobal\fR) can be typed, preceded by a colon and followed by a carriage
718 return.
719 .SS "Positioning Within a File"
720 .ne 2
721 .na
722 \fBF\fR
723 .ad
724 .RS 14n
725 forward screen
726 .RE
727
728 .sp
729 .ne 2
730 .na
731 \fB^B\fR
732 .ad
733 .RS 14n
734 backward screen
735 .RE
736
737 .sp
738 .ne 2
739 .na
863
864 .sp
865 .ne 2
866 .na
867 \fB}\fR
868 .ad
869 .RS 14n
870 end of paragraph
871 .RE
872
873 .sp
874 .ne 2
875 .na
876 \fB%\fR
877 .ad
878 .RS 14n
879 find matching \fB( )\fR or \fB{ }\fR
880 .RE
881
882 .SS "Adjusting the Screen"
883 .ne 2
884 .na
885 \fB^L\fR
886 .ad
887 .RS 16n
888 clear and redraw window
889 .RE
890
891 .sp
892 .ne 2
893 .na
894 \fB^R\fR
895 .ad
896 .RS 16n
897 clear and redraw window if \fB^L\fR is \(-> key
898 .RE
899
900 .sp
901 .ne 2
902 .na
944
945 .sp
946 .ne 2
947 .na
948 \fB^E\fR
949 .ad
950 .RS 16n
951 scroll window down one line
952 .RE
953
954 .sp
955 .ne 2
956 .na
957 \fB^Y\fR
958 .ad
959 .RS 16n
960 scroll window up one line
961 .RE
962
963 .SS "Marking and Returning"
964 .ne 2
965 .na
966 \fB\(ga\(ga\fR
967 .ad
968 .RS 12n
969 move cursor to previous context
970 .RE
971
972 .sp
973 .ne 2
974 .na
975 \fBa\'a\'\fR
976 .ad
977 .RS 12n
978 move cursor to first non-white space in line
979 .RE
980
981 .sp
982 .ne 2
983 .na
989
990 .sp
991 .ne 2
992 .na
993 \fB\(ga\fIx\fR\fR
994 .ad
995 .RS 12n
996 move cursor to mark \fIx\fR
997 .RE
998
999 .sp
1000 .ne 2
1001 .na
1002 \fBa\'\fIx\fR\fR
1003 .ad
1004 .RS 12n
1005 move cursor to first non-white space in line marked by \fIx\fR
1006 .RE
1007
1008 .SS "Line Positioning"
1009 .ne 2
1010 .na
1011 \fBH\fR
1012 .ad
1013 .RS 14n
1014 top line on screen
1015 .RE
1016
1017 .sp
1018 .ne 2
1019 .na
1020 \fBL\fR
1021 .ad
1022 .RS 14n
1023 last line on screen
1024 .RE
1025
1026 .sp
1027 .ne 2
1028 .na
1069 \fBor \fBj\fR\fR
1070 .ad
1071 .RS 14n
1072 next line, same column
1073 .RE
1074
1075 .sp
1076 .ne 2
1077 .na
1078 \fB\fBup-arrow\fR\fR
1079 .ad
1080 .br
1081 .na
1082 \fBor \fBk\fR\fR
1083 .ad
1084 .RS 14n
1085 previous line, same column
1086 .RE
1087
1088 .SS "Character Positioning"
1089 .ne 2
1090 .na
1091 \fB^\fR
1092 .ad
1093 .RS 13n
1094 first non-white space character
1095 .RE
1096
1097 .sp
1098 .ne 2
1099 .na
1100 \fB0\fR
1101 .ad
1102 .RS 13n
1103 beginning of line
1104 .RE
1105
1106 .sp
1107 .ne 2
1108 .na
1204
1205 .sp
1206 .ne 2
1207 .na
1208 \fB\fIn\fR|\fR
1209 .ad
1210 .RS 13n
1211 move to column \fIn\fR
1212 .RE
1213
1214 .sp
1215 .ne 2
1216 .na
1217 \fB%\fR
1218 .ad
1219 .RS 13n
1220 find matching \fB( )\fR or \fB{ }\fR
1221 .RE
1222
1223 .SS "Words, Sentences, Paragraphs"
1224 .ne 2
1225 .na
1226 \fBw\fR
1227 .ad
1228 .RS 5n
1229 forward a word
1230 .RE
1231
1232 .sp
1233 .ne 2
1234 .na
1235 \fBb\fR
1236 .ad
1237 .RS 5n
1238 back a word
1239 .RE
1240
1241 .sp
1242 .ne 2
1243 .na
1294
1295 .sp
1296 .ne 2
1297 .na
1298 \fBB\fR
1299 .ad
1300 .RS 5n
1301 back a blank-delimited word
1302 .RE
1303
1304 .sp
1305 .ne 2
1306 .na
1307 \fBE\fR
1308 .ad
1309 .RS 5n
1310 end of a blank-delimited word
1311 .RE
1312
1313 .SS "Corrections During Insert"
1314 .ne 2
1315 .na
1316 \fB^H\fR
1317 .ad
1318 .RS 16n
1319 erase last character (backspace)
1320 .RE
1321
1322 .sp
1323 .ne 2
1324 .na
1325 \fB^W\fR
1326 .ad
1327 .RS 16n
1328 erase last word
1329 .RE
1330
1331 .sp
1332 .ne 2
1333 .na
1394
1395 .sp
1396 .ne 2
1397 .na
1398 \fB0^D\fR
1399 .ad
1400 .RS 16n
1401 backtab to beginning of line; reset left margin of \fIautoindent\fR
1402 .RE
1403
1404 .sp
1405 .ne 2
1406 .na
1407 \fB^V\fR
1408 .ad
1409 .RS 16n
1410 quote non-printable character
1411 .RE
1412
1413 .SS "Insert and Replace"
1414 .ne 2
1415 .na
1416 \fBa\fR
1417 .ad
1418 .RS 12n
1419 append after cursor
1420 .RE
1421
1422 .sp
1423 .ne 2
1424 .na
1425 \fBA\fR
1426 .ad
1427 .RS 12n
1428 append at end of line
1429 .RE
1430
1431 .sp
1432 .ne 2
1433 .na
1466
1467 .sp
1468 .ne 2
1469 .na
1470 \fBr\fIx\fR\fR
1471 .ad
1472 .RS 12n
1473 replace single character with \fIx\fR
1474 .RE
1475
1476 .sp
1477 .ne 2
1478 .na
1479 \fBR\fItext\fR\fIESC\fR\fR
1480 .ad
1481 .RS 12n
1482 replace characters
1483 .RE
1484
1485 .SS "Operators"
1486 .LP
1487 Operators are followed by a cursor motion and affect all text that would have
1488 been moved over. For example, since \fBw\fR moves over a word, \fBdw\fR deletes
1489 the word that would be moved over. Double the operator, for example \fBdd\fR,
1490 to affect whole lines.
1491 .sp
1492 .ne 2
1493 .na
1494 \fBd\fR
1495 .ad
1496 .RS 5n
1497 delete
1498 .RE
1499
1500 .sp
1501 .ne 2
1502 .na
1503 \fBc\fR
1504 .ad
1505 .RS 5n
1526
1527 .sp
1528 .ne 2
1529 .na
1530 \fB>\fR
1531 .ad
1532 .RS 5n
1533 right shift
1534 .RE
1535
1536 .sp
1537 .ne 2
1538 .na
1539 \fB!\fR
1540 .ad
1541 .RS 5n
1542 filter through command
1543 .RE
1544
1545 .SS "Miscellaneous Operations"
1546 .ne 2
1547 .na
1548 \fBC\fR
1549 .ad
1550 .RS 5n
1551 change rest of line (\fBc$\fR)
1552 .RE
1553
1554 .sp
1555 .ne 2
1556 .na
1557 \fBD\fR
1558 .ad
1559 .RS 5n
1560 delete rest of line (\fBd$\fR)
1561 .RE
1562
1563 .sp
1564 .ne 2
1565 .na
1598
1599 .sp
1600 .ne 2
1601 .na
1602 \fBX\fR
1603 .ad
1604 .RS 5n
1605 delete characters before cursor \fBdh\fR)
1606 .RE
1607
1608 .sp
1609 .ne 2
1610 .na
1611 \fBY\fR
1612 .ad
1613 .RS 5n
1614 yank lines (\fByy\fR)
1615 .RE
1616
1617 .SS "Yank and Put"
1618 .LP
1619 Put inserts the text most recently deleted or yanked; however, if a buffer is
1620 named (using the \fBASCII\fR lower-case letters \fBa\fR - \fBz\fR), the text in
1621 that buffer is put instead.
1622 .sp
1623 .ne 2
1624 .na
1625 \fB3yy\fR
1626 .ad
1627 .RS 7n
1628 yank 3 lines
1629 .RE
1630
1631 .sp
1632 .ne 2
1633 .na
1634 \fB3yl\fR
1635 .ad
1636 .RS 7n
1637 yank 3 characters
1666
1667 .sp
1668 .ne 2
1669 .na
1670 \fB"\fIx\fRy\fR
1671 .ad
1672 .RS 7n
1673 yank to buffer \fIx\fR
1674 .RE
1675
1676 .sp
1677 .ne 2
1678 .na
1679 \fB"\fIx\fRd\fR
1680 .ad
1681 .RS 7n
1682 delete into buffer \fIx\fR
1683 .RE
1684
1685 .SS "Undo, Redo, Retrieve"
1686 .ne 2
1687 .na
1688 \fBu\fR
1689 .ad
1690 .RS 7n
1691 undo last change
1692 .RE
1693
1694 .sp
1695 .ne 2
1696 .na
1697 \fBU\fR
1698 .ad
1699 .RS 7n
1700 restore current line
1701 .RE
1702
1703 .sp
1704 .ne 2
1705 .na
1706 \fB\&.\fR
1707 .ad
1708 .RS 7n
1709 repeat last change
1710 .RE
1711
1712 .sp
1713 .ne 2
1714 .na
1715 \fB"\fId\fRp\fR
1716 .ad
1717 .RS 7n
1718 retrieve \fId\fR'th last delete
1719 .RE
1720
1721 .SH USAGE
1722 .LP
1723 See \fBlargefile\fR(5) for the description of the behavior of \fBvi\fR and
1724 \fBview\fR when encountering files greater than or equal to 2 Gbyte ( 2^31
1725 bytes).
1726 .SH ENVIRONMENT VARIABLES
1727 .LP
1728 See \fBenviron\fR(5) for descriptions of the following environment variables
1729 that affect the execution of \fBvi\fR: \fBLANG\fR, \fBLC_ALL\fR,
1730 \fBLC_COLLATE\fR, \fBLC_CTYPE\fR, \fBLC_TIME\fR, \fBLC_MESSAGES\fR,
1731 \fBNLSPATH\fR, \fBPATH\fR, \fBSHELL\fR, and \fBTERM\fR.
1732 .sp
1733 .ne 2
1734 .na
1735 \fB\fBCOLUMNS\fR\fR
1736 .ad
1737 .RS 11n
1738 Override the system-selected horizontal screen size.
1739 .RE
1740
1741 .sp
1742 .ne 2
1743 .na
1744 \fB\fBEXINIT\fR\fR
1745 .ad
1746 .RS 11n
1747 Determine a list of \fBex\fR commands that are executed on editor start-up,
1748 before reading the first file. The list can contain multiple commands by
1749 separating them using a vertical-line (\fB|\fR) character.
1750 .RE
1751
1752 .sp
1753 .ne 2
1754 .na
1755 \fB\fBLINES\fR\fR
1756 .ad
1757 .RS 11n
1758 Override the system-selected vertical screen size, used as the number of lines
1759 in a screenful and the vertical screen size in visual mode.
1760 .RE
1761
1762 .SH FILES
1763 .ne 2
1764 .na
1765 \fB\fB/var/tmp\fR\fR
1766 .ad
1767 .sp .6
1768 .RS 4n
1769 default directory where temporary work files are placed; it can be changed
1770 using the \fBdirectory\fR option (see the \fBex\fR(1) command)
1771 .RE
1772
1773 .sp
1774 .ne 2
1775 .na
1776 \fB\fB/usr/share/lib/terminfo/?/*\fR\fR
1777 .ad
1778 .sp .6
1779 .RS 4n
1780 compiled terminal description database
1781 .RE
1782
1783 .sp
1784 .ne 2
1785 .na
1786 \fB\fB/usr/lib/.COREterm/?/*\fR\fR
1787 .ad
1788 .sp .6
1789 .RS 4n
1790 subset of compiled terminal description database
1791 .RE
1792
1793 .SH ATTRIBUTES
1794 .LP
1795 See \fBattributes\fR(5) for descriptions of the following attributes:
1796 .SS "/usr/bin/vi, /usr/bin/view, /usr/bin/vedit"
1797 .TS
1798 box;
1799 c | c
1800 l | l .
1801 ATTRIBUTE TYPE ATTRIBUTE VALUE
1802 _
1803 CSI Not enabled
1804 .TE
1805
1806 .SS "/usr/xpg4/bin/vi, /usr/xpg4/bin/view, /usr/xpg4/bin/vedit"
1807 .TS
1808 box;
1809 c | c
1810 l | l .
1811 ATTRIBUTE TYPE ATTRIBUTE VALUE
1812 _
1813 CSI Enabled
1814 _
1815 Interface Stability Standard
1816 .TE
1817
1818 .SS "/usr/xpg6/bin/vi, /usr/xpg6/bin/view, /usr/xpg6/bin/vedit"
1819 .TS
1820 box;
1821 c | c
1822 l | l .
1823 ATTRIBUTE TYPE ATTRIBUTE VALUE
1824 _
1825 CSI Enabled
1826 _
1827 Interface Stability Standard
1828 .TE
1829
1830 .SH SEE ALSO
1831 .LP
1832 \fBIntro\fR(1), \fBctags\fR(1), \fBed\fR(1), \fBedit\fR(1), \fBex\fR(1),
1833 \fBattributes\fR(5), \fBenviron\fR(5), \fBlargefile\fR(5), \fBstandards\fR(5)
1834 .sp
1835 .LP
1836 \fISolaris Advanced User\&'s Guide\fR
1837 .SH AUTHOR
1838 .LP
1839 \fBvi\fR and \fBex\fR were developed by The University of California, Berkeley
1840 California, Computer Science Division, Department of Electrical Engineering and
1841 Computer Science.
1842 .SH NOTES
1843 .LP
1844 Two options, although they continue to be supported, have been replaced in the
1845 documentation by options that follow the Command Syntax Standard (see
1846 \fBIntro\fR(1)). An \fB-r\fR option that is not followed with an
1847 option-argument has been replaced by \fB-L\fR and \fB+\fR\fBcommand\fR has been
1848 replaced by \fB-c\fR \fBcommand\fR.
1849 .sp
1850 .LP
1851 The message \fBfile too large to recover with\fR \fB-r\fR \fBoption\fR, which
1852 is seen when a file is loaded, indicates that the file can be edited and saved
1853 successfully, but if the editing session is lost, recovery of the file with the
1854 \fB-r\fR option is not possible.
1855 .sp
1856 .LP
1857 The editing environment defaults to certain configuration options. When an
1858 editing session is initiated, \fBvi\fR attempts to read the \fBEXINIT\fR
1859 environment variable. If it exists, the editor uses the values defined in
1860 \fBEXINIT\fR; otherwise the values set in \fB$HOME/.exrc\fR are used. If
1861 \fB$HOME/.exrc\fR does not exist, the default values are used.
1862 .sp
|