2 .\" The Regents of the University of California. All rights reserved.
3 .\" Copyright (c) 1994, 1995, 1996
4 .\" Keith Bostic. All rights reserved.
6 .\" Zhihao Yuan. All rights reserved.
8 .\" The vi program is freely redistributable.
9 .\" You are welcome to copy, modify and share it with others
10 .\" under the conditions listed in the LICENSE file.
11 .\" If any company (not individual!) finds vi sufficiently useful
12 .\" that you would have purchased it, or if any company wishes to
13 .\" redistribute it, contributions to the authors would be appreciated.
42 is a screen-oriented text editor.
44 is a line-oriented text editor.
48 are different interfaces to the same program,
49 and it is possible to switch back and forth during an edit session.
51 is the equivalent of using the
57 This manual page is the one provided with the
58 .Nm nex Ns / Ns Nm nvi
62 .Nm nex Ns / Ns Nm nvi
63 are intended as bug-for-bug compatible replacements for the original
64 Fourth Berkeley Software Distribution
70 For the rest of this manual page,
71 .Nm nex Ns / Ns Nm nvi
72 is used only when it's necessary to distinguish it from the historic
74 .Nm ex Ns / Ns Nm vi .
76 This manual page is intended for users already familiar with
77 .Nm ex Ns / Ns Nm vi .
78 Anyone else should almost certainly read a good tutorial on the
79 editor before this manual page.
80 If you're in an unfamiliar environment,
81 and you absolutely have to get work done immediately,
82 read the section after the options description, entitled
84 It's probably enough to get you going.
86 The following options are available:
87 .Bl -tag -width "-w size "
91 on the first file loaded.
92 Particularly useful for initial positioning in the file, although
94 is not limited to positioning commands.
95 This is the POSIX 1003.2 interface for the historic
98 .Nm nex Ns / Ns Nm nvi
99 supports both the old and new syntax.
101 Start editing in ex mode, as if the command name were
104 Don't copy the entire file when first starting to edit.
105 (The default is to make a copy in case someone else modifies
106 the file during your edit session.)
108 .\" Start editing with the lisp and showmatch options set.
110 Start editing in read-only mode, as if the command name was
116 Recover the specified files, or, if no files are specified,
117 list the files that could be recovered.
118 If no recoverable files by the specified name exist,
119 the file is edited as if the
121 option had not been specified.
125 edit option set, disallowing all access to external programs.
127 Enter batch mode; applicable only to
130 Batch mode is useful when running
133 Prompts, informative messages and other user oriented messages are turned off,
134 and no startup files or environment variables are read.
135 This is the POSIX 1003.2 interface for the historic
138 .Nm nex Ns / Ns Nm nvi
139 supports both the old and new syntax.
141 Start editing at the specified
145 Start editing in vi mode, as if the command name was
148 Set the initial window size to the specified number of lines.
153 is read from the standard input.
156 interface, it is an error if standard input is not a terminal.
159 interface, if standard input is not a terminal,
161 will read commands from it regardless; however, the session will be a
162 batch mode session, exactly as if the
164 option had been specified.
166 This section will tell you the minimum amount that you need to
167 do simple editing tasks using
169 If you've never used any screen editor before,
170 you're likely to have problems even with this simple introduction.
171 In that case you should find someone that already knows
173 and have them walk you through this section.
177 This means that it takes up almost the entire screen,
178 displaying part of the file on each screen line,
179 except for the last line of the screen.
180 The last line of the screen is used for you to give commands to
184 to give information to you.
186 The other fact that you need to understand is that
189 i.e., you are either entering text or you are executing commands,
190 and you have to be in the right mode to do one or the other.
191 You will be in command mode when you first start editing a file.
192 There are commands that switch you into input mode.
193 There is only one key that takes you out of input mode,
199 key names are denoted with \(la and \(ra, e.g.,
205 on your terminal's keyboard.
206 If you're ever confused as to which mode you're in,
214 will beep at you if you try and do something that's not allowed.
215 It will also display error messages.
217 To start editing a file, enter the following command:
221 The command you should enter as soon as you start editing is:
223 .Dl :set verbose showmode
225 This will make the editor give you verbose error messages and display
226 the current mode at the bottom of the screen.
228 The commands to move around the file are:
231 Move the cursor left one character.
233 Move the cursor down one line.
235 Move the cursor up one line.
237 Move the cursor right one character.
238 .It Aq Cm cursor-arrows
239 The cursor arrow keys should work, too.
241 Search for the string
244 and move the cursor to its first character.
247 The commands to enter new text are:
248 .Bl -tag -width "<escape>"
250 Append new text, after the cursor.
252 Insert new text, before the cursor.
254 Open a new line below the line the cursor is on, and start entering text.
256 Open a new line above the line the cursor is on, and start entering text.
258 Once you've entered input mode using one of the
266 to quit entering text and return to command mode.
269 The commands to copy text are:
272 Copy the line the cursor is on.
274 Append the copied line after the line the cursor is on.
277 The commands to delete text are:
280 Delete the line the cursor is on.
282 Delete the character the cursor is on.
285 The commands to write the file are:
288 Write the file back to the file with the name that you originally used
289 as an argument on the
292 .It Cm :w Ar file_name
293 Write the file back to the file with the name
297 The commands to quit editing and exit the editor are:
300 Quit editing and leave
302 (if you've modified the file, but not saved your changes,
304 will refuse to quit).
306 Quit, discarding any modifications that you may have made.
310 Unusual characters can take up more than one column on the screen,
311 and long lines can take up more than a single screen line.
312 The above commands work on
314 characters and lines,
315 i.e., they affect the entire line no matter how many screen lines it takes up
316 and the entire character no matter how many screen columns it takes up.
317 .Sh REGULAR EXPRESSIONS
319 supports regular expressions
323 for line addresses, as the first part of the
324 .Nm ex Cm substitute ,
328 commands, and in search patterns.
329 Basic regular expressions
331 are enabled by default;
332 extended regular expressions
337 The use of regular expressions can be largely disabled using the
341 The following strings have special meanings in the
343 version of regular expressions:
344 .Bl -bullet -offset 6u
346 An empty regular expression is equivalent to the last regular expression used.
349 matches the beginning of the word.
352 matches the end of the word.
355 matches the replacement part of the last
360 A buffer is an area where commands can save changed or deleted text
363 buffers are named with a single character preceded by a double quote,
367 buffers are the same,
368 but without the double quote.
369 .Nm nex Ns / Ns Nm nvi
370 permits the use of any character without another meaning in the position where
371 a buffer name is expected.
373 All buffers are either in
377 Inserting a buffer in line mode into the text creates new lines for each of the
378 lines it contains, while a buffer in character mode creates new lines for any
381 than the first and last lines it contains.
382 The first and last lines are inserted at the current cursor position, becoming
383 part of the current line.
384 If there is more than one line in the buffer,
385 the current line itself will be split.
388 commands which store text into buffers do so in line mode.
391 commands depend on their associated motion command:
392 .Bl -bullet -offset 6u
410 make the destination buffer character-oriented.
424 make the destination buffer line-oriented.
438 make the destination buffer character-oriented, unless the starting and
439 end positions are the first and last characters on a line.
440 In that case, the buffer is line-oriented.
447 displays the current mode for each buffer.
453 may be referred to using their uppercase equivalent, in which case new content
454 will be appended to the buffer, instead of replacing it.
461 A region of text modified using the
467 commands is placed into the numeric buffer
469 if no other buffer is specified and if it meets one of the following conditions:
470 .Bl -bullet -offset 6u
472 It includes characters from more than one line.
474 It is specified using a line-oriented motion.
476 It is specified using one of the following motion commands:
478 .Cm \` Ns Aq Ar character ,
491 Before this copy is done, the previous contents of buffer
493 are moved into buffer
499 The contents of buffer
502 Note that this rotation occurs
504 of the user specifying another buffer.
507 text may be explicitly stored into the numeric buffers.
508 In this case, the buffer rotation occurs before the replacement of the buffer's
510 The numeric buffers are only available in
514 The following section describes the commands available in the command
518 The following words have a special meaning in the commands description:
520 .Bl -tag -width bigword -compact -offset 3u
522 A set of non-whitespace characters.
524 Temporary area where commands may place text.
525 If not specified, the default buffer is used.
530 A positive number used to specify the desired number of iterations
532 It defaults to 1 if not specified.
534 A cursor movement command which indicates the other end of the affected region
535 of text, the first being the current cursor position.
536 Repeating the command character makes it affect the whole current line.
538 A sequence of letters, digits or underscores.
544 if both present, may be specified in any order.
548 if both present, are effectively multiplied together
549 and considered part of the motion.
551 .Bl -tag -width Ds -compact
556 for the word starting at the cursor position.
565 Two lines of overlap are maintained, if possible.
576 is not given, scroll forward the number of lines specified by the last
583 command, scroll half the number of lines in the current screen.
591 lines, leaving the current line and column as is, if possible.
600 Two lines of overlap are maintained, if possible.
603 Display the following file information:
605 .Pq as given to Nm vi ;
606 whether the file has been modified since it was last written;
607 if the file is read-only;
608 the current line number;
609 the total number of lines in the file;
610 and the current line number as a percentage of the total lines in the file.
622 characters in the current line.
638 lines without changing the current column.
654 lines to the first non-blank character of that line.
666 lines, without changing the current column.
669 Return to the most recent tag context.
680 is not given, scroll backwards the number of lines specified by the last
687 command, scroll half the number of lines in the current screen.
690 Switch to the next lower screen in the window,
691 or to the first screen if there are no lower screens in the window.
699 lines, leaving the current line and column as is, if possible.
702 Suspend the current editor session.
707 command being entered, or cancel it if it is only partial.
710 Push a tag reference onto the tag stack.
712 .It Aq Cm control-\(ha
713 Switch to the most recently edited file.
723 Move the cursor forward
725 characters without changing the current line.
730 .Ar motion shell-argument(s)
731 .Aq Li carriage-return
733 Replace the lines spanned by
738 .Pq standard output and standard error
739 of the program named by the
741 option, called with a
744 .Ar shell-argument(s)
745 .Pq bundled into a single argument .
747 .Ar shell-argument(s) ,
753 characters are expanded to the current file name,
754 the previous current file name,
755 and the command text of the previous
759 commands, respectively.
760 The special meaning of
765 can be overridden by escaping them with a backslash.
775 .Pq trailing So # Sc or So + Sc
778 the number under the cursor by
780 starting at the cursor position or at the first non-blank
781 character following it.
782 Numbers with a leading
786 are interpreted as hexadecimal numbers.
787 Numbers with a leading
789 are interpreted as octal numbers unless they contain a non-octal digit.
790 Other numbers may be prefixed with a
800 Move the cursor to the end of a line.
803 is specified, additionally move the cursor down
811 the one found at the cursor position or the closest to the right of it.
814 Repeat the previous substitution command on the current line.
817 .Cm \(aq Ns Aq Ar character
820 .Cm \` Ns Aq Ar character
822 Return to the cursor position marked by the character
830 to the position of the cursor before the last of the following commands:
848 The first form returns to the first non-blank character of the line marked by
850 The second form returns to the line and column marked by
863 sentences backward or forward, respectively.
864 A sentence is an area of text that begins with the first nonblank character
865 following the previous sentence, paragraph, or section
866 boundary and continues until the next period, exclamation point,
867 or question mark character, followed by any number of closing parentheses,
868 brackets, double or single quote characters, followed by
869 either an end-of-line or two whitespace characters.
870 Groups of empty lines
871 .Pq or lines containing only whitespace characters
872 are treated as a single sentence.
878 Reverse find character
879 .Pq i.e., the last Cm F , f , T No or Cm t No command
887 Move to the first non-blank character of the previous line,
897 command that modified text.
901 argument of the repeated command and that of the associated
907 command, the change log is rolled forward or backward, depending on the action
914 .Aq Li carriage-return
920 .Aq Li carriage-return
924 .Aq Li carriage-return
927 .Pf ?\& Ns Ar RE Ns ?\&
930 .Aq Li carriage-return
938 for a regular expression.
942 repeat the last search in the same or opposite directions, respectively.
945 is empty, the last search regular expression is used.
948 is specified, the cursor is placed
950 lines before or after the matched regular expression.
955 commands are used as motion components for the
957 command, there will be no prompt for the text of the command and the previous
960 Multiple search patterns may be grouped together by delimiting them with
961 semicolons and zero or more whitespace characters.
962 These patterns are evaluated from left to right with the final cursor position
963 determined by the last search pattern.
966 command may be appended to the closed search expressions to reposition the
970 Move to the first character in the current line.
981 Repeat the last character find
1002 lines left or right, respectively, by an amount of
1011 The buffer may include
1013 commands too, but they must be expressed as a
1022 then the last buffer executed shall be used.
1028 Enter input mode, appending the text after the end of the line.
1031 argument is given, the characters input are repeated
1033 \(mi 1 times after input mode is exited.
1047 Change text from the current position to the end-of-line.
1052 the deleted text into
1059 Delete text from the current position to the end-of-line.
1064 the deleted text into
1077 .Cm F Aq Ar character
1081 times backward through the current line for
1090 or the last line of the file if
1098 Move to the screen line
1100 \(mi 1 lines below the top of the screen.
1106 Enter input mode, inserting the text at the beginning of the line.
1110 the characters input are repeated
1120 lines with the current line.
1121 The spacing between two joined lines is set to two whitespace characters if the
1122 former ends with a question mark, a period or an exclamation point.
1123 It is set to one whitespace character otherwise.
1129 Move to the screen line
1131 \(mi 1 lines above the bottom of the screen.
1134 Move to the screen line in the middle of the screen.
1140 Enter input mode, appending text in a new line above the current line.
1144 the characters input are repeated
1154 before the current column if
1156 is character-oriented or before the current line if it is line-oriented.
1170 Enter input mode, replacing the characters in the current line.
1174 the characters input are repeated
1176 \(mi 1 more times upon exit from insert mode.
1190 the deleted text into
1200 times, through the current line for the character after the specified
1204 Restore the current line to its state before the cursor last moved to it.
1221 characters before the cursor, on the current line.
1226 the deleted text into
1241 Write the file and exit
1243 if there are no more files to edit.
1246 commands in a row ignores any remaining file to edit.
1265 Move to the first non-blank character on the current line.
1273 \(mi 1 lines, to the first non-blank character.
1279 Enter input mode, appending the text after the cursor.
1283 the characters input are repeated
1301 Change the region of text described by
1309 the changed text into
1318 Delete the region of text described by
1326 the deleted text into
1339 .Cm f Aq Ar character
1343 times, through the rest of the current line for
1350 Enter input mode, inserting the text before the cursor.
1354 the characters input are repeated
1362 Save the current context
1371 Enter input mode, appending text in a new line under the current line.
1375 the characters input are repeated
1385 Text is appended after the current column if
1387 is character oriented, or after the current line otherwise.
1406 characters in the current line starting with the current character.
1411 the substituted text into
1421 times, through the current line for the character immediately before
1425 Undo the last change made to the file.
1428 command alternates between these two states.
1431 command, when used immediately after
1433 causes the change log to be rolled forward or backward, depending on the action
1453 characters at the current cursor position, but no more than there are till the
1464 a text region specified by
1476 Redraw, optionally repositioning and resizing the screen.
1479 is specified, limit the screen size to
1484 characters may be used:
1489 is specified, place the line
1491 at the top of the screen.
1492 Otherwise, display the screen after the current screen.
1493 .It Aq Cm carriage-return
1496 at the top of the screen.
1500 in the center of the screen.
1504 at the bottom of the screen.
1509 display the screen before the screen before
1511 .Pq i.e., 2 screens before .
1512 Otherwise, display the screen before the current screen.
1529 position on the current line.
1533 move to the start of the current line.
1550 option is not set, reverse the case of the next
1559 reverses the case of the characters in a text region specified by the
1565 Interrupt the current operation.
1568 character is usually
1571 .Sh VI TEXT INPUT COMMANDS
1572 The following section describes the commands available in the text input mode
1577 .Bl -tag -width Ds -compact
1579 Replay the previous input.
1582 Erase to the previous
1586 .It Cm \(ha Ns Aq Cm control-D
1587 Erase all of the autoindent characters, and reset the autoindent level.
1589 .It Cm 0 Ns Aq Cm control-D
1590 Erase all of the autoindent characters.
1597 characters to move forward to the next
1602 option is set, only insert
1608 Erase the last character.
1610 .It Aq Cm literal next
1611 Escape the next character from any special meaning.
1614 character is usually
1618 Resolve all text input into the file, and return to command mode.
1620 .It Aq Cm line erase
1621 Erase the current line.
1624 .It Aq Cm word erase
1625 Erase the last word.
1626 The definition of word is dependent on the
1639 Insert a character with the specified hexadecimal value into the text.
1642 Interrupt text input mode, returning to command mode.
1645 character is usually
1649 The following section describes the commands available in the
1652 In each entry below, the tag line is a usage synopsis for the command.
1654 .Bl -tag -width Ds -compact
1655 .It Aq Cm end-of-file
1658 .It Cm !\& Ar argument(s)
1664 Execute a shell command, or filter lines through a shell command.
1671 .Cm nu Ns Op Cm mber
1681 Display the selected lines, each preceded with its line number.
1689 .Cm < Ns Op Cm < ...
1700 Display the line number of
1704 is not specified, display the line number of the last line in the file.
1708 .Cm > Ns Op Cm > ...
1715 .Cm ab Ns Op Cm breviate
1722 as an abbreviation for
1724 to the abbreviation list.
1728 .Cm a Ns Op Cm ppend Ns
1731 The input text is appended after the specified line.
1733 .It Cm ar Ns Op Cm gs
1734 Display the argument list.
1739 Background the current screen.
1743 .Cm c Ns Op Cm hange Ns
1747 The input text replaces the specified range.
1750 .Cm chd Ns Op Cm ir Ns
1758 Change the current working directory.
1772 Copy the specified lines after the destination
1776 .Cm cs Ns Op Cm cope
1777 .Cm add | find | help | kill | reset
1779 Execute a Cscope command.
1783 .Cm d Ns Op Cm elete
1788 Delete the lines from the file.
1791 .Cm di Ns Op Cm splay
1792 .Cm b Ns Oo Cm uffers Oc |
1793 .Cm c Ns Oo Cm onnections Oc |
1794 .Cm s Ns Oo Cm creens Oc |
1797 Display buffers, Cscope connections, screens or tags.
1812 Edit a different file.
1815 .Cm exu Ns Op Cm sage
1818 Display usage for an
1826 Display and optionally change the file name.
1835 Foreground the specified screen.
1839 .Cm g Ns Op Cm lobal
1840 .No / Ns Ar pattern Ns /
1846 .No / Ns Ar pattern Ns /
1849 Apply commands to lines matching
1855 .It Cm he Ns Op Cm lp
1856 Display a help message.
1860 .Cm i Ns Op Cm nsert Ns
1863 The input text is inserted before the specified line.
1867 .Cm j Ns Op Cm oin Ns
1872 Join lines of text together.
1880 Display the lines unambiguously.
1883 .Cm map Ns Op Cm !\&
1886 Define or display maps
1887 .Pq for Nm vi No only .
1896 .Cm k Aq Ar character
1898 Mark the line with the mark
1906 Move the specified lines after the target line.
1909 .Cm mk Ns Op Cm exrc Ns
1913 Write the abbreviations, editor options and maps to the specified
1922 Edit the next file from the argument list.
1926 .\" .Cm o Ns Op Cm pen
1927 .\" .No / Ns Ar pattern Ns /
1930 .\" Enter open mode.
1932 .It Cm pre Ns Op Cm serve
1933 Save the file in a form that can later be recovered using the
1940 .Cm rev Ns Op Cm ious Ns
1943 Edit the previous file from the argument list.
1951 Display the specified lines.
1958 Append buffer contents to the current line.
1961 .Cm q Ns Op Cm uit Ns
1964 End the editing session.
1968 .Cm r Ns Op Cm ead Ns
1975 .Cm rec Ns Op Cm over
1980 if it was previously saved.
1983 .Cm res Ns Op Cm ize
1984 .Op Cm + Ns | Ns Cm - Ns
1989 Grow or shrink the current screen.
1992 .Cm rew Ns Op Cm ind Ns
1995 Rewind the argument list.
2000 .Op option Oo = Oo value Oc Oc \ \&...
2002 .Pf \ \& Op nooption ...
2006 Display or set editor options.
2008 .It Cm sh Ns Op Cm ell
2009 Run a shell program.
2012 .Cm so Ns Op Cm urce
2017 commands from a file.
2021 .Cm s Ns Op Cm ubstitute
2023 .Op / Ar pattern No / Ar replace No /
2025 .Pf \ \& Op Ar options
2046 field may contain any of the following sequences:
2052 The replacement part of the previous
2056 If this is the entire
2058 pattern, the replacement part of the previous
2061 .It Sq \e Ns Ar \(sh
2064 is an integer from 1 to 9, the text matched by the
2065 .Ar # Ns 'th subexpression in
2068 Causes the characters up to the end of the line of the next occurrence of
2072 to be converted to lowercase.
2074 Causes the next character to be converted to lowercase.
2076 Causes the characters up to the end of the line of the next occurrence of
2080 to be converted to uppercase.
2082 Causes the next character to be converted to uppercase.
2086 .Cm su Ns Op Cm spend Ns
2090 .Cm st Ns Op Cm op Ns
2094 Suspend the edit session.
2097 character is usually
2106 Edit the file containing the specified tag.
2109 .Cm tagn Ns Op Cm ext Ns
2112 Edit the file containing the next context for the current tag.
2115 .Cm tagp Ns Op Cm op Ns
2117 .Op Ar file | number
2119 Pop to the specified tag in the tags stack.
2122 .Cm tagpr Ns Op Cm ev Ns
2125 Edit the file containing the previous context for the current tag.
2128 .Cm tagt Ns Op Cm op Ns
2131 Pop to the least recent tag on the tags stack, clearing the stack.
2134 .Cm una Ns Op Cm bbreviate
2139 Delete an abbreviation.
2141 .It Cm u Ns Op Cm ndo
2142 Undo the last change made to the file.
2145 .Cm unm Ns Op Cm ap Ns
2149 Unmap a mapped string.
2151 .It Cm ve Ns Op Cm rsion
2152 Display the version of the
2153 .Nm ex Ns / Ns Nm vi
2158 .Cm vi Ns Op Cm sual
2170 .Cm i Ns Op Cm sual Ns
2180 .Cm viu Ns Op Cm sage
2189 .Cm w Ns Op Cm rite Ns
2216 .Cm x Ns Op Cm it Ns
2221 writing the file if it has been modified.
2229 Copy the specified lines to a buffer.
2241 There are a large number of options that may be set
2243 to change the editor's behavior.
2244 This section describes the options, their abbreviations and their
2247 In each entry below, the first part of the tag line is the full name
2248 of the option, followed by any equivalent abbreviations.
2249 The part in square brackets is the default value of the option.
2250 Most of the options are boolean, i.e., they are either on or off,
2251 and do not have an associated value.
2253 Options apply to both
2257 modes, unless otherwise specified.
2259 .It Cm altwerase Bq off
2262 Select an alternate word erase algorithm.
2263 .It Cm autoindent , ai Bq off
2264 Automatically indent new lines.
2265 .It Cm autoprint , ap Bq on
2268 Display the current line automatically.
2269 .It Cm autowrite , aw Bq off
2270 Write modified files automatically when changing files or suspending the editor
2272 .It Cm backup Bq \&"\&"
2273 Back up files before they are overwritten.
2274 .It Cm beautify , bf Bq off
2275 Discard control characters.
2276 .It Cm cdpath Bo environment variable Ev CDPATH , or current directory Bc
2277 The directory paths used as path prefixes for the
2280 .It Cm cedit Bq no default
2281 Set the character to edit the colon command-line history.
2282 .It Cm columns , co Bq 80
2283 Set the number of columns in the screen.
2284 .It Cm comment Bq off
2287 Skip leading comments in shell, C and C++ language files.
2288 .It Cm directory , dir Bo environment variable Ev TMPDIR , or Pa /tmp Bc
2289 The directory where temporary files are created.
2290 .It Cm edcompatible , ed Bq off
2291 Remember the values of the
2297 commands, instead of initializing them as unset for each new command.
2298 .It Cm errorbells , eb Bq off
2301 Announce error messages with a bell.
2302 .It Cm escapetime Bq 1
2303 The tenths of a second
2304 .Nm ex Ns / Ns Nm vi
2305 waits for a subsequent key to complete an
2308 .It Cm expandtab , et Bq off
2313 when inserting, replacing or shifting text, autoindenting,
2319 when filtering lines with the
2322 .It Cm exrc , ex Bq off
2323 Read the startup files in the local directory.
2324 .It Cm extended Bq off
2325 Use extended regular expressions
2327 rather than basic regular expressions
2331 for more information on regular expressions.
2332 .It Cm filec Bq Aq tab
2333 Set the character to perform file path completion on the colon command line.
2334 .It Cm fileencoding , fe Bq auto detect
2335 Set the encoding of the current file.
2337 Flash the screen instead of beeping the keyboard on error.
2338 .It Cm hardtabs, ht Bq 0
2339 Set the spacing between hardware tab settings.
2340 This option currently has no effect.
2341 .It Cm iclower Bq off
2342 Makes all regular expressions case-insensitive,
2343 as long as an upper-case letter does not appear in the search string.
2344 .It Cm ignorecase , ic Bq off
2345 Ignore case differences in regular expressions.
2346 .It Cm inputencoding , ie Bq locale
2347 Set the encoding of your input characters.
2349 The tenths of a second
2350 .Nm ex Ns / Ns Nm vi
2351 waits for a subsequent key to complete a key mapping.
2352 .It Cm leftright Bq off
2355 Do left-right scrolling.
2356 .It Cm lines , li Bq 24
2359 Set the number of lines in the screen.
2363 Modify various search commands and options to work with Lisp.
2364 This option is not yet implemented.
2366 Display lines in an unambiguous fashion.
2368 Attempt to get an exclusive lock on any file being edited, read or written.
2370 When turned off, all regular expression characters except for
2374 are treated as ordinary characters.
2375 Preceding individual characters by
2378 .It Cm matchchars Bq []{}()
2379 Character pairs looked for by the
2382 .It Cm matchtime Bq 7
2385 The tenths of a second
2386 .Nm ex Ns / Ns Nm vi
2387 pauses on the matching character when the
2391 Permit messages from other users.
2392 .It Cm msgcat Bq /usr/share/vi/catalog/
2393 Selects a message catalog to be used to display error and informational
2394 messages in a specified language.
2395 .It Cm modelines , modeline Bq off
2396 Read the first and last few lines of each file for
2399 This option will never be implemented.
2400 .It Cm noprint Bq \&"\&"
2401 Characters that are never handled as printable characters.
2402 .It Cm number , nu Bq off
2403 Precede each line displayed with its current line number.
2405 Display unknown characters as octal numbers, instead of the default
2410 If this option is not set, the
2414 commands are disallowed.
2415 .It Cm optimize , opt Bq on
2418 Optimize text throughput to dumb terminals.
2419 This option is not yet implemented.
2420 .It Cm paragraphs , para Bq "IPLPPPQPP LIpplpipbp"
2423 Define additional paragraph boundaries for the
2428 .It Cm path Bq \&"\&"
2429 Define additional directories to search for files being edited.
2430 .It Cm print Bq \&"\&"
2431 Characters that are always handled as printable characters.
2435 Display a command prompt.
2436 .It Cm readonly , ro Bq off
2437 Mark the file and session as read-only.
2438 .It Cm recdir Bq /var/tmp/vi.recover
2439 The directory where recovery files are stored.
2440 .It Cm redraw , re Bq off
2443 Simulate an intelligent terminal on a dumb one.
2444 This option is not yet implemented.
2446 Remap keys until resolved.
2448 Set the number of lines about which the editor reports changes or yanks.
2452 Display a row/column ruler on the colon command line.
2453 .It Cm scroll , scr Bq "window size / 2"
2454 Set the number of lines scrolled.
2455 .It Cm searchincr Bq off
2460 commands incremental.
2461 .It Cm sections , sect Bq "NHSHH HUnhsh"
2464 Define additional section boundaries for the
2469 .It Cm secure Bq off
2470 Turns off all access to external programs.
2471 .It Cm shell , sh Bo environment variable Ev SHELL , or Pa /bin/sh Bc
2472 Select the shell used by the editor.
2473 .It Cm shellmeta Bq \(ti{[*?$\`\(aq\&"\e
2474 Set the meta characters checked to determine if file name expansion
2476 .It Cm shiftwidth , sw Bq 8
2477 Set the autoindent and shift command indentation width.
2478 .It Cm showmatch , sm Bq off
2481 Note the left matching characters when the right ones are inserted.
2482 .It Cm showmode , smd Bq off
2485 Display the current editor mode and a
2488 .It Cm sidescroll Bq 16
2491 Set the amount a left-right scroll will shift.
2492 .It Cm slowopen , slow Bq off
2493 Delay display updating during text input.
2494 This option is not yet implemented.
2495 .It Cm sourceany Bq off
2496 Read startup files not owned by the current user.
2497 This option will never be implemented.
2498 .It Cm tabstop , ts Bq 8
2499 This option sets tab widths for the editor display.
2500 .It Cm taglength , tl Bq 0
2501 Set the number of significant characters in tag names.
2502 .It Cm tags , tag Bq tags
2503 Set the list of tags files.
2505 .Cm term , ttytype , tty
2506 .Bq environment variable Ev TERM
2508 Set the terminal type.
2510 This option has historically made editor messages less verbose.
2511 It has no effect in this implementation.
2512 .It Cm tildeop Bq off
2515 command to take an associated motion.
2516 .It Cm timeout , to Bq on
2517 Time out on keys which may be mapped.
2518 .It Cm ttywerase Bq off
2521 Select an alternate erase algorithm.
2522 .It Cm verbose Bq off
2525 Display an error message for every error.
2526 .It Cm w300 Bq no default
2529 Set the window size if the baud rate is less than 1200 baud.
2530 .It Cm w1200 Bq no default
2533 Set the window size if the baud rate is equal to 1200 baud.
2534 .It Cm w9600 Bq no default
2537 Set the window size if the baud rate is greater than 1200 baud.
2541 This option causes a warning message to be printed on the terminal
2542 if the file has been modified since it was last written, before a
2547 .Bq environment variable Ev LINES No \(mi 1
2549 Set the window size for the screen.
2550 .It Cm windowname Bq off
2551 Change the icon/window name to the current file name.
2552 .It Cm wraplen , wl Bq 0
2555 Break lines automatically,
2556 the specified number of columns from the left-hand margin.
2561 edit options are set, the
2564 .It Cm wrapmargin , wm Bq 0
2567 Break lines automatically,
2568 the specified number of columns from the right-hand margin.
2573 edit options are set, the
2576 .It Cm wrapscan , ws Bq on
2577 Set searches to wrap around the end or beginning of the file.
2578 .It Cm writeany , wa Bq off
2579 Turn off file-overwriting checks.
2582 .Bl -tag -width "COLUMNS"
2584 The number of columns on the screen.
2585 This value overrides any system or terminal specific values.
2588 environment variable is not set when
2589 .Nm ex Ns / Ns Nm vi
2592 option is explicitly reset by the user,
2593 .Nm ex Ns / Ns Nm vi
2594 enters the value into the environment.
2598 startup commands, read after
2604 The user's home directory, used as the initial directory path for the startup
2609 This value is also used as the default directory for the
2613 The number of rows on the screen.
2614 This value overrides any system or terminal specific values.
2617 environment variable is not set when
2618 .Nm ex Ns / Ns Nm vi
2621 option is explicitly reset by the user,
2622 .Nm ex Ns / Ns Nm vi
2623 enters the value into the environment.
2627 startup commands, read after
2630 The user's shell of choice
2631 .Pq see also the Cm shell No option .
2633 The user's terminal type.
2634 The default is the type
2638 environment variable is not set when
2639 .Nm ex Ns / Ns Nm vi
2642 option is explicitly reset by the user,
2643 .Nm ex Ns / Ns Nm vi
2644 enters the value into the environment.
2646 The location used to store temporary files
2647 .Pq see also the Cm directory No edit option .
2649 .Sh ASYNCHRONOUS EVENTS
2650 .Bl -tag -width "SIGWINCH" -compact
2652 .Nm vi Ns / Ns Nm ex
2653 uses this signal for periodic backups of file modifications and to display
2655 messages when operations are likely to take a long time.
2659 If the current buffer has changed since it was last written in its entirety,
2660 the editor attempts to save the modified file so it can be later recovered.
2662 .Nm vi Ns / Ns Nm ex
2663 reference manual section
2665 for more information.
2668 When an interrupt occurs, the current operation is halted
2669 and the editor returns to the command level.
2670 If interrupted during text input,
2671 the text already input is resolved into the file as if the text
2672 input had been normally terminated.
2675 The screen is resized.
2677 .Nm vi Ns / Ns Nm ex
2678 reference manual section
2679 .Sx Sizing the Screen
2680 for more information.
2684 .\" .Nm vi Ns / Ns Nm ex
2685 .\" ignores these signals.
2688 .Bl -tag -width "/var/tmp/vi.recover"
2690 The default user shell.
2697 commands first in the startup sequence.
2698 Must be owned by root or the user,
2699 and writable only by the owner.
2701 Temporary file directory.
2702 .It Pa /var/tmp/vi.recover
2703 The default recovery file directory.
2705 First choice for user's home directory startup file, read for
2707 commands right after
2714 Must be owned by root or the user,
2715 and writable only by the owner.
2717 Second choice for user's home directory startup file, read for
2719 commands under the same conditions as
2722 First choice for local directory startup file, read for
2724 commands at the end of the startup sequence if the
2726 option was turned on earlier.
2727 Must be owned by the user
2728 and writable only by the owner.
2730 Second choice for local directory startup file, read for
2732 commands under the same conditions as
2740 utilities exit 0 on success,
2741 and \*(Gt0 if an error occurs.
2747 .Nm nex Ns / Ns Nm nvi
2750 That document differs from historical
2751 .Nm ex Ns / Ns Nm vi
2752 practice in several places; there are changes to be made on both sides.
2756 editor first appeared in
2759 .Nm nex Ns / Ns Nm nvi
2760 replacements for the
2761 .Nm ex Ns / Ns Nm vi
2762 editor first appeared in
2766 wrote the original version of