remove documentation for no longer supported -F option
[nvi.git] / docs / vi.man / vi.1
blob36407b29f951396cc77b10c2c2a2fa50aafacf44
1 .\" Copyright (c) 1994
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\" Copyright (c) 1994, 1995, 1996
4 .\"     Keith Bostic.  All rights reserved.
5 .\"
6 .\" This document may not be republished without written permission from
7 .\" Keith Bostic. 
8 .\"
9 .\" See the LICENSE file for redistribution information.
10 .\"
11 .\"     $Id: vi.1,v 8.53 2001/01/28 13:20:06 skimo Exp $ (Berkeley) $Date: 2001/01/28 13:20:06 $
12 .\"
13 .TH VI 1 "%Q%"
14 .UC
15 .SH NAME
16 ex, vi, view \- text editors
17 .SH SYNOPSIS
18 .B ex
19 [\c
20 .B -eRrSsv\c
21 ] [\c
22 .BI -c " cmd"\c
23 ] [\c
24 .BI -t " tag"\c
25 ] [\c
26 .BI -w " size"\c
27 ] [file ...]
28 .br
29 .B vi
30 [\c
31 .B -elRrSv\c
32 ] [\c
33 .BI -c " cmd"\c
34 ] [\c
35 .BI -t " tag"\c
36 ] [\c
37 .BI -w " size"\c
38 ] [file ...]
39 .br
40 .B view
41 [\c
42 .B -eRrSv\c
43 ] [\c
44 .BI -c " cmd"\c
45 ] [\c
46 .BI -t " tag"\c
47 ] [\c
48 .BI -w " size"\c
49 ] [file ...]
50 .SH LICENSE
51 The vi program is freely redistributable.  You are welcome to copy,
52 modify and share it with others under the conditions listed in the
53 LICENSE file.  If any company (not individual!) finds vi sufficiently
54 useful that you would have purchased it, or if any company wishes to
55 redistribute it, contributions to the authors would be appreciated.
56 .SH DESCRIPTION
57 .I \&Vi
58 is a screen oriented text editor.
59 .I \&Ex
60 is a line-oriented text editor.
61 .I \&Ex
62 and
63 .I \&vi
64 are different interfaces to the same program,
65 and it is possible to switch back and forth during an edit session.
66 .I View
67 is the equivalent of using the
68 .B \-R
69 (read-only) option of
70 .IR \&vi .
71 .PP
72 This manual page is the one provided with the
73 .I nex/nvi
74 versions of the
75 .I ex/vi
76 text editors.
77 .I Nex/nvi
78 are intended as bug-for-bug compatible replacements for the original
79 Fourth Berkeley Software Distribution (4BSD)
80 .I \&ex
81 and
82 .I \&vi
83 programs.
84 For the rest of this manual page,
85 .I nex/nvi
86 is used only when it's necessary to distinguish it from the historic
87 implementations of
88 .IR ex/vi .
89 .PP
90 This manual page is intended for users already familiar with
91 .IR ex/vi .
92 Anyone else should almost certainly read a good tutorial on the
93 editor before this manual page.
94 If you're in an unfamiliar environment, and you absolutely have to
95 get work done immediately, read the section after the options
96 description, entitled ``Fast Startup''.
97 It's probably enough to get you going.
98 .PP
99 The following options are available:
101 .B \-c
102 Execute
103 .B cmd
104 immediately after starting the edit session.
105 Particularly useful for initial positioning in the file, however
106 .B cmd
107 is not limited to positioning commands.
108 This is the POSIX 1003.2 interface for the historic ``+cmd'' syntax.
109 .I Nex/nvi
110 supports both the old and new syntax.
112 .B \-e
113 Start editing in ex mode, as if the command name were
114 .IR \&ex .
116 .B \-l
117 Start editing with the lisp and showmatch options set.
119 .B \-R
120 Start editing in read-only mode, as if the command name was
121 .IR view ,
122 or the
123 .B readonly
124 option was set.
126 .B \-r
127 Recover the specified files, or, if no files are specified,
128 list the files that could be recovered.
129 If no recoverable files by the specified name exist,
130 the file is edited as if the
131 .B \-r
132 option had not been specified.
134 .B \-S
135 Run with the
136 .B secure
137 edit option set, disallowing all access to external programs.
139 .B \-s
140 Enter batch mode; applicable only to
141 .I \&ex
142 edit sessions.
143 Batch mode is useful when running
144 .I \&ex
145 scripts.
146 Prompts, informative messages and other user oriented message
147 are turned off,
148 and no startup files or environmental variables are read.
149 This is the POSIX 1003.2 interface for the historic ``\-'' argument.
150 .I \&Nex/nvi
151 supports both the old and new syntax.
153 .B \-t
154 Start editing at the specified tag.
155 (See
156 .IR ctags (1)).
158 .B \-w
159 Set the initial window size to the specified number of lines.
161 .B \-v
162 Start editing in vi mode, as if the command name was
163 .I \&vi
165 .IR view .
167 Command input for
168 .I ex/vi
169 is read from the standard input.
170 In the
171 .I \&vi
172 interface, it is an error if standard input is not a terminal.
173 In the
174 .I \&ex
175 interface, if standard input is not a terminal,
176 .I \&ex
177 will read commands from it regardless, however, the session will be a
178 batch mode session, exactly as if the
179 .B \-s
180 option had been specified.
182 .I Ex/vi
183 exits 0 on success, and greater than 0 if an error occurs.
184 .SH FAST STARTUP
185 This section will tell you the minimum amount that you need to
186 do simple editing tasks using
187 .IR \&vi .
188 If you've never used any screen editor before, you're likely to have
189 problems even with this simple introduction.
190 In that case you should find someone that already knows
191 .I \&vi
192 and have them walk you through this section.
194 .I \&Vi
195 is a screen editor.
196 This means that it takes up almost the entire screen, displaying part
197 of the file on each screen line, except for the last line of the screen.
198 The last line of the screen is used for you to give commands to
199 .IR \&vi ,
200 and for
201 .I \&vi
202 to give information to you.
204 The other fact that you need to understand is that
205 .I \&vi
206 is a modeful editor, i.e. you are either entering text or you
207 are executing commands, and you have to be in the right mode
208 to do one or the other.
209 You will be in command mode when you first start editing a file.
210 There are commands that switch you into input mode.
211 There is only one key that takes you out of input mode,
212 and that is the <escape> key.
213 (Key names are written using less-than and greater-than signs, e.g.
214 <escape> means the ``escape'' key, usually labeled ``esc'' on your
215 terminal's keyboard.)
216 If you're ever confused as to which mode you're in,
217 keep entering the <escape> key until
218 .I \&vi
219 beeps at you.
220 (Generally,
221 .I \&vi
222 will beep at you if you try and do something that's not allowed.
223 It will also display error messages.)
225 To start editing a file, enter the command ``vi file_name<carriage-return>''.
226 The command you should enter as soon as you start editing is
227 ``:set verbose showmode<carriage-return>''.
228 This will make the editor give you verbose error messages and display
229 the current mode at the bottom of the screen.
231 The commands to move around the file are:
233 .B h
234 Move the cursor left one character.
236 .B j
237 Move the cursor down one line.
239 .B k
240 Move the cursor up one line.
242 .B l
243 Move the cursor right one character.
245 .B <cursor-arrows>
246 The cursor arrow keys should work, too.
248 .B /text<carriage-return>
249 Search for the string ``text'' in the file,
250 and move the cursor to its first character.
252 The commands to enter new text are:
254 .B a
255 Append new text,
256 .I after
257 the cursor.
259 .B i
260 Insert new text,
261 .I before
262 the cursor.
264 .B o
265 Open a new line below the line the cursor is on, and start
266 entering text.
268 .B O
269 Open a new line above the line the cursor is on, and start
270 entering text.
272 .B <escape>
273 Once you've entered input mode using the one of the
274 .BR \&a ,
275 .BR \&i ,
276 .BR \&O
277 or 
278 .B \&o
279 commands, use
280 .B <escape>
281 to quit entering text and return to command mode.
283 The commands to copy text are:
285 .B yy
286 Copy the line the cursor is on.
288 .B p
289 Append the copied line after the line the cursor is on.
291 The commands to delete text are:
293 .B dd
294 Delete the line the cursor is on.
296 .B x
297 Delete the character the cursor is on.
299 The commands to write the file are:
301 .B :w<carriage-return>
302 Write the file back to the file with the name that you originally used
303 as an argument on the
304 .I \&vi
305 command line.
307 .B ":w file_name<carriage-return>"
308 Write the file back to the file with the name ``file_name''.
310 The commands to quit editing and exit the editor are:
312 .B :q<carriage-return>
313 Quit editing and leave vi (if you've modified the file, but not
314 saved your changes,
315 .I \&vi
316 will refuse to quit).
318 .B :q!<carriage-return>
319 Quit, discarding any modifications that you may have made.
321 One final caution.
322 Unusual characters can take up more than one column on the screen,
323 and long lines can take up more than a single screen line.
324 The above commands work on ``physical'' characters and lines,
325 i.e. they affect the entire line no matter how many screen lines it
326 takes up and the entire character no matter how many screen columns
327 it takes up.
328 .SH VI COMMANDS
329 The following section describes the commands available in the command
330 mode of the
331 .I \&vi
332 editor.
333 In each entry below, the tag line is a usage synopsis for the command
334 character.
337 .B "[count] <control-A>"
338 Search forward
339 .I count
340 times for the current word.
342 .B "[count] <control-B>"
343 Page backwards
344 .I count
345 screens.
347 .B "[count] <control-D>"
348 Scroll forward
349 .I count
350 lines.
352 .B "[count] <control-E>"
353 Scroll forward
354 .I count
355 lines, leaving the current line and column as is, if possible.
357 .B "[count] <control-F>"
358 Page forward
359 .I count
360 screens.
362 .B "<control-G>"
363 Display the file information.
365 .B "<control-H>"
367 .B "[count] h"
368 Move the cursor back
369 .I count
370 characters in the current line.
372 .B "[count] <control-J>"
374 .B "[count] <control-N>"
376 .B "[count] j"
377 Move the cursor down
378 .I count
379 lines without changing the current column.
381 .B "<control-L>"
383 .B "<control-R>"
384 Repaint the screen.
386 .B "[count] <control-M>"
388 .B "[count] +"
389 Move the cursor down
390 .I count
391 lines to the first nonblank character of that line.
393 .B "[count] <control-P>"
395 .B "[count] k"
396 Move the cursor up
397 .I count
398 lines, without changing the current column.
400 .B "<control-T>"
401 Return to the most recent tag context.
403 .B "<control-U>"
404 Scroll backwards
405 .I count
406 lines.
408 .B "<control-W>"
409 Switch to the next lower screen in the window, or, to the first
410 screen if there are no lower screens in the window.
412 .B "<control-Y>"
413 Scroll backwards
414 .I count
415 lines, leaving the current line and column as is, if possible.
417 .B "<control-Z>"
418 Suspend the current editor session.
420 .B "<escape>"
421 Execute
422 .I \&ex
423 commands or cancel partial commands.
425 .B "<control-]>"
426 Push a tag reference onto the tag stack.
428 .B "<control-^>"
429 Switch to the most recently edited file.
431 .B "[count] <space>"
433 .B "[count] l"
434 Move the cursor forward
435 .I count
436 characters without changing the current line.
438 .B "[count] ! motion shell-argument(s)"
439 Replace text with results from a shell command.
441 .B "[count] # #|+|-"
442 Increment or decrement the cursor number.
444 .B "[count] $"
445 Move the cursor to the end of a line.
447 .B "%"
448 Move to the matching character.
450 .B "&"
451 Repeat the previous substitution command on the current line.
453 .B "'<character>"
455 .B "`<character>"
456 Return to a context marked by the character
457 .IR <character> .
459 .B "[count] ("
460 Back up
461 .I count
462 sentences.
464 .B "[count] )"
465 Move forward
466 .I count
467 sentences.
469 .B "[count] ,"
470 Reverse find character
471 .I count
472 times.
474 .B "[count] -"
475 Move to first nonblank of the previous line,
476 .I count
477 times.
479 .B "[count] ."
480 Repeat the last
481 .I \&vi
482 command that modified text.
484 .B "/RE<carriage-return>"
486 .B "/RE/ [offset]<carriage-return>"
488 .B "?RE<carriage-return>"
490 .B "?RE? [offset]<carriage-return>"
492 .B "N"
494 .B "n"
495 Search forward or backward for a regular expression.
497 .B "0"
498 Move to the first character in the current line.
500 .B ":"
501 Execute an ex command.
503 .B "[count] ;"
504 Repeat the last character find
505 .I count
506 times.
508 .B "[count] < motion"
510 .B "[count] > motion"
511 Shift lines left or right.
513 .B "@ buffer"
514 Execute a named buffer.
516 .B "[count] A"
517 Enter input mode, appending the text after the end of the line.
519 .B "[count] B"
520 Move backwards
521 .I count
522 bigwords.
524 .B "[buffer] [count] C"
525 Change text from the current position to the end-of-line.
527 .B "[buffer] D"
528 Delete text from the current position to the end-of-line.
530 .B "[count] E"
531 Move forward
532 .I count
533 end-of-bigwords.
535 .B "[count] F <character>"
536 Search
537 .I count
538 times backward through the current line for
539 .IR <character> .
541 .B "[count] G"
542 Move to line
543 .IR count ,
544 or the last line of the file if
545 .I count
546 not specified.
548 .B "[count] H"
549 Move to the screen line
550 .I "count - 1"
551 lines below the top of the screen.
553 .B "[count] I"
554 Enter input mode, inserting the text at the beginning of the line.
556 .B "[count] J"
557 Join lines.
559 .B "[count] L"
560 Move to the screen line
561 .I "count - 1"
562 lines above the bottom of the screen.
564 .B " M"
565 Move to the screen line in the middle of the screen.
567 .B "[count] O"
568 Enter input mode, appending text in a new line above the current line.
570 .B "[buffer] P"
571 Insert text from a buffer.
573 .B "Q"
574 Exit
575 .I \&vi
576 (or visual) mode and switch to
577 .I \&ex
578 mode.
580 .B "[count] R"
581 Enter input mode, replacing the characters in the current line.
583 .B "[buffer] [count] S"
584 Substitute
585 .I count
586 lines.
588 .B "[count] T <character>"
589 Search backwards,
590 .I count
591 times,
592 through the current line for the character
593 .I after
594 the specified
595 .IR <character> .
597 .B "U"
598 Restore the current line to its state before the cursor last
599 moved to it.
601 .B "[count] W"
602 Move forward
603 .I count
604 bigwords.
606 .B "[buffer] [count] X"
607 Delete
608 .I count
609 characters before the cursor.
611 .B "[buffer] [count] Y"
612 Copy (or ``yank'')
613 .I count
614 lines into the specified buffer.
616 .B "ZZ"
617 Write the file and exit
618 .IR \&vi .
620 .B "[count] [["
621 Back up
622 .I count
623 section boundaries.
625 .B "[count] ]]"
626 Move forward
627 .I count
628 section boundaries.
630 .B "\&^"
631 Move to first nonblank character on the current line.
633 .B "[count] _"
634 Move down
635 .I "count - 1"
636 lines, to the first nonblank character.
638 .B "[count] a"
639 Enter input mode, appending the text after the cursor.
641 .B "[count] b"
642 Move backwards
643 .I count
644 words.
646 .B "[buffer] [count] c motion"
647 Change a region of text.
649 .B "[buffer] [count] d motion"
650 Delete a region of text.
652 .B "[count] e"
653 Move forward
654 .I count
655 end-of-words.
657 .B "[count] f<character>"
658 Search forward,
659 .I count
660 times, through the rest of the current line for
661 .IR <character> .
663 .B "[count] i"
664 Enter input mode, inserting the text before the cursor.
666 .B "m <character>"
667 Save the current context (line and column) as
668 .IR <character> .
670 .B "[count] o"
671 Enter input mode, appending text in a new line under the current line.
673 .B "[buffer] p"
674 Append text from a buffer.
676 .B "[count] r <character>"
677 Replace
678 .I count
679 characters.
681 .B "[buffer] [count] s"
682 Substitute
683 .I count
684 characters in the current line starting with the current character.
686 .B "[count] t <character>"
687 Search forward,
688 .I count
689 times, through the current line for the character immediately
690 .I before
691 .IR <character> .
693 .B "u"
694 Undo the last change made to the file.
696 .B "[count] w"
697 Move forward
698 .I count
699 words.
701 .B "[buffer] [count] x"
702 Delete
703 .I count
704 characters.
706 .B "[buffer] [count] y motion"
707 Copy (or ``yank'')
708 a text region specified by the
709 .I count
710 and motion into a buffer.
712 .B "[count1] z [count2] -|.|+|^|<carriage-return>"
713 Redraw, optionally repositioning and resizing the screen.
715 .B "[count] {"
716 Move backward
717 .I count
718 paragraphs.
720 .B "[count] |"
721 Move to a specific
722 .I column
723 position on the current line.
725 .B "[count] }"
726 Move forward
727 .I count
728 paragraphs.
730 .B "[count] ~"
731 Reverse the case of the next
732 .I count
733 character(s).
735 .B "[count] ~ motion"
736 Reverse the case of the characters in a text region specified by the
737 .I count
739 .IR motion .
741 .B "<interrupt>"
742 Interrupt the current operation.
743 .SH VI TEXT INPUT COMMANDS
744 The following section describes the commands available in the text
745 input mode of the
746 .I \&vi
747 editor.
750 .B "<nul>"
751 Replay the previous input.
753 .B "<control-D>"
754 Erase to the previous
755 .B shiftwidth
756 column boundary.
758 .B "^<control-D>"
759 Erase all of the autoindent characters, and reset the autoindent level.
761 .B "0<control-D>"
762 Erase all of the autoindent characters.
764 .B "<control-T>"
765 Insert sufficient
766 .I <tab>
768 .I <space>
769 characters to move forward to the next
770 .B shiftwidth
771 column boundary.
773 .B "<erase>
775 .B "<control-H>"
776 Erase the last character.
778 .B "<literal next>"
779 Quote the next character.
781 .B "<escape>
782 Resolve all text input into the file, and return to command mode.
784 .B "<line erase>"
785 Erase the current line.
787 .B "<control-W>"
789 .B "<word erase>"
790 Erase the last word.
791 The definition of word is dependent on the
792 .B altwerase
794 .B ttywerase
795 options.
797 .B "<control-X>[0-9A-Fa-f]+"
798 Insert a character with the specified hexadecimal value into the text.
800 .B "<interrupt>"
801 Interrupt text input mode, returning to command mode.
802 .SH EX COMMANDS
803 The following section describes the commands available in the
804 .I \&ex
805 editor.
806 In each entry below, the tag line is a usage synopsis for the command.
809 .B "<end-of-file>"
810 Scroll the screen.
812 .B "! argument(s)"
814 .B "[range]! argument(s)"
815 Execute a shell command, or filter lines through a shell command.
817 .B \&"
818 A comment.
820 .B "[range] nu[mber] [count] [flags]"
822 .B "[range] # [count] [flags]"
823 Display the selected lines, each preceded with its line number.
825 .B "@ buffer"
827 .B "* buffer"
828 Execute a buffer.
830 .B "[line] a[ppend][!]"
831 The input text is appended after the specified line.
833 .B "[range] c[hange][!] [count]"
834 The input text replaces the specified range.
836 .B "cs[cope] add | find | help | kill | reset"
837 Execute a Cscope command.
839 .B "[range] d[elete] [buffer] [count] [flags]"
840 Delete the lines from the file.
842 .B "di[splay] b[uffers] | c[onnections] | s[creens] | t[ags]"
843 Display buffers, Cscope connections, screens or tags.
845 .B "[Ee][dit][!] [+cmd] [file]"
847 .B "[Ee]x[!] [+cmd] [file]"
848 Edit a different file.
850 .B "exu[sage] [command]"
851 Display usage for an
852 .I \&ex
853 command.
855 .B "f[ile] [file]"
856 Display and optionally change the file name.
858 .B "[Ff]g [name]"
859 .I \&Vi
860 mode only.
861 Foreground the specified screen.
863 .B "[range] g[lobal] /pattern/ [commands]"
865 .B "[range] v /pattern/ [commands]"
866 Apply commands to lines matching (or not matching) a pattern.
868 .B "he[lp]"
869 Display a help message.
871 .B "[line] i[nsert][!]"
872 The input text is inserted before the specified line.
874 .B "[range] j[oin][!] [count] [flags]"
875 Join lines of text together.
877 .B "[range] l[ist] [count] [flags]"
878 Display the lines unambiguously.
880 .B "map[!] [lhs rhs]"
881 Define or display maps (for
882 .I \&vi
883 only).
885 .B "[line] ma[rk] <character>"
887 .B "[line] k <character>"
888 Mark the line with the mark
889 .IR <character> .
891 .B "[range] m[ove] line"
892 Move the specified lines after the target line.
894 .B "mk[exrc][!] file"
895 Write the abbreviations, editor options and maps to the specified
896 file.
898 .B "[Nn][ext][!] [file ...]"
899 Edit the next file from the argument list.
901 .B "[line] o[pen] /pattern/ [flags]"
902 Enter open mode.
904 .B "pre[serve]"
905 Save the file in a form that can later be recovered using the
906 .I \&ex
907 .B \-r
908 option.
910 .B "[Pp]rev[ious][!]"
911 Edit the previous file from the argument list.
913 .B "[range] p[rint] [count] [flags]"
914 Display the specified lines.
916 .B "[line] pu[t] [buffer]"
917 Append buffer contents to the current line.
919 .B "q[uit][!]"
920 End the editing session.
922 .B "[line] r[ead][!] [file]"
923 Read a file.
925 .B "rec[over] file"
926 Recover
927 .I file
928 if it was previously saved.
930 .B "res[ize] [+|-]size"
931 .I \&Vi
932 mode only.
933 Grow or shrink the current screen.
935 .B "rew[ind][!]"
936 Rewind the argument list.
938 .B "se[t] [option[=[value]] ...] [nooption ...] [option? ...] [all]"
939 Display or set editor options.
941 .B "sh[ell]"
942 Run a shell program.
944 .B "so[urce] file"
945 Read and execute
946 .I \&ex
947 commands from a file.
949 .B "[range] s[ubstitute] [/pattern/replace/] [options] [count] [flags]"
951 .B "[range] & [options] [count] [flags]"
953 .B "[range] ~ [options] [count] [flags]"
954 Make substitutions.
956 .B "su[spend][!]"
958 .B "st[op][!]"
960 .B <suspend>
961 Suspend the edit session.
963 .B "[Tt]a[g][!] tagstring"
964 Edit the file containing the specified tag.
966 .B "tagn[ext][!]"
967 Edit the file containing the next context for the current tag.
969 .B "tagp[op][!] [file | number]"
970 Pop to the specified tag in the tags stack.
972 .B "tagp[rev][!]"
973 Edit the file containing the previous context for the current tag.
975 .B "unm[ap][!] lhs"
976 Unmap a mapped string.
978 .B "ve[rsion]"
979 Display the version of the
980 .I \&ex/vi
981 editor.
983 .B "[line] vi[sual] [type] [count] [flags]"
984 .I \&Ex
985 mode only.
986 Enter
987 .IR \&vi .
989 .B "[Vi]i[sual][!] [+cmd] [file]"
990 .I \&Vi
991 mode only.
992 Edit a new file.
994 .B "viu[sage] [command]"
995 Display usage for a
996 .I \&vi
997 command.
999 .B "[range] w[rite][!] [>>] [file]"
1001 .B "[range] w[rite] [!] [file]"
1003 .B "[range] wn[!] [>>] [file]"
1005 .B "[range] wq[!] [>>] [file]"
1006 Write the file.
1008 .B "[range] x[it][!] [file]"
1009 Write the file if it has been modified.
1011 .B "[range] ya[nk] [buffer] [count]"
1012 Copy the specified lines to a buffer.
1014 .B "[line] z [type] [count] [flags]"
1015 Adjust the window.
1016 .SH SET OPTIONS
1017 There are a large number of options that may be set (or unset) to
1018 change the editor's behavior.
1019 This section describes the options, their abbreviations and their
1020 default values.
1022 In each entry below, the first part of the tag line is the full name
1023 of the option, followed by any equivalent abbreviations.
1024 The part in square brackets is the default value of the option.
1025 Most of the options are boolean, i.e. they are either on or off,
1026 and do not have an associated value.
1028 Options apply to both
1029 .I \&ex
1031 .I \&vi
1032 modes, unless otherwise specified.
1035 .B "altwerase [off]"
1036 .I \&Vi
1037 only.
1038 Select an alternate word erase algorithm.
1040 .B "autoindent, ai [off]"
1041 Automatically indent new lines.
1043 .B "autoprint, ap [off]"
1044 .I \&Ex
1045 only.
1046 Display the current line automatically.
1048 .B "autowrite, aw [off]"
1049 Write modified files automatically when changing files.
1050 .\" I cannot get a double quote to print between the square brackets
1051 .\" to save my life.  The ONLY way I've been able to get this to work
1052 .\" is with the .tr command.
1053 .tr Q"
1054 .ds ms backup [QQ]
1056 .B "\*(ms"
1057 .tr QQ
1058 Backup files before they are overwritten.
1060 .B "beautify, bf [off]"
1061 Discard control characters.
1063 .B "cdpath [environment variable CDPATH, or current directory]"
1064 The directory paths used as path prefixes for the
1065 .B cd
1066 command.
1068 .B "cedit [no default]"
1069 Set the character to edit the colon command-line history.
1071 .B "columns, co [80]"
1072 Set the number of columns in the screen.
1074 .B "comment [off]"
1075 .I \&Vi
1076 only.
1077 Skip leading comments in shell, C and C++ language files.
1079 .B "directory, dir [environment variable TMPDIR, or /tmp]"
1080 The directory where temporary files are created.
1082 .B "edcompatible, ed [off]"
1083 Remember the values of the ``c'' and ``g'' suffices to the
1084 .B substitute
1085 commands, instead of initializing them as unset for each new
1086 command.
1088 .B "errorbells, eb [off]"
1089 .I \&Ex
1090 only.
1091 Announce error messages with a bell.
1093 .B "exrc, ex [off]"
1094 Read the startup files in the local directory.
1096 .B "extended [off]"
1097 Regular expressions are extended (i.e.
1098 .IR egrep (1)\-\c
1099 style) expressions.
1101 .B "filec [no default]"
1102 Set the character to perform file path completion on the colon
1103 command line.
1105 .B "flash [on]"
1106 Flash the screen instead of beeping the keyboard on error.
1108 .B "hardtabs, ht [8]"
1109 Set the spacing between hardware tab settings.
1111 .B "iclower [off]"
1112 Makes all Regular Expressions case-insensitive,
1113 as long as an upper-case letter does not appear in the search string.
1115 .B "ignorecase, ic [off]"
1116 Ignore case differences in regular expressions.
1118 .B "keytime [6]"
1119 The 10th's of a second
1120 .I ex/vi
1121 waits for a subsequent key to complete a key mapping.
1123 .B "leftright [off]"
1124 .I \&Vi
1125 only.
1126 Do left-right scrolling.
1128 .B "lines, li [24]"
1129 .I \&Vi
1130 only.
1131 Set the number of lines in the screen.
1133 .B "lisp [off]"
1134 .I \&Vi
1135 only.
1136 Modify various search commands and options to work with Lisp.
1137 .I "This option is not yet implemented."
1139 .B "list [off]"
1140 Display lines in an unambiguous fashion.
1142 .B "lock [on]"
1143 Attempt to get an exclusive lock on any file being edited,
1144 read or written.
1146 .B "magic [on]"
1147 Treat certain characters specially in regular expressions.
1149 .B "matchtime [7]"
1150 .I \&Vi
1151 only.
1152 The 10th's of a second
1153 .I ex/vi
1154 pauses on the matching character when the
1155 .B showmatch
1156 option is set.
1158 .B "mesg [on]"
1159 Permit messages from other users.
1161 .B "modelines, modeline [off]"
1162 Read the first and last few lines of each file for
1163 .I ex
1164 commands.
1165 .I "This option will never be implemented."
1166 .\" I cannot get a double quote to print between the square brackets
1167 .\" to save my life.  The ONLY way I've been able to get this to work
1168 .\" is with the .tr command.
1169 .tr Q"
1170 .ds ms noprint [QQ]
1172 .B "\*(ms"
1173 .tr QQ
1174 Characters that are never handled as printable characters.
1176 .B "number, nu [off]"
1177 Precede each line displayed with its current line number.
1179 .B "octal [off]"
1180 Display unknown characters as octal numbers, instead of the default
1181 hexadecimal.
1183 .B "open [on]"
1184 .I \&Ex
1185 only.
1186 If this option is not set, the
1187 .B open
1189 .B visual
1190 commands are disallowed.
1192 .B "optimize, opt [on]"
1193 .I \&Vi
1194 only.
1195 Optimize text throughput to dumb terminals.
1196 .I "This option is not yet implemented."
1198 .B "paragraphs, para [IPLPPPQPP LIpplpipbp]"
1199 .I \&Vi
1200 only.
1201 Define additional paragraph boundaries for the
1202 .B \&{
1204 .B \&}
1205 commands.
1207 .B "path []"
1208 Define additional directories to search for files being edited.
1209 .\" I cannot get a double quote to print between the square brackets
1210 .\" to save my life.  The ONLY way I've been able to get this to work
1211 .\" is with the .tr command.
1212 .tr Q"
1213 .ds ms print [QQ]
1215 .B "\*(ms"
1216 .tr QQ
1217 Characters that are always handled as printable characters.
1219 .B "prompt [on]"
1220 .I \&Ex
1221 only.
1222 Display a command prompt.
1224 .B "readonly, ro [off]"
1225 Mark the file and session as read-only.
1227 .B "recdir [/var/tmp/vi.recover]"
1228 The directory where recovery files are stored.
1230 .B "redraw, re [off]"
1231 .I \&Vi
1232 only.
1233 Simulate an intelligent terminal on a dumb one.
1234 .I "This option is not yet implemented."
1236 .B "remap [on]"
1237 Remap keys until resolved.
1239 .B "report [5]"
1240 Set the number of lines about which the editor reports changes
1241 or yanks.
1243 .B "ruler [off]"
1244 .I \&Vi
1245 only.
1246 Display a row/column ruler on the colon command line.
1248 .B "scroll, scr [window / 2]"
1249 Set the number of lines scrolled.
1251 .B "searchincr [off]"
1252 Makes the
1253 .B \&/
1255 .B \&?
1256 commands incremental.
1258 .B "sections, sect [NHSHH HUnhsh]"
1259 .I \&Vi
1260 only.
1261 Define additional section boundaries for the
1262 .B \&[[
1264 .B \&]]
1265 commands.
1267 .B "secure [off]"
1268 Turns off all access to external programs.
1270 .B "shell, sh [environment variable SHELL, or /bin/sh]"
1271 Select the shell used by the editor.
1272 .\" I cannot get a double quote to print between the square brackets
1273 .\" to save my life.  The ONLY way I've been able to get this to work
1274 .\" is with the .tr command.
1275 .tr Q"
1276 .ds ms shellmeta [~{[*?$`'Q\e]
1278 .B "\*(ms"
1279 .tr QQ
1280 Set the meta characters checked to determine if file name expansion
1281 is necessary.
1283 .B "shiftwidth, sw [8]"
1284 Set the autoindent and shift command indentation width.
1286 .B "showmatch, sm [off]"
1287 .I \&Vi
1288 only.
1289 Note matching ``{'' and ``('' for ``}'' and ``)'' characters.
1291 .B "showmode, smd [off]"
1292 .I \&Vi
1293 only.
1294 Display the current editor mode and a ``modified'' flag.
1296 .B "sidescroll [16]"
1297 .I \&Vi
1298 only.
1299 Set the amount a left-right scroll will shift.
1301 .B "slowopen, slow [off]"
1302 Delay display updating during text input.
1303 .I "This option is not yet implemented."
1305 .B "sourceany [off]"
1306 Read startup files not owned by the current user.
1307 .I "This option will never be implemented."
1309 .B "tabstop, ts [8]"
1310 This option sets tab widths for the editor display.
1312 .B "taglength, tl [0]"
1313 Set the number of significant characters in tag names.
1315 .B "tags, tag [tags /var/db/libc.tags /sys/kern/tags]"
1316 Set the list of tags files.
1318 .B "term, ttytype, tty [environment variable TERM]"
1319 Set the terminal type.
1321 .B "terse [off]"
1322 This option has historically made editor messages less verbose.
1323 It has no effect in this implementation.
1325 .B "tildeop [off]"
1326 Modify the
1327 .B \&~
1328 command to take an associated motion.
1330 .B "timeout, to [on]"
1331 Time out on keys which may be mapped.
1333 .B "ttywerase [off]"
1334 .I \&Vi
1335 only.
1336 Select an alternate erase algorithm.
1338 .B "verbose [off]"
1339 .I \&Vi
1340 only.
1341 Display an error message for every error.
1343 .B "w300 [no default]"
1344 .I \&Vi
1345 only.
1346 Set the window size if the baud rate is less than 1200 baud.
1348 .B "w1200 [no default]"
1349 .I \&Vi
1350 only.
1351 Set the window size if the baud rate is equal to 1200 baud.
1353 .B "w9600 [no default]"
1354 .I \&Vi
1355 only.
1356 Set the window size if the baud rate is greater than 1200 baud.
1358 .B "warn [on]"
1359 .I \&Ex
1360 only.
1361 This option causes a warning message to the terminal if the file has
1362 been modified, since it was last written, before a
1363 .B \&!
1364 command.
1366 .B "window, w, wi [environment variable LINES]"
1367 Set the window size for the screen.
1369 .B "windowname [off]"
1370 Change the icon/window name to the current file name even if it can't
1371 be restored on editor exit.
1373 .B "wraplen, wl [0]"
1374 .I \&Vi
1375 only.
1376 Break lines automatically, the specified number of columns from the
1377 left-hand margin.
1378 If both the
1379 .B wraplen
1381 .B wrapmargin
1382 edit options are set, the
1383 .B wrapmargin
1384 value is used.
1386 .B "wrapmargin, wm [0]"
1387 .I \&Vi
1388 only.
1389 Break lines automatically, the specified number of columns from the
1390 right-hand margin.
1391 If both the
1392 .B wraplen
1394 .B wrapmargin
1395 edit options are set, the
1396 .B wrapmargin
1397 value is used.
1399 .B "wrapscan, ws [on]"
1400 Set searches to wrap around the end or beginning of the file.
1402 .B "writeany, wa [off]"
1403 Turn off file-overwriting checks.
1404 .SH "ENVIRONMENT VARIABLES
1406 .I COLUMNS
1407 The number of columns on the screen.
1408 This value overrides any system or terminal specific values.
1409 If the
1410 .I COLUMNS
1411 environmental variable is not set when
1412 .I ex/vi
1413 runs, or the
1414 .B columns
1415 option is explicitly reset by the user,
1416 .I ex/vi
1417 enters the value into the environment.
1419 .I EXINIT
1420 A list of
1421 .I \&ex
1422 startup commands, read if the variable
1423 .I NEXINIT
1424 is not set.
1426 .I HOME
1427 The user's home directory, used as the initial directory path
1428 for the startup ``$\fIHOME\fP/.nexrc'' and ``$\fIHOME\fP/.exrc''
1429 files.
1430 This value is also used as the default directory for the
1431 .I \&vi
1432 .B \&cd
1433 command.
1435 .I LINES
1436 The number of rows on the screen.
1437 This value overrides any system or terminal specific values.
1438 If the
1439 .I LINES
1440 environmental variable is not set when
1441 .I ex/vi
1442 runs, or the
1443 .B lines
1444 option is explicitly reset by the user,
1445 .I ex/vi
1446 enters the value into the environment.
1448 .I NEXINIT
1449 A list of
1450 .I \&ex
1451 startup commands.
1453 .I SHELL
1454 The user's shell of choice (see also the
1455 .B shell
1456 option).
1458 .I TERM
1459 The user's terminal type.
1460 The default is the type ``unknown''.
1461 If the
1462 .I TERM
1463 environmental variable is not set when
1464 .I ex/vi
1465 runs, or the
1466 .B term
1467 option is explicitly reset by the user,
1468 .I ex/vi
1469 enters the value into the environment.
1471 .I TMPDIR
1472 The location used to stored temporary files (see also the
1473 .B directory
1474 edit option).
1475 .SH ASYNCHRONOUS EVENTS
1477 SIGALRM
1478 .I \&Vi/ex
1479 uses this signal for periodic backups of file modifications and to
1480 display ``busy'' messages when operations are likely to take a long time.
1482 SIGHUP
1484 SIGTERM
1485 If the current buffer has changed since it was last written in its
1486 entirety, the editor attempts to save the modified file so it can
1487 be later recovered.
1488 See the
1489 .I \&vi/ex
1490 Reference manual section entitled ``Recovery'' for more information.
1492 SIGINT
1493 When an interrupt occurs,
1494 the current operation is halted,
1495 and the editor returns to the command level.
1496 If interrupted during text input,
1497 the text already input is resolved into the file as if the text
1498 input had been normally terminated.
1500 SIGWINCH
1501 The screen is resized.
1502 See the
1503 .I \&vi/ex
1504 Reference manual section entitled ``Sizing the Screen'' for more information.
1506 SIGCONT
1508 SIGQUIT
1510 SIGTSTP
1511 .I \&Vi/ex
1512 ignores these signals.
1513 .SH FILES
1515 /bin/sh
1516 The default user shell.
1518 /etc/vi.exrc
1519 System-wide vi startup file.
1521 /tmp
1522 Temporary file directory.
1524 /var/tmp/vi.recover
1525 The default recovery file directory.
1527 $HOME/.nexrc
1528 1st choice for user's home directory startup file.
1530 $HOME/.exrc
1531 2nd choice for user's home directory startup file.
1533 \&.nexrc
1534 1st choice for local directory startup file.
1536 \&.exrc
1537 2nd choice for local directory startup file.
1538 .SH SEE ALSO
1539 .IR ctags (1),
1540 .IR more (1),
1541 .IR curses (3),
1542 .IR dbopen (3)
1544 The ``Vi Quick Reference'' card.
1546 ``An Introduction to Display Editing with Vi'', found in the
1547 ``UNIX User's Manual Supplementary Documents''
1548 section of both the 4.3BSD and 4.4BSD manual sets.
1549 This document is the closest thing available to an introduction to the
1550 .I \&vi
1551 screen editor.
1553 ``Ex Reference Manual (Version 3.7)'',
1554 found in the
1555 ``UNIX User's Manual Supplementary Documents''
1556 section of both the 4.3BSD and 4.4BSD manual sets.
1557 This document is the final reference for the
1558 .I \&ex
1559 editor, as distributed in most historic 4BSD and System V systems.
1561 ``Edit: A tutorial'',
1562 found in the
1563 ``UNIX User's Manual Supplementary Documents''
1564 section of the 4.3BSD manual set.
1565 This document is an introduction to a simple version of the
1566 .I \&ex
1567 screen editor.
1569 ``Ex/Vi Reference Manual'',
1570 found in the
1571 ``UNIX User's Manual Supplementary Documents''
1572 section of the 4.4BSD manual set.
1573 This document is the final reference for the
1574 .I \&nex/nvi
1575 text editors, as distributed in 4.4BSD and 4.4BSD-Lite.
1577 .I Roff
1578 source for all of these documents is distributed with
1579 .I nex/nvi
1580 in the
1581 .I nvi/USD.doc
1582 directory of the
1583 .I nex/nvi
1584 source code.
1586 The files ``autowrite'', ``input'', ``quoting'' and ``structures''
1587 found in the
1588 .I nvi/docs/internals
1589 directory of the
1590 .I nex/nvi
1591 source code.
1592 .SH HISTORY
1594 .I nex/nvi
1595 replacements for the
1596 .I ex/vi
1597 editor first appeared in 4.4BSD.
1598 .SH STANDARDS
1599 .I \&Nex/nvi
1600 is close to IEEE Std1003.2 (``POSIX'').
1601 That document differs from historical
1602 .I ex/vi
1603 practice in several places; there are changes to be made on both sides.