9103 opengroup acknowledgement should be properly formatted in man pages
[unleashed.git] / usr / src / man / man1has / vi.1has
blobcf65719682aedb6ceb4bedfd25fc2722048b6a27
1 .\"
2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group.  In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document.  The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
24 .\"
25 .\" This notice shall appear on any product containing this material.
26 .\"
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
30 .\"
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
35 .\"
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 .\"
42 .\"
43 .\" Copyright 1989 AT&T
44 .\" Portions Copyright (c) 1992, X/Open Company Limited  All Rights Reserved
45 .\" Copyright (c) 2007, Sun Microsystems, Inc.  All Rights Reserved.
46 .\"
47 .TH VI 1HAS "May 16, 2007"
48 .SH NAME
49 vi, view, vedit \- screen-oriented (visual) display editor based on ex
50 .SH SYNOPSIS
51 .LP
52 .nf
53 \fB/usr/bin/vi\fR [\fB-|\fR \fB-s\fR] [\fB-l\fR] [\fB-L\fR] [\fB-R\fR] [\fB-r\fR [\fIfilename\fR]] [\fB-S\fR]
54      [\fB-t\fR \fItag\fR] [\fB-v\fR] [\fB-V\fR] [\fB-x\fR] [\fB-w\fR\fIn\fR] [\fB-C\fR]
55      [\fB+\fR\fIcommand\fR | \fB-c\fR \fIcommand\fR] \fIfilename\fR...
56 .fi
58 .LP
59 .nf
60 \fB/usr/bin/view\fR [\fB-|\fR \fB-s\fR] [\fB-l\fR] [\fB-L\fR] [\fB-R\fR] [\fB-r\fR [\fIfilename\fR]] [\fB-S\fR]
61      [\fB-t\fR \fItag\fR] [\fB-v\fR] [\fB-V\fR] [\fB-x\fR] [\fB-w\fR\fIn\fR] [\fB-C\fR]
62      [\fB+\fR\fIcommand\fR | \fB-c\fR \fIcommand\fR] \fIfilename\fR...
63 .fi
65 .LP
66 .nf
67 \fB/usr/bin/vedit\fR [\fB-|\fR \fB-s\fR] [\fB-l\fR] [\fB-L\fR] [\fB-R\fR] [\fB-r\fR [\fIfilename\fR]] [\fB-S\fR]
68      [\fB-t\fR \fItag\fR] [\fB-v\fR] [\fB-V\fR] [\fB-x\fR] [\fB-w\fR\fIn\fR] [\fB-C\fR]
69      [\fB+\fR\fIcommand\fR | \fB-c\fR \fIcommand\fR] \fIfilename\fR...
70 .fi
72 .LP
73 .nf
74 \fB/usr/xpg4/bin/vi\fR [\fB-|\fR \fB-s\fR] [\fB-l\fR] [\fB-L\fR] [\fB-R\fR] [\fB-r\fR [\fIfilename\fR]]
75      [\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]
76      [\fB+\fR\fIcommand\fR | \fB-c\fR \fIcommand\fR] \fIfilename\fR...
77 .fi
79 .LP
80 .nf
81 \fB/usr/xpg4/bin/view\fR [\fB-|\fR \fB-s\fR] [\fB-l\fR] [\fB-L\fR] [\fB-R\fR] [\fB-r\fR [\fIfilename\fR]]
82      [\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]
83      [\fB+\fR\fIcommand\fR | \fB-c\fR \fIcommand\fR] \fIfilename\fR...
84 .fi
86 .LP
87 .nf
88 \fB/usr/xpg4/bin/vedit\fR [\fB-|\fR \fB-s\fR] [\fB-l\fR] [\fB-L\fR] [\fB-R\fR] [\fB-r\fR [\fIfilename\fR]]
89      [\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]
90      [\fB+\fR\fIcommand\fR | \fB-c\fR \fIcommand\fR] \fIfilename\fR...
91 .fi
93 .LP
94 .nf
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
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...
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...
114 .SH DESCRIPTION
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.
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.
131 The \fBview\fR invocation is the same as \fBvi\fR except that the
132 \fBreadonly\fR flag is set.
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
142 The following options are supporrted:
143 .SS "Invocation Options"
146 The following invocation options are interpreted by \fBvi\fR (previously
147 documented options are discussed under NOTES):
149 .ne 2
151 \fB\fB\(mi\fR | \fB-s\fR\fR
153 .RS 25n
154 Suppresses all interactive user feedback. This is useful when processing editor
155 scripts.
159 .ne 2
161 \fB\fB-C\fR\fR
163 .RS 25n
164 Encryption option. Same as the \fB-x\fR option, except that \fBvi\fR simulates
165 the \fBC\fR command of \fBex\fR. The \fBC\fR command is like the \fBX\fR
166 command of \fBex\fR, except that all text read in is assumed to have been
167 encrypted.
171 .ne 2
173 \fB\fB-l\fR\fR
175 .RS 25n
176 Sets up for editing \fBLISP\fR programs.
180 .ne 2
182 \fB\fB-L\fR\fR
184 .RS 25n
185 Lists the name of all files saved as the result of an editor or system crash.
189 .ne 2
191 \fB\fB-r\fR \fIfilename\fR\fR
193 .RS 25n
194 Edits \fIfilename\fR after an editor or system crash. (Recovers the version of
195 \fIfilename\fR that was in the buffer when the crash occurred.)
199 .ne 2
201 \fB\fB-R\fR\fR
203 .RS 25n
204 \fBReadonly\fR mode. The \fBreadonly\fR flag is set, preventing accidental
205 overwriting of the file.
209 .ne 2
211 \fB\fB-S\fR\fR
213 .RS 25n
214 This option is used in conjunction with the \fB-t\fR \fItag\fR option to tell
215 \fBvi\fR that the tags file can not be sorted and that, if the binary search
216 (which relies on a sorted tags file) for \fItag\fR fails to find it, the much
217 slower linear search should also be done. Since the linear search is slow,
218 users of large tags files should ensure that the tags files are sorted rather
219 than use this flag. Creation of tags files normally produces sorted tags files.
220 See \fBctags\fR(1) for more information on tags files.
224 .ne 2
226 \fB\fB-t\fR \fItag\fR\fR
228 .RS 25n
229 Edits the file containing \fItag\fR and position the editor at its definition.
230 It is an error to specify more than one \fB-t\fR option.
234 .ne 2
236 \fB\fB-v\fR\fR
238 .RS 25n
239 Starts up in display editing state, using \fBvi\fR. You can achieve the same
240 effect by typing the \fBvi\fR command itself.
244 .ne 2
246 \fB\fB-V\fR\fR
248 .RS 25n
249 Verbose. When \fBex\fR commands are read by means of standard input, the input
250 is echoed to standard error. This can be useful when processing \fBex\fR
251 commands within shell scripts.
255 .ne 2
257 \fB\fB-w\fR\fIn\fR\fR
259 .RS 25n
260 Sets the default window size to \fIn\fR. This is useful when using the editor
261 over a slow speed line.
265 .ne 2
267 \fB\fB-x\fR\fR
269 .RS 25n
270 Encryption option. When used, \fBvi\fR simulates the \fBX\fR command of
271 \fBex\fR and prompts the user for a key. This key is used to encrypt and
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.
282 .ne 2
284 \fB\fB-\fR\fIcommand\fR | \fB-c\fR \fIcommand\fR\fR
286 .RS 25n
287 Begins editing by executing the specified editor \fIcommand\fR (usually a
288 search or positioning command).
291 .SS "/usr/xpg4/bin/vi and /usr/xpg6/bin/vi"
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
300 The following operands are supported:
302 .ne 2
304 \fB\fIfilename\fR\fR
306 .RS 12n
307 A file to be edited.
310 .SH COMMAND SUMMARY
313 The \fBvi\fR command modes are summarized in this section.
314 .SS "vi Modes"
316 .ne 2
318 \fBCommand\fR
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.
326 .ne 2
328 \fBInput\fR
330 .RS 13n
331 Entered by setting any of the following options:
333 .in +2
335 a A i I o O c C s S R
337 .in -2
340 Arbitrary text can then be entered. Input mode is normally terminated with the
341 \fIESC\fR character, or, abnormally, with an interrupt.
345 .ne 2
347 \fBLast line\fR
349 .RS 13n
350 Reading input for \fB: / ?\fR or \fB!\fR. Terminate by typing a carriage
351 return. An interrupt cancels termination.
354 .SS "Sample Commands"
357 In the descriptions, \fICR\fR stands for carriage return and \fIESC\fR stands
358 for the escape key.
360 .ne 2
362 \fB\(<-, \(->\fR
366 \fBdown-arrow\fR
370 \fBup-arrow\fR
372 .RS 14n
373 arrow keys move the cursor
377 .ne 2
379 \fBh j k l\fR
381 .RS 14n
382 same as arrow keys
386 .ne 2
388 \fBi\fItext\fR\fIESC\fR\fR
390 .RS 14n
391 insert \fItext\fR
395 .ne 2
397 \fBcw\fInew\fR\fIESC\fR\fR
399 .RS 14n
400 change word to \fInew\fR
404 .ne 2
406 \fBea\fIs\fR\fIESC\fR\fR
408 .RS 14n
409 pluralize word (end of word; append \fBs\fR; escape from input state)
413 .ne 2
415 \fBx\fR
417 .RS 14n
418 delete a character
422 .ne 2
424 \fBdw\fR
426 .RS 14n
427 delete a word
431 .ne 2
433 \fBdd\fR
435 .RS 14n
436 delete a line
440 .ne 2
442 \fB3dd\fR
444 .RS 14n
445 delete 3 lines
449 .ne 2
451 \fBu\fR
453 .RS 14n
454 undo previous change
458 .ne 2
460 \fBZZ\fR
462 .RS 14n
463 exit \fBvi\fR, saving changes
467 .ne 2
469 \fB:q!\fICR\fR\fR
471 .RS 14n
472 quit, discarding changes
476 .ne 2
478 \fB/\fItext\fR\fICR\fR\fR
480 .RS 14n
481 search for \fItext\fR
485 .ne 2
487 \fB^U ^D\fR
489 .RS 14n
490 scroll up or down
494 .ne 2
496 \fB:\fIcmd\fR\fICR\fR\fR
498 .RS 14n
499 any \fBex\fR or \fBed\fR command
502 .SS "Counts Before vi Commands"
505 Numbers can be typed as a prefix to some commands. They are interpreted in one
506 of these ways:
508 .ne 2
510 \fBline/column number\fR
512 .RS 22n
513 z  G  |
517 .ne 2
519 \fBscroll amount\fR
521 .RS 22n
522 ^D  ^U
526 .ne 2
528 \fBrepeat effect\fR
530 .RS 22n
531 most of the rest
534 .SS "Interrupting, Canceling"
536 .ne 2
538 \fB\fIESC\fR\fR
540 .RS 7n
541 end insert or incomplete command
545 .ne 2
547 \fB\fIDEL\fR\fR
549 .RS 7n
550 (delete or rubout) interrupts
553 .SS "File Manipulation"
555 .ne 2
557 \fBZZ\fR
559 .RS 15n
560 if file modified, write and exit; otherwise, exit
564 .ne 2
566 \fB:w\fICR\fR\fR
568 .RS 15n
569 write back changes
573 .ne 2
575 \fB:w!\fICR\fR\fR
577 .RS 15n
578 forced write, if permission originally not valid
582 .ne 2
584 \fB:q\fICR\fR\fR
586 .RS 15n
587 quit
591 .ne 2
593 \fB:q!\fICR\fR\fR
595 .RS 15n
596 quit, discard changes
600 .ne 2
602 \fB:e \fIname\fR\fICR\fR\fR
604 .RS 15n
605 edit file \fIname\fR
609 .ne 2
611 \fB:e!\fICR\fR\fR
613 .RS 15n
614 reedit, discard changes
618 .ne 2
620 \fB:e + \fIname\fR\fICR\fR\fR
622 .RS 15n
623 edit, starting at end
627 .ne 2
629 \fB:e +\fIn\fR\fICR\fR\fR
631 .RS 15n
632 edit, starting at line \fIn\fR
636 .ne 2
638 \fB:e #\fICR\fR\fR
640 .RS 15n
641 edit alternate file
645 .ne 2
647 \fB:e! #\fICR\fR\fR
649 .RS 15n
650 edit alternate file, discard changes
654 .ne 2
656 \fB:w \fIname\fR\fICR\fR\fR
658 .RS 15n
659 write file \fIname\fR
663 .ne 2
665 \fB:w! \fIname\fR\fICR\fR\fR
667 .RS 15n
668 overwrite file \fIname\fR
672 .ne 2
674 \fB:sh\fICR\fR\fR
676 .RS 15n
677 run shell, then return
681 .ne 2
683 \fB:!\fIcmd\fR\fICR\fR\fR
685 .RS 15n
686 run \fIcmd\fR, then return
690 .ne 2
692 \fB:n\fICR\fR\fR
694 .RS 15n
695 edit next file in arglist
699 .ne 2
701 \fB:n \fIargs\fR\fICR\fR\fR
703 .RS 15n
704 specify new arglist
708 .ne 2
710 \fB^G\fR
712 .RS 15n
713 show current file and line
717 .ne 2
719 \fB:ta \fItag\fR\fICR\fR\fR
721 .RS 15n
722 position cursor to \fItag\fR
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"
732 .ne 2
734 \fBF\fR
736 .RS 14n
737 forward screen
741 .ne 2
743 \fB^B\fR
745 .RS 14n
746 backward screen
750 .ne 2
752 \fB^D\fR
754 .RS 14n
755 scroll down half screen
759 .ne 2
761 \fB^U\fR
763 .RS 14n
764 scroll up half screen
768 .ne 2
770 \fB\fIn\fRG\fR
772 .RS 14n
773 go to the beginning of the specified line (end default), where \fIn\fR is a
774 line number
778 .ne 2
780 \fB/\fIpat\fR\fR
782 .RS 14n
783 next line matching \fIpat\fR
787 .ne 2
789 \fB?\fIpat\fR\fR
791 .RS 14n
792 previous line matching \fIpat\fR
796 .ne 2
798 \fBn\fR
800 .RS 14n
801 repeat last \fB/\fR or \fB?\fR command
805 .ne 2
807 \fBN\fR
809 .RS 14n
810 reverse last \fB/\fR or \fB?\fR command
814 .ne 2
816 \fB/\fIpat\fR/+\fIn\fR\fR
818 .RS 14n
819 \fIn\fRth line after \fIpat\fR
823 .ne 2
825 \fB?\fIpat\fR?\(mi\fIn\fR\fR
827 .RS 14n
828 \fIn\fRth line before \fIpat\fR
832 .ne 2
834 \fB]]\fR
836 .RS 14n
837 next section/function
841 .ne 2
843 \fB[[\fR
845 .RS 14n
846 previous section/function
850 .ne 2
852 \fB(\fR
854 .RS 14n
855 beginning of sentence
859 .ne 2
861 \fB)\fR
863 .RS 14n
864 end of sentence
868 .ne 2
870 \fB{\fR
872 .RS 14n
873 beginning of paragraph
877 .ne 2
879 \fB}\fR
881 .RS 14n
882 end of paragraph
886 .ne 2
888 \fB%\fR
890 .RS 14n
891 find matching \fB( )\fR or \fB{ }\fR
894 .SS "Adjusting the Screen"
896 .ne 2
898 \fB^L\fR
900 .RS 16n
901 clear and redraw window
905 .ne 2
907 \fB^R\fR
909 .RS 16n
910 clear and redraw window if \fB^L\fR is \(-> key
914 .ne 2
916 \fBz\fICR\fR\fR
918 .RS 16n
919 redraw screen with current line at top of window
923 .ne 2
925 \fBz\(mi\fICR\fR\fR
927 .RS 16n
928 redraw screen with current line at bottom of window
932 .ne 2
934 \fBz.\fICR\fR\fR
936 .RS 16n
937 redraw screen with current line at center of window
941 .ne 2
943 \fB/\fIpat\fR/z\(mi\fICR\fR\fR
945 .RS 16n
946 move \fIpat\fR line to bottom of window
950 .ne 2
952 \fBz\fIn\fR.\fICR\fR\fR
954 .RS 16n
955 use \fIn\fR\(miline window
959 .ne 2
961 \fB^E\fR
963 .RS 16n
964 scroll window down one line
968 .ne 2
970 \fB^Y\fR
972 .RS 16n
973 scroll window up one line
976 .SS "Marking and Returning"
978 .ne 2
980 \fB\(ga\(ga\fR
982 .RS 12n
983 move cursor to previous context
987 .ne 2
989 \fBa\'a\'\fR
991 .RS 12n
992 move cursor to first non-white space in line
996 .ne 2
998 \fBm\fIx\fR\fR
1000 .RS 12n
1001 mark current position with the \fBASCII\fR lower-case letter \fIx\fR
1005 .ne 2
1007 \fB\(ga\fIx\fR\fR
1009 .RS 12n
1010 move cursor to mark \fIx\fR
1014 .ne 2
1016 \fBa\'\fIx\fR\fR
1018 .RS 12n
1019 move cursor to first non-white space in line marked by \fIx\fR
1022 .SS "Line Positioning"
1024 .ne 2
1026 \fBH\fR
1028 .RS 14n
1029 top line on screen
1033 .ne 2
1035 \fBL\fR
1037 .RS 14n
1038 last line on screen
1042 .ne 2
1044 \fBM\fR
1046 .RS 14n
1047 middle line on screen
1051 .ne 2
1053 \fB+\fR
1055 .RS 14n
1056 next line, at first non-white space character
1060 .ne 2
1062 \fB\(mi\fR
1064 .RS 14n
1065 previous line, at first non-white space character
1069 .ne 2
1071 \fB\fICR\fR\fR
1073 .RS 14n
1074 return, same as \fB+\fR
1078 .ne 2
1080 \fB\fBdown-arrow\fR\fR
1084 \fBor \fBj\fR\fR
1086 .RS 14n
1087 next line, same column
1091 .ne 2
1093 \fB\fBup-arrow\fR\fR
1097 \fBor \fBk\fR\fR
1099 .RS 14n
1100 previous line, same column
1103 .SS "Character Positioning"
1105 .ne 2
1107 \fB^\fR
1109 .RS 13n
1110 first non-white space character
1114 .ne 2
1116 \fB0\fR
1118 .RS 13n
1119 beginning of line
1123 .ne 2
1125 \fB$\fR
1127 .RS 13n
1128 end of line
1132 .ne 2
1134 \fB\fBl\fR or \fB\(->\fR\fR
1136 .RS 13n
1137 forward
1141 .ne 2
1143 \fB\fBh\fR or \fB\(<-\fR\fR
1145 .RS 13n
1146 backward
1150 .ne 2
1152 \fB^H\fR
1154 .RS 13n
1155 same as \fB\(<-\fR (backspace)
1159 .ne 2
1161 \fBspace\fR
1163 .RS 13n
1164 same as \fB\(->\fR (space bar)
1168 .ne 2
1170 \fBf\fIx\fR\fR
1172 .RS 13n
1173 find next \fIx\fR
1177 .ne 2
1179 \fBF\fIx\fR\fR
1181 .RS 13n
1182 find previous \fIx\fR
1186 .ne 2
1188 \fBt\fIx\fR\fR
1190 .RS 13n
1191 move to character following the next \fIx\fR
1195 .ne 2
1197 \fBT\fIx\fR\fR
1199 .RS 13n
1200 move to character following the previous \fIx\fR
1204 .ne 2
1206 \fB;\fR
1208 .RS 13n
1209 repeat last \fBf\fR, \fBF\fR, \fBt\fR, or \fBT\fR
1213 .ne 2
1215 \fB,\fR
1217 .RS 13n
1218 repeat inverse of last \fBf\fR, \fBF\fR, \fBt\fR, or \fBT\fR
1222 .ne 2
1224 \fB\fIn\fR|\fR
1226 .RS 13n
1227 move to column \fIn\fR
1231 .ne 2
1233 \fB%\fR
1235 .RS 13n
1236 find matching \fB( )\fR or \fB{ }\fR
1239 .SS "Words, Sentences, Paragraphs"
1241 .ne 2
1243 \fBw\fR
1245 .RS 5n
1246 forward a word
1250 .ne 2
1252 \fBb\fR
1254 .RS 5n
1255 back a word
1259 .ne 2
1261 \fBe\fR
1263 .RS 5n
1264 end of word
1268 .ne 2
1270 \fB)\fR
1272 .RS 5n
1273 to next sentence
1277 .ne 2
1279 \fB}\fR
1281 .RS 5n
1282 to next paragraph
1286 .ne 2
1288 \fB(\fR
1290 .RS 5n
1291 back a sentence
1295 .ne 2
1297 \fB{\fR
1299 .RS 5n
1300 back a paragraph
1304 .ne 2
1306 \fBW\fR
1308 .RS 5n
1309 forward a blank-delimited word
1313 .ne 2
1315 \fBB\fR
1317 .RS 5n
1318 back a blank-delimited word
1322 .ne 2
1324 \fBE\fR
1326 .RS 5n
1327 end of a blank-delimited word
1330 .SS "Corrections During Insert"
1332 .ne 2
1334 \fB^H\fR
1336 .RS 16n
1337 erase last character (backspace)
1341 .ne 2
1343 \fB^W\fR
1345 .RS 16n
1346 erase last word
1350 .ne 2
1352 \fBerase\fR
1354 .RS 16n
1355 your erase character, same as \fB^H\fR (backspace)
1359 .ne 2
1361 \fBkill\fR
1363 .RS 16n
1364 your kill character, erase this line of input
1368 .ne 2
1370 \fB\e\fR
1372 .RS 16n
1373 quotes your erase and kill characters
1377 .ne 2
1379 \fB\fIESC\fR\fR
1381 .RS 16n
1382 ends insertion, back to command mode
1386 .ne 2
1388 \fBControl\(miC\fR
1390 .RS 16n
1391 interrupt, suspends insert mode
1395 .ne 2
1397 \fB^D\fR
1399 .RS 16n
1400 backtab one character; reset left margin of \fIautoindent\fR
1404 .ne 2
1406 \fB^^D\fR
1408 .RS 16n
1409 caret (\fB^\fR) followed by control-d (\fB^D\fR); backtab to beginning of line;
1410 do not reset left margin of \fIautoindent\fR
1414 .ne 2
1416 \fB0^D\fR
1418 .RS 16n
1419 backtab to beginning of line; reset left margin of \fIautoindent\fR
1423 .ne 2
1425 \fB^V\fR
1427 .RS 16n
1428 quote non-printable character
1431 .SS "Insert and Replace"
1433 .ne 2
1435 \fBa\fR
1437 .RS 12n
1438 append after cursor
1442 .ne 2
1444 \fBA\fR
1446 .RS 12n
1447 append at end of line
1451 .ne 2
1453 \fBi\fR
1455 .RS 12n
1456 insert before cursor
1460 .ne 2
1462 \fBI\fR
1464 .RS 12n
1465 insert before first non-blank
1469 .ne 2
1471 \fBo\fR
1473 .RS 12n
1474 open line below
1478 .ne 2
1480 \fBO\fR
1482 .RS 12n
1483 open line above
1487 .ne 2
1489 \fBr\fIx\fR\fR
1491 .RS 12n
1492 replace single character with \fIx\fR
1496 .ne 2
1498 \fBR\fItext\fR\fIESC\fR\fR
1500 .RS 12n
1501 replace characters
1504 .SS "Operators"
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.
1512 .ne 2
1514 \fBd\fR
1516 .RS 5n
1517 delete
1521 .ne 2
1523 \fBc\fR
1525 .RS 5n
1526 change
1530 .ne 2
1532 \fBy\fR
1534 .RS 5n
1535 yank lines to buffer
1539 .ne 2
1541 \fB<\fR
1543 .RS 5n
1544 left shift
1548 .ne 2
1550 \fB>\fR
1552 .RS 5n
1553 right shift
1557 .ne 2
1559 \fB!\fR
1561 .RS 5n
1562 filter through command
1565 .SS "Miscellaneous Operations"
1567 .ne 2
1569 \fBC\fR
1571 .RS 5n
1572 change rest of line (\fBc$\fR)
1576 .ne 2
1578 \fBD\fR
1580 .RS 5n
1581 delete rest of line (\fBd$\fR)
1585 .ne 2
1587 \fBs\fR
1589 .RS 5n
1590 substitute characters (\fBcl\fR)
1594 .ne 2
1596 \fBS\fR
1598 .RS 5n
1599 substitute lines (\fBcc\fR)
1603 .ne 2
1605 \fBJ\fR
1607 .RS 5n
1608 join lines
1612 .ne 2
1614 \fBx\fR
1616 .RS 5n
1617 delete characters (\fBdl\fR)
1621 .ne 2
1623 \fBX\fR
1625 .RS 5n
1626 delete characters before cursor \fBdh\fR)
1630 .ne 2
1632 \fBY\fR
1634 .RS 5n
1635 yank lines (\fByy\fR)
1638 .SS "Yank and Put"
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.
1645 .ne 2
1647 \fB3yy\fR
1649 .RS 7n
1650 yank 3 lines
1654 .ne 2
1656 \fB3yl\fR
1658 .RS 7n
1659 yank 3 characters
1663 .ne 2
1665 \fBp\fR
1667 .RS 7n
1668 put back text after cursor
1672 .ne 2
1674 \fBP\fR
1676 .RS 7n
1677 put back text before cursor
1681 .ne 2
1683 \fB\fI"x\fRp\fR
1685 .RS 7n
1686 put from buffer \fIx\fR
1690 .ne 2
1692 \fB"\fIx\fRy\fR
1694 .RS 7n
1695 yank to buffer \fIx\fR
1699 .ne 2
1701 \fB"\fIx\fRd\fR
1703 .RS 7n
1704 delete into buffer \fIx\fR
1707 .SS "Undo, Redo, Retrieve"
1709 .ne 2
1711 \fBu\fR
1713 .RS 7n
1714 undo last change
1718 .ne 2
1720 \fBU\fR
1722 .RS 7n
1723 restore current line
1727 .ne 2
1729 \fB\&.\fR
1731 .RS 7n
1732 repeat last change
1736 .ne 2
1738 \fB"\fId\fRp\fR
1740 .RS 7n
1741 retrieve \fId\fR'th last delete
1744 .SH USAGE
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
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.
1758 .ne 2
1760 \fB\fBCOLUMNS\fR\fR
1762 .RS 11n
1763 Override the system-selected horizontal screen size.
1767 .ne 2
1769 \fB\fBEXINIT\fR\fR
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.
1778 .ne 2
1780 \fB\fBLINES\fR\fR
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.
1787 .SH FILES
1789 .ne 2
1791 \fB\fB/var/tmp\fR\fR
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)
1800 .ne 2
1802 \fB\fB/usr/share/lib/terminfo/?/*\fR\fR
1804 .sp .6
1805 .RS 4n
1806 compiled terminal description database
1810 .ne 2
1812 \fB\fB/usr/lib/.COREterm/?/*\fR\fR
1814 .sp .6
1815 .RS 4n
1816 subset of compiled terminal description database
1819 .SH ATTRIBUTES
1822 See \fBattributes\fR(5) for descriptions of the following attributes:
1823 .SS "/usr/bin/vi, /usr/bin/view, /usr/bin/vedit"
1828 box;
1829 c | c
1830 l | l .
1831 ATTRIBUTE TYPE  ATTRIBUTE VALUE
1833 CSI     Not enabled
1836 .SS "/usr/xpg4/bin/vi, /usr/xpg4/bin/view, /usr/xpg4/bin/vedit"
1841 box;
1842 c | c
1843 l | l .
1844 ATTRIBUTE TYPE  ATTRIBUTE VALUE
1846 CSI     Enabled
1848 Interface Stability     Standard
1851 .SS "/usr/xpg6/bin/vi, /usr/xpg6/bin/view, /usr/xpg6/bin/vedit"
1856 box;
1857 c | c
1858 l | l .
1859 ATTRIBUTE TYPE  ATTRIBUTE VALUE
1861 CSI     Enabled
1863 Interface Stability     Standard
1866 .SH SEE ALSO
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)
1873 \fISolaris Advanced User\&'s Guide\fR
1874 .SH AUTHOR
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
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.
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.
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.
1903 To use a copy of \fB\&.exrc\fR located in the current directory other than
1904 \fB$HOME\fR, set the \fIexrc\fR option in \fBEXINIT\fR or \fB$HOME/.exrc\fR.
1905 Options set in \fBEXINIT\fR can be turned off in a local \fB\&.exrc\fR only if
1906 \fIexrc\fR is set in \fBEXINIT\fR or \fB$HOME/.exrc\fR. In order to be used,
1907 \fI\&.exrc\fR in \fB$HOME\fR or the current directory must fulfill these
1908 conditions:
1909 .RS +4
1911 .ie t \(bu
1912 .el o
1913 It must exist.
1915 .RS +4
1917 .ie t \(bu
1918 .el o
1919 It must be owned by the same userid as the real userid of the process, or the
1920 process has appropriate privileges.
1922 .RS +4
1924 .ie t \(bu
1925 .el o
1926 It is not writable by anyone other than the owner.
1930 Tampering with entries in \fB/usr/share/lib/terminfo/?/*\fR or
1931 \fB/usr/share/lib/terminfo/?/*\fR (for example, changing or removing an entry)
1932 can affect programs such as \fBvi\fR that expect the entry to be present and
1933 correct. In particular, removing the "dumb" terminal can cause unexpected
1934 problems.
1937 Software tabs using \fB^T\fR work only immediately after the \fIautoindent\fR.
1940 Left and right shifts on intelligent terminals do not make use of insert and
1941 delete character operations in the terminal.
1944 Loading an alternate \fBmalloc()\fR library using the environment variable
1945 \fBLD_PRELOAD\fR can cause problems for \fB/usr/bin/vi\fR.
1948 The \fBvi\fR utility currently has the following limitations:
1949 .RS +4
1952 Lines, including the trailing NEWLINE character, can contain no more than
1953 4096 bytes.
1955 If a longer line is found, \fBLine too long\fR is displayed in the status line.
1957 .RS +4
1960 The editor's temporary work file can be no larger than 128Mb.
1962 If a larger temporary file is needed, \fBTmp file too large\fR is displayed in
1963 the status line.