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.
15 .\" $Id: vi.1,v 9.0 2013/11/02 12:11:56 zy Exp $
44 is a screen-oriented text editor.
46 is a line-oriented text editor.
50 are different interfaces to the same program,
51 and it is possible to switch back and forth during an edit session.
53 is the equivalent of using the
59 This manual page is the one provided with the
60 .Nm nex Ns / Ns Nm nvi
64 .Nm nex Ns / Ns Nm nvi
65 are intended as bug-for-bug compatible replacements for the original
66 Fourth Berkeley Software Distribution
72 For the rest of this manual page,
73 .Nm nex Ns / Ns Nm nvi
74 is used only when it's necessary to distinguish it from the historic
76 .Nm ex Ns / Ns Nm vi .
78 This manual page is intended for users already familiar with
79 .Nm ex Ns / Ns Nm vi .
80 Anyone else should almost certainly read a good tutorial on the
81 editor before this manual page.
82 If you're in an unfamiliar environment,
83 and you absolutely have to get work done immediately,
84 read the section after the options description, entitled
86 It's probably enough to get you going.
88 The following options are available:
89 .Bl -tag -width "-w size "
93 on the first file loaded.
94 Particularly useful for initial positioning in the file, although
96 is not limited to positioning commands.
97 This is the POSIX 1003.2 interface for the historic
100 .Nm nex Ns / Ns Nm nvi
101 supports both the old and new syntax.
103 Start editing in ex mode, as if the command name were
106 Don't copy the entire file when first starting to edit.
107 (The default is to make a copy in case someone else modifies
108 the file during your edit session.)
110 .\" Start editing with the lisp and showmatch options set.
112 Start editing in read-only mode, as if the command name was
118 Recover the specified files, or, if no files are specified,
119 list the files that could be recovered.
120 If no recoverable files by the specified name exist,
121 the file is edited as if the
123 option had not been specified.
127 edit option set, disallowing all access to external programs.
129 Enter batch mode; applicable only to
132 Batch mode is useful when running
135 Prompts, informative messages and other user oriented messages are turned off,
136 and no startup files or environment variables are read.
137 This is the POSIX 1003.2 interface for the historic
140 .Nm nex Ns / Ns Nm nvi
141 supports both the old and new syntax.
143 Start editing at the specified
147 Start editing in vi mode, as if the command name was
150 Set the initial window size to the specified number of lines.
155 is read from the standard input.
158 interface, it is an error if standard input is not a terminal.
161 interface, if standard input is not a terminal,
163 will read commands from it regardless; however, the session will be a
164 batch mode session, exactly as if the
166 option had been specified.
168 This section will tell you the minimum amount that you need to
169 do simple editing tasks using
171 If you've never used any screen editor before,
172 you're likely to have problems even with this simple introduction.
173 In that case you should find someone that already knows
175 and have them walk you through this section.
179 This means that it takes up almost the entire screen,
180 displaying part of the file on each screen line,
181 except for the last line of the screen.
182 The last line of the screen is used for you to give commands to
186 to give information to you.
188 The other fact that you need to understand is that
191 i.e., you are either entering text or you are executing commands,
192 and you have to be in the right mode to do one or the other.
193 You will be in command mode when you first start editing a file.
194 There are commands that switch you into input mode.
195 There is only one key that takes you out of input mode,
201 key names are denoted with \(la and \(ra, e.g.,
207 on your terminal's keyboard.
208 If you're ever confused as to which mode you're in,
216 will beep at you if you try and do something that's not allowed.
217 It will also display error messages.
219 To start editing a file, enter the following command:
223 The command you should enter as soon as you start editing is:
225 .Dl :set verbose showmode
227 This will make the editor give you verbose error messages and display
228 the current mode at the bottom of the screen.
230 The commands to move around the file are:
233 Move the cursor left one character.
235 Move the cursor down one line.
237 Move the cursor up one line.
239 Move the cursor right one character.
240 .It Aq Cm cursor-arrows
241 The cursor arrow keys should work, too.
243 Search for the string
246 and move the cursor to its first character.
249 The commands to enter new text are:
250 .Bl -tag -width "<escape>"
252 Append new text, after the cursor.
254 Insert new text, before the cursor.
256 Open a new line below the line the cursor is on, and start entering text.
258 Open a new line above the line the cursor is on, and start entering text.
260 Once you've entered input mode using one of the
268 to quit entering text and return to command mode.
271 The commands to copy text are:
274 Copy the line the cursor is on.
276 Append the copied line after the line the cursor is on.
279 The commands to delete text are:
282 Delete the line the cursor is on.
284 Delete the character the cursor is on.
287 The commands to write the file are:
290 Write the file back to the file with the name that you originally used
291 as an argument on the
294 .It Cm :w Ar file_name
295 Write the file back to the file with the name
299 The commands to quit editing and exit the editor are:
302 Quit editing and leave
304 (if you've modified the file, but not saved your changes,
306 will refuse to quit).
308 Quit, discarding any modifications that you may have made.
312 Unusual characters can take up more than one column on the screen,
313 and long lines can take up more than a single screen line.
314 The above commands work on
316 characters and lines,
317 i.e., they affect the entire line no matter how many screen lines it takes up
318 and the entire character no matter how many screen columns it takes up.
319 .Sh REGULAR EXPRESSIONS
321 supports regular expressions
325 for line addresses, as the first part of the
326 .Nm ex Cm substitute ,
330 commands, and in search patterns.
331 Basic regular expressions
333 are enabled by default;
334 extended regular expressions
339 The use of regular expressions can be largely disabled using the
343 The following strings have special meanings in the
345 version of regular expressions:
346 .Bl -bullet -offset 6u
348 An empty regular expression is equivalent to the last regular expression used.
351 matches the beginning of the word.
354 matches the end of the word.
357 matches the replacement part of the last
362 A buffer is an area where commands can save changed or deleted text
365 buffers are named with a single character preceded by a double quote,
369 buffers are the same,
370 but without the double quote.
371 .Nm nex Ns / Ns Nm nvi
372 permits the use of any character without another meaning in the position where
373 a buffer name is expected.
375 All buffers are either in
379 Inserting a buffer in line mode into the text creates new lines for each of the
380 lines it contains, while a buffer in character mode creates new lines for any
383 than the first and last lines it contains.
384 The first and last lines are inserted at the current cursor position, becoming
385 part of the current line.
386 If there is more than one line in the buffer,
387 the current line itself will be split.
390 commands which store text into buffers do so in line mode.
393 commands depend on their associated motion command:
394 .Bl -bullet -offset 6u
412 make the destination buffer character-oriented.
426 make the destination buffer line-oriented.
440 make the destination buffer character-oriented, unless the starting and
441 end positions are the first and last characters on a line.
442 In that case, the buffer is line-oriented.
449 displays the current mode for each buffer.
455 may be referred to using their uppercase equivalent, in which case new content
456 will be appended to the buffer, instead of replacing it.
463 A region of text modified using the
469 commands is placed into the numeric buffer
471 if no other buffer is specified and if it meets one of the following conditions:
472 .Bl -bullet -offset 6u
474 It includes characters from more than one line.
476 It is specified using a line-oriented motion.
478 It is specified using one of the following motion commands:
480 .Cm \` Ns Aq Ar character ,
493 Before this copy is done, the previous contents of buffer
495 are moved into buffer
501 The contents of buffer
504 Note that this rotation occurs
506 of the user specifying another buffer.
509 text may be explicitly stored into the numeric buffers.
510 In this case, the buffer rotation occurs before the replacement of the buffer's
512 The numeric buffers are only available in
516 The following section describes the commands available in the command
520 The following words have a special meaning in the commands description:
522 .Bl -tag -width bigword -compact -offset 3u
524 A set of non-whitespace characters.
526 Temporary area where commands may place text.
527 If not specified, the default buffer is used.
532 A positive number used to specify the desired number of iterations
534 It defaults to 1 if not specified.
536 A cursor movement command which indicates the other end of the affected region
537 of text, the first being the current cursor position.
538 Repeating the command character makes it affect the whole current line.
540 A sequence of letters, digits or underscores.
546 if both present, may be specified in any order.
550 if both present, are effectively multiplied together
551 and considered part of the motion.
553 .Bl -tag -width Ds -compact
558 for the word starting at the cursor position.
567 Two lines of overlap are maintained, if possible.
578 is not given, scroll forward the number of lines specified by the last
585 command, scroll half the number of lines in the current screen.
593 lines, leaving the current line and column as is, if possible.
602 Two lines of overlap are maintained, if possible.
605 Display the following file information:
607 .Pq as given to Nm vi ;
608 whether the file has been modified since it was last written;
609 if the file is read-only;
610 the current line number;
611 the total number of lines in the file;
612 and the current line number as a percentage of the total lines in the file.
624 characters in the current line.
640 lines without changing the current column.
656 lines to the first non-blank character of that line.
668 lines, without changing the current column.
671 Return to the most recent tag context.
682 is not given, scroll backwards the number of lines specified by the last
689 command, scroll half the number of lines in the current screen.
692 Switch to the next lower screen in the window,
693 or to the first screen if there are no lower screens in the window.
701 lines, leaving the current line and column as is, if possible.
704 Suspend the current editor session.
709 command being entered, or cancel it if it is only partial.
712 Push a tag reference onto the tag stack.
715 Switch to the most recently edited file.
725 Move the cursor forward
727 characters without changing the current line.
732 .Ar motion shell-argument(s)
733 .Aq Li carriage-return
735 Replace the lines spanned by
740 .Pq standard output and standard error
741 of the program named by the
743 option, called with a
746 .Ar shell-argument(s)
747 .Pq bundled into a single argument .
749 .Ar shell-argument(s) ,
755 characters are expanded to the current file name,
756 the previous current file name,
757 and the command text of the previous
761 commands, respectively.
762 The special meaning of
767 can be overridden by escaping them with a backslash.
777 .Pq trailing So # Sc or So + Sc
780 the number under the cursor by
782 starting at the cursor position or at the first non-blank
783 character following it.
784 Numbers with a leading
788 are interpreted as hexadecimal numbers.
789 Numbers with a leading
791 are interpreted as octal numbers unless they contain a non-octal digit.
792 Other numbers may be prefixed with a
802 Move the cursor to the end of a line.
805 is specified, additionally move the cursor down
813 the one found at the cursor position or the closest to the right of it.
816 Repeat the previous substitution command on the current line.
819 .Cm \(aq Ns Aq Ar character
822 .Cm \` Ns Aq Ar character
824 Return to the cursor position marked by the character
832 to the position of the cursor before the last of the following commands:
850 The first form returns to the first non-blank character of the line marked by
852 The second form returns to the line and column marked by
865 sentences backward or forward, respectively.
866 A sentence is an area of text that begins with the first nonblank character
867 following the previous sentence, paragraph, or section
868 boundary and continues until the next period, exclamation point,
869 or question mark character, followed by any number of closing parentheses,
870 brackets, double or single quote characters, followed by
871 either an end-of-line or two whitespace characters.
872 Groups of empty lines
873 .Pq or lines containing only whitespace characters
874 are treated as a single sentence.
880 Reverse find character
881 .Pq i.e., the last Cm F , f , T No or Cm t No command
889 Move to the first non-blank character of the previous line,
899 command that modified text.
903 argument of the repeated command and that of the associated
909 command, the change log is rolled forward or backward, depending on the action
916 .Aq Li carriage-return
922 .Aq Li carriage-return
926 .Aq Li carriage-return
929 .Pf ?\& Ns Ar RE Ns ?\&
932 .Aq Li carriage-return
940 for a regular expression.
944 repeat the last search in the same or opposite directions, respectively.
947 is empty, the last search regular expression is used.
950 is specified, the cursor is placed
952 lines before or after the matched regular expression.
957 commands are used as motion components for the
959 command, there will be no prompt for the text of the command and the previous
962 Multiple search patterns may be grouped together by delimiting them with
963 semicolons and zero or more whitespace characters.
964 These patterns are evaluated from left to right with the final cursor position
965 determined by the last search pattern.
968 command may be appended to the closed search expressions to reposition the
972 Move to the first character in the current line.
983 Repeat the last character find
984 .Pq i.e., the last .Cm F , f , T No or Cm t No command
1000 lines left or right, respectively, by an amount of
1009 The buffer may include
1011 commands too, but they must be expressed as a
1020 then the last buffer executed shall be used.
1026 Enter input mode, appending the text after the end of the line.
1029 argument is given, the characters input are repeated
1031 \(mi 1 times after input mode is exited.
1045 Change text from the current position to the end-of-line.
1050 the deleted text into
1057 Delete text from the current position to the end-of-line.
1062 the deleted text into
1075 .Cm F Aq Ar character
1079 times backward through the current line for
1088 or the last line of the file if
1096 Move to the screen line
1098 \(mi 1 lines below the top of the screen.
1104 Enter input mode, inserting the text at the beginning of the line.
1108 the characters input are repeated
1118 lines with the current line.
1119 The spacing between two joined lines is set to two whitespace characters if the
1120 former ends with a question mark, a period or an exclamation point.
1121 It is set to one whitespace character otherwise.
1127 Move to the screen line
1129 \(mi 1 lines above the bottom of the screen.
1132 Move to the screen line in the middle of the screen.
1138 Enter input mode, appending text in a new line above the current line.
1142 the characters input are repeated
1152 before the current column if
1154 is character-oriented or before the current line if it is line-oriented.
1168 Enter input mode, replacing the characters in the current line.
1172 the characters input are repeated
1174 \(mi 1 more times upon exit from insert mode.
1188 the deleted text into
1198 times, through the current line for the character after the specified
1202 Restore the current line to its state before the cursor last moved to it.
1219 characters before the cursor, on the current line.
1224 the deleted text into
1239 Write the file and exit
1241 if there are no more files to edit.
1244 commands in a row ignores any remaining file to edit.
1263 Move to the first non-blank character on the current line.
1271 \(mi 1 lines, to the first non-blank character.
1277 Enter input mode, appending the text after the cursor.
1281 the characters input are repeated
1299 Change the region of text described by
1307 the changed text into
1316 Delete the region of text described by
1324 the deleted text into
1337 .Cm f Aq Ar character
1341 times, through the rest of the current line for
1348 Enter input mode, inserting the text before the cursor.
1352 the characters input are repeated
1360 Save the current context
1369 Enter input mode, appending text in a new line under the current line.
1373 the characters input are repeated
1383 Text is appended after the current column if
1385 is character oriented, or after the current line otherwise.
1404 characters in the current line starting with the current character.
1409 the substituted text into
1419 times, through the current line for the character immediately before
1423 Undo the last change made to the file.
1426 command alternates between these two states.
1429 command, when used immediately after
1431 causes the change log to be rolled forward or backward, depending on the action
1451 characters at the current cursor position, but no more than there are till the
1462 a text region specified by
1474 Redraw, optionally repositioning and resizing the screen.
1477 is specified, limit the screen size to
1482 characters may be used:
1487 is specified, place the line
1489 at the top of the screen.
1490 Otherwise, display the screen after the current screen.
1491 .It Aq Cm carriage-return
1494 at the top of the screen.
1498 in the center of the screen.
1502 at the bottom of the screen.
1507 display the screen before the screen before
1509 .Pq i.e., 2 screens before .
1510 Otherwise, display the screen before the current screen.
1527 position on the current line.
1531 move to the start of the current line.
1548 option is not set, reverse the case of the next
1557 reverses the case of the characters in a text region specified by the
1563 Interrupt the current operation.
1566 character is usually
1569 .Sh VI TEXT INPUT COMMANDS
1570 The following section describes the commands available in the text input mode
1575 .Bl -tag -width Ds -compact
1577 Replay the previous input.
1580 Erase to the previous
1584 .It Cm ^ Ns Aq Cm control-D
1585 Erase all of the autoindent characters, and reset the autoindent level.
1587 .It Cm 0 Ns Aq Cm control-D
1588 Erase all of the autoindent characters.
1595 characters to move forward to the next
1601 Erase the last character.
1603 .It Aq Cm literal next
1604 Escape the next character from any special meaning.
1607 character is usually
1611 Resolve all text input into the file, and return to command mode.
1613 .It Aq Cm line erase
1614 Erase the current line.
1617 .It Aq Cm word erase
1618 Erase the last word.
1619 The definition of word is dependent on the
1632 Insert a character with the specified hexadecimal value into the text.
1635 Interrupt text input mode, returning to command mode.
1638 character is usually
1642 The following section describes the commands available in the
1645 In each entry below, the tag line is a usage synopsis for the command.
1647 .Bl -tag -width Ds -compact
1648 .It Aq Cm end-of-file
1651 .It Cm !\& Ar argument(s)
1657 Execute a shell command, or filter lines through a shell command.
1664 .Cm nu Ns Op Cm mber
1674 Display the selected lines, each preceded with its line number.
1682 .Cm < Ns Op Cm < ...
1693 Display the line number of
1697 is not specified, display the line number of the last line in the file.
1701 .Cm > Ns Op Cm > ...
1708 .Cm ab Ns Op Cm breviate
1715 as an abbreviation for
1717 to the abbreviation list.
1721 .Cm a Ns Op Cm ppend Ns
1724 The input text is appended after the specified line.
1726 .It Cm ar Ns Op Cm gs
1727 Display the argument list.
1732 Background the current screen.
1736 .Cm c Ns Op Cm hange Ns
1740 The input text replaces the specified range.
1743 .Cm chd Ns Op Cm ir Ns
1751 Change the current working directory.
1765 Copy the specified lines after the destination
1769 .Cm cs Ns Op Cm cope
1770 .Cm add | find | help | kill | reset
1772 Execute a Cscope command.
1776 .Cm d Ns Op Cm elete
1781 Delete the lines from the file.
1784 .Cm di Ns Op Cm splay
1785 .Cm b Ns Oo Cm uffers Oc |
1786 .Cm c Ns Oo Cm onnections Oc |
1787 .Cm s Ns Oo Cm creens Oc |
1790 Display buffers, Cscope connections, screens or tags.
1805 Edit a different file.
1808 .Cm exu Ns Op Cm sage
1811 Display usage for an
1819 Display and optionally change the file name.
1828 Foreground the specified screen.
1832 .Cm g Ns Op Cm lobal
1833 .No / Ns Ar pattern Ns /
1839 .No / Ns Ar pattern Ns /
1842 Apply commands to lines matching
1848 .It Cm he Ns Op Cm lp
1849 Display a help message.
1853 .Cm i Ns Op Cm nsert Ns
1856 The input text is inserted before the specified line.
1860 .Cm j Ns Op Cm oin Ns
1865 Join lines of text together.
1873 Display the lines unambiguously.
1876 .Cm map Ns Op Cm !\&
1879 Define or display maps
1880 .Pq for Nm vi No only .
1889 .Cm k Aq Ar character
1891 Mark the line with the mark
1899 Move the specified lines after the target line.
1902 .Cm mk Ns Op Cm exrc Ns
1906 Write the abbreviations, editor options and maps to the specified
1915 Edit the next file from the argument list.
1919 .\" .Cm o Ns Op Cm pen
1920 .\" .No / Ns Ar pattern Ns /
1923 .\" Enter open mode.
1925 .It Cm pre Ns Op Cm serve
1926 Save the file in a form that can later be recovered using the
1933 .Cm rev Ns Op Cm ious Ns
1936 Edit the previous file from the argument list.
1944 Display the specified lines.
1951 Append buffer contents to the current line.
1954 .Cm q Ns Op Cm uit Ns
1957 End the editing session.
1961 .Cm r Ns Op Cm ead Ns
1968 .Cm rec Ns Op Cm over
1973 if it was previously saved.
1976 .Cm res Ns Op Cm ize
1977 .Op Cm + Ns | Ns Cm - Ns
1982 Grow or shrink the current screen.
1985 .Cm rew Ns Op Cm ind Ns
1988 Rewind the argument list.
1993 .Op option Oo = Oo value Oc Oc \ \&...
1995 .Pf \ \& Op nooption ...
1999 Display or set editor options.
2001 .It Cm sh Ns Op Cm ell
2002 Run a shell program.
2005 .Cm so Ns Op Cm urce
2010 commands from a file.
2014 .Cm s Ns Op Cm ubstitute
2016 .Op / Ar pattern No / Ar replace No /
2018 .Pf \ \& Op Ar options
2039 field may contain any of the following sequences:
2045 The replacement part of the previous
2049 If this is the entire
2051 pattern, the replacement part of the previous
2054 .It Sq \e Ns Ar \(sh
2057 is an integer from 1 to 9, the text matched by the
2058 .Ar # Ns 'th subexpression in
2061 Causes the characters up to the end of the line of the next occurrence of
2065 to be converted to lowercase.
2067 Causes the next character to be converted to lowercase.
2069 Causes the characters up to the end of the line of the next occurrence of
2073 to be converted to uppercase.
2075 Causes the next character to be converted to uppercase.
2079 .Cm su Ns Op Cm spend Ns
2083 .Cm st Ns Op Cm op Ns
2087 Suspend the edit session.
2090 character is usually
2099 Edit the file containing the specified tag.
2102 .Cm tagn Ns Op Cm ext Ns
2105 Edit the file containing the next context for the current tag.
2108 .Cm tagp Ns Op Cm op Ns
2110 .Op Ar file | number
2112 Pop to the specified tag in the tags stack.
2115 .Cm tagpr Ns Op Cm ev Ns
2118 Edit the file containing the previous context for the current tag.
2121 .Cm tagt Ns Op Cm op Ns
2124 Pop to the least recent tag on the tags stack, clearing the stack.
2127 .Cm una Ns Op Cm bbreviate
2132 Delete an abbreviation.
2134 .It Cm u Ns Op Cm ndo
2135 Undo the last change made to the file.
2138 .Cm unm Ns Op Cm ap Ns
2142 Unmap a mapped string.
2144 .It Cm ve Ns Op Cm rsion
2145 Display the version of the
2146 .Nm ex Ns / Ns Nm vi
2151 .Cm vi Ns Op Cm sual
2163 .Cm i Ns Op Cm sual Ns
2173 .Cm viu Ns Op Cm sage
2182 .Cm w Ns Op Cm rite Ns
2209 .Cm x Ns Op Cm it Ns
2214 writing the file if it has been modified.
2222 Copy the specified lines to a buffer.
2234 There are a large number of options that may be set
2236 to change the editor's behavior.
2237 This section describes the options, their abbreviations and their
2240 In each entry below, the first part of the tag line is the full name
2241 of the option, followed by any equivalent abbreviations.
2242 The part in square brackets is the default value of the option.
2243 Most of the options are boolean, i.e., they are either on or off,
2244 and do not have an associated value.
2246 Options apply to both
2250 modes, unless otherwise specified.
2252 .It Cm altwerase Bq off
2255 Select an alternate word erase algorithm.
2256 .It Cm autoindent , ai Bq off
2257 Automatically indent new lines.
2258 .It Cm autoprint , ap Bq on
2261 Display the current line automatically.
2262 .It Cm autowrite , aw Bq off
2263 Write modified files automatically when changing files or suspending the editor
2265 .It Cm backup Bq \&"\&"
2266 Back up files before they are overwritten.
2267 .It Cm beautify , bf Bq off
2268 Discard control characters.
2269 .It Cm cdpath Bo environment variable Ev CDPATH , or current directory Bc
2270 The directory paths used as path prefixes for the
2273 .It Cm cedit Bq no default
2274 Set the character to edit the colon command-line history.
2275 .It Cm columns , co Bq 80
2276 Set the number of columns in the screen.
2277 .It Cm comment Bq off
2280 Skip leading comments in shell, C and C++ language files.
2281 .It Cm directory , dir Bo environment variable Ev TMPDIR , or Pa /tmp Bc
2282 The directory where temporary files are created.
2283 .It Cm edcompatible , ed Bq off
2284 Remember the values of the
2290 commands, instead of initializing them as unset for each new command.
2291 .It Cm errorbells , eb Bq off
2294 Announce error messages with a bell.
2295 .It Cm escapetime Bq 1
2296 The tenths of a second
2297 .Nm ex Ns / Ns Nm vi
2298 waits for a subsequent key to complete an
2301 .It Cm exrc , ex Bq off
2302 Read the startup files in the local directory.
2303 .It Cm extended Bq off
2304 Use extended regular expressions
2306 rather than basic regular expressions
2310 for more information on regular expressions.
2311 .It Cm filec Bq Aq tab
2312 Set the character to perform file path completion on the colon command line.
2313 .It Cm fileencoding , fe Bq auto detect
2314 Set the encoding of the current file.
2316 Flash the screen instead of beeping the keyboard on error.
2317 .It Cm hardtabs, ht Bq 0
2318 Set the spacing between hardware tab settings.
2319 This option currently has no effect.
2320 .It Cm iclower Bq off
2321 Makes all regular expressions case-insensitive,
2322 as long as an upper-case letter does not appear in the search string.
2323 .It Cm ignorecase , ic Bq off
2324 Ignore case differences in regular expressions.
2325 .It Cm inputencoding , ie Bq locale
2326 Set the encoding of your input characters.
2328 The tenths of a second
2329 .Nm ex Ns / Ns Nm vi
2330 waits for a subsequent key to complete a key mapping.
2331 .It Cm leftright Bq off
2334 Do left-right scrolling.
2335 .It Cm lines , li Bq 24
2338 Set the number of lines in the screen.
2342 Modify various search commands and options to work with Lisp.
2343 This option is not yet implemented.
2345 Display lines in an unambiguous fashion.
2347 Attempt to get an exclusive lock on any file being edited, read or written.
2349 When turned off, all regular expression characters except for
2353 are treated as ordinary characters.
2354 Preceding individual characters by
2357 .It Cm matchchars Bq []{}()
2358 Character pairs looked for by the
2361 .It Cm matchtime Bq 7
2364 The tenths of a second
2365 .Nm ex Ns / Ns Nm vi
2366 pauses on the matching character when the
2370 Permit messages from other users.
2371 .It Cm msgcat Bq /usr/share/vi/catalog/
2372 Selects a message catalog to be used to display error and informational
2373 messages in a specified language.
2374 .It Cm modelines , modeline Bq off
2375 Read the first and last few lines of each file for
2378 This option will never be implemented.
2379 .It Cm noprint Bq \&"\&"
2380 Characters that are never handled as printable characters.
2381 .It Cm number , nu Bq off
2382 Precede each line displayed with its current line number.
2384 Display unknown characters as octal numbers, instead of the default
2389 If this option is not set, the
2393 commands are disallowed.
2394 .It Cm optimize , opt Bq on
2397 Optimize text throughput to dumb terminals.
2398 This option is not yet implemented.
2399 .It Cm paragraphs , para Bq "IPLPPPQPP LIpplpipbp"
2402 Define additional paragraph boundaries for the
2407 .It Cm path Bq \&"\&"
2408 Define additional directories to search for files being edited.
2409 .It Cm print Bq \&"\&"
2410 Characters that are always handled as printable characters.
2414 Display a command prompt.
2415 .It Cm readonly , ro Bq off
2416 Mark the file and session as read-only.
2417 .It Cm recdir Bq /var/tmp/vi.recover
2418 The directory where recovery files are stored.
2419 .It Cm redraw , re Bq off
2422 Simulate an intelligent terminal on a dumb one.
2423 This option is not yet implemented.
2425 Remap keys until resolved.
2427 Set the number of lines about which the editor reports changes or yanks.
2431 Display a row/column ruler on the colon command line.
2432 .It Cm scroll , scr Bq "window size / 2"
2433 Set the number of lines scrolled.
2434 .It Cm searchincr Bq off
2439 commands incremental.
2440 .It Cm sections , sect Bq "NHSHH HUnhsh"
2443 Define additional section boundaries for the
2448 .It Cm secure Bq off
2449 Turns off all access to external programs.
2450 .It Cm shell , sh Bo environment variable Ev SHELL , or Pa /bin/sh Bc
2451 Select the shell used by the editor.
2452 .It Cm shellmeta Bq ~{[*?$\`\(aq\&"\e
2453 Set the meta characters checked to determine if file name expansion
2455 .It Cm shiftwidth , sw Bq 8
2456 Set the autoindent and shift command indentation width.
2457 .It Cm showmatch , sm Bq off
2460 Note the left matching characters when the right ones are inserted.
2461 .It Cm showmode , smd Bq off
2464 Display the current editor mode and a
2467 .It Cm sidescroll Bq 16
2470 Set the amount a left-right scroll will shift.
2471 .It Cm slowopen , slow Bq off
2472 Delay display updating during text input.
2473 This option is not yet implemented.
2474 .It Cm sourceany Bq off
2475 Read startup files not owned by the current user.
2476 This option will never be implemented.
2477 .It Cm tabstop , ts Bq 8
2478 This option sets tab widths for the editor display.
2479 .It Cm taglength , tl Bq 0
2480 Set the number of significant characters in tag names.
2481 .It Cm tags , tag Bq tags
2482 Set the list of tags files.
2484 .Cm term , ttytype , tty
2485 .Bq environment variable Ev TERM
2487 Set the terminal type.
2489 This option has historically made editor messages less verbose.
2490 It has no effect in this implementation.
2491 .It Cm tildeop Bq off
2494 command to take an associated motion.
2495 .It Cm timeout , to Bq on
2496 Time out on keys which may be mapped.
2497 .It Cm ttywerase Bq off
2500 Select an alternate erase algorithm.
2501 .It Cm verbose Bq off
2504 Display an error message for every error.
2505 .It Cm w300 Bq no default
2508 Set the window size if the baud rate is less than 1200 baud.
2509 .It Cm w1200 Bq no default
2512 Set the window size if the baud rate is equal to 1200 baud.
2513 .It Cm w9600 Bq no default
2516 Set the window size if the baud rate is greater than 1200 baud.
2520 This option causes a warning message to be printed on the terminal
2521 if the file has been modified since it was last written, before a
2526 .Bq environment variable Ev LINES No \(mi 1
2528 Set the window size for the screen.
2529 .It Cm windowname Bq off
2530 Change the icon/window name to the current file name.
2531 .It Cm wraplen , wl Bq 0
2534 Break lines automatically,
2535 the specified number of columns from the left-hand margin.
2540 edit options are set, the
2543 .It Cm wrapmargin , wm Bq 0
2546 Break lines automatically,
2547 the specified number of columns from the right-hand margin.
2552 edit options are set, the
2555 .It Cm wrapscan , ws Bq on
2556 Set searches to wrap around the end or beginning of the file.
2557 .It Cm writeany , wa Bq off
2558 Turn off file-overwriting checks.
2561 .Bl -tag -width "COLUMNS"
2563 The number of columns on the screen.
2564 This value overrides any system or terminal specific values.
2567 environment variable is not set when
2568 .Nm ex Ns / Ns Nm vi
2571 option is explicitly reset by the user,
2572 .Nm ex Ns / Ns Nm vi
2573 enters the value into the environment.
2577 startup commands, read after
2583 The user's home directory, used as the initial directory path for the startup
2588 This value is also used as the default directory for the
2592 The number of rows on the screen.
2593 This value overrides any system or terminal specific values.
2596 environment variable is not set when
2597 .Nm ex Ns / Ns Nm vi
2600 option is explicitly reset by the user,
2601 .Nm ex Ns / Ns Nm vi
2602 enters the value into the environment.
2606 startup commands, read after
2609 The user's shell of choice
2610 .Pq see also the Cm shell No option .
2612 The user's terminal type.
2613 The default is the type
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.
2625 The location used to store temporary files
2626 .Pq see also the Cm directory No edit option .
2628 .Sh ASYNCHRONOUS EVENTS
2629 .Bl -tag -width "SIGWINCH" -compact
2631 .Nm vi Ns / Ns Nm ex
2632 uses this signal for periodic backups of file modifications and to display
2634 messages when operations are likely to take a long time.
2638 If the current buffer has changed since it was last written in its entirety,
2639 the editor attempts to save the modified file so it can be later recovered.
2641 .Nm vi Ns / Ns Nm ex
2642 reference manual section
2644 for more information.
2647 When an interrupt occurs, the current operation is halted
2648 and the editor returns to the command level.
2649 If interrupted during text input,
2650 the text already input is resolved into the file as if the text
2651 input had been normally terminated.
2654 The screen is resized.
2656 .Nm vi Ns / Ns Nm ex
2657 reference manual section
2658 .Sx Sizing the Screen
2659 for more information.
2663 .\" .Nm vi Ns / Ns Nm ex
2664 .\" ignores these signals.
2667 .Bl -tag -width "/var/tmp/vi.recover"
2669 The default user shell.
2676 commands first in the startup sequence.
2677 Must be owned by root or the user,
2678 and writable only by the owner.
2680 Temporary file directory.
2681 .It Pa /var/tmp/vi.recover
2682 The default recovery file directory.
2684 First choice for user's home directory startup file, read for
2686 commands right after
2693 Must be owned by root or the user,
2694 and writable only by the owner.
2696 Second choice for user's home directory startup file, read for
2698 commands under the same conditions as
2701 First choice for local directory startup file, read for
2703 commands at the end of the startup sequence if the
2705 option was turned on earlier.
2706 Must be owned by the user
2707 and writable only by the owner.
2709 Second choice for local directory startup file, read for
2711 commands under the same conditions as
2719 utilities exit 0 on success,
2720 and \*(Gt0 if an error occurs.
2726 .Nm nex Ns / Ns Nm nvi
2729 That document differs from historical
2730 .Nm ex Ns / Ns Nm vi
2731 practice in several places; there are changes to be made on both sides.
2735 editor first appeared in
2738 .Nm nex Ns / Ns Nm nvi
2739 replacements for the
2740 .Nm ex Ns / Ns Nm vi
2741 editor first appeared in
2745 wrote the original version of