| 1 | EX/VI REFERENCE MANUAL(1) BSD Reference Manual EX/VI REFERENCE MANUAL(1) |
| 2 | |
| 3 | N\bNA\bAM\bME\bE |
| 4 | e\bex\bx,\b, v\bvi\bi,\b, v\bvi\bie\bew\bw - text editors |
| 5 | |
| 6 | D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN |
| 7 | V\bVi\bi is a screen oriented text editor. E\bEx\bx is a line-oriented text editor. |
| 8 | E\bEx\bx and v\bvi\bi are different interfaces to the same program, and it is possi- |
| 9 | ble to switch back and forth during an edit session. V\bVi\bie\bew\bw is the equiva- |
| 10 | lent of using the -\b-R\bR (read-only) option of v\bvi\bi. |
| 11 | |
| 12 | This reference manual is the one provided with the n\bne\bex\bx/\b/n\bnv\bvi\bi versions of |
| 13 | the e\bex\bx/\b/v\bvi\bi text editors. N\bNe\bex\bx/\b/n\bnv\bvi\bi are intended as bug-for-bug compatible |
| 14 | replacements for the original Fourth Berkeley Software Distribution |
| 15 | (4BSD) e\bex\bx and v\bvi\bi programs. This reference manual is accompanied by a |
| 16 | traditional-style manual page. That manual page describes the function- |
| 17 | ality found in e\bex\bx/\b/v\bvi\bi in far less detail than the description here. In |
| 18 | addition, it describes the system interface to e\bex\bx/\b/v\bvi\bi, e.g. command line |
| 19 | options, environmental variables, and similar things. |
| 20 | |
| 21 | This reference is intended for users already familiar with e\bex\bx/\b/v\bvi\bi. Anyone |
| 22 | else should almost certainly read a good tutorial on the editor first. |
| 23 | If you're in an unfamiliar environment, and you absolutely have to get |
| 24 | work done immediately, see the section entitled FAST STARTUP in the manu- |
| 25 | al page. It's probably enough to get you going. |
| 26 | |
| 27 | For the rest of this reference, n\bne\bex\bx/\b/n\bnv\bvi\bi is used only when it's necessary |
| 28 | to distinguish it from the historic implementations of e\bex\bx/\b/v\bvi\bi. |
| 29 | |
| 30 | A\bAD\bDD\bDI\bIT\bTI\bIO\bON\bNA\bAL\bL F\bFE\bEA\bAT\bTU\bUR\bRE\bES\bS |
| 31 | There are a few features in n\bne\bex\bx/\b/n\bnv\bvi\bi that are not found in historic ver- |
| 32 | sions of e\bex\bx/\b/v\bvi\bi. A list of those features is as follows: |
| 33 | |
| 34 | 8-bit clean data, large lines, files |
| 35 | N\bNv\bvi\bi/\b/n\bne\bex\bx will edit any format file. Line lengths are limited by |
| 36 | available memory, and file sizes are limited by available disk |
| 37 | space. The command ``^Vx[0-9A-Fa-f]*'', in input mode, will in- |
| 38 | sert any legal character value into the text. |
| 39 | |
| 40 | Split screens |
| 41 | The command ``:sp[lit] [file ...]'' splits the screen in vi mode. |
| 42 | The key ``^W'' switches between the foreground screens, and the |
| 43 | ``:resize count'' command can be used to grow or shrink a partic- |
| 44 | ular screen. |
| 45 | |
| 46 | Background and foreground screens |
| 47 | The command ``:bg'' backgrounds the current screen, and the com- |
| 48 | mand ``:fg [file]'' foregrounds the backgrounded screen that is |
| 49 | editing the specified file, or, by default, the first background |
| 50 | screen on the queue. The command ``:di[splay] s[creens]'' lists |
| 51 | the background screens. |
| 52 | |
| 53 | Shell screens |
| 54 | The command ``:sc[ript] [file ...]'' runs a shell in the screen. |
| 55 | Editing is unchanged, with the exception that a <carriage-return> |
| 56 | enters the current line (stripped of any prompt) as input to the |
| 57 | shell. |
| 58 | |
| 59 | Tag stacks |
| 60 | Tags are now maintained in a stack. The command ``^T'' returns |
| 61 | to the previous tag location. The command ``:tagpop [number |
| 62 | file]'' returns to the most recent tag location by default, or, |
| 63 | optionally to a specific tag number in the tag stack, or the most |
| 64 | recent tag from the specified file. Use the command ``:di[splay] |
| 65 | t[ags]'' to view the tags stack. The command ``:tagtop'' returns |
| 66 | |
| 67 | to the top of the tag stack. |
| 68 | |
| 69 | New displays |
| 70 | The command ``:di[splay] b[uffers] s[creens] t[ags]'' can be |
| 71 | used to display, respectively, the current cut buffers, the back- |
| 72 | grounded screens, and the tags stack. |
| 73 | |
| 74 | Infinite undo |
| 75 | The changes made during an edit session may be rolled backward |
| 76 | and forward. A '.' command immediately after a 'u' command con- |
| 77 | tinues either forward or backward depending on whether the 'u' |
| 78 | command was an undo or a redo. |
| 79 | |
| 80 | Usage information |
| 81 | The command ``:exu[sage] [cmd]'' and ``viu[sage] [key]'' provide |
| 82 | usage information for all of the ex and vi commands by default, |
| 83 | or, optionally, for a specific command or key. |
| 84 | |
| 85 | Extended regular expressions |
| 86 | The ``:set extended'' command treats search and other command |
| 87 | regular expressions as extended (egrep(1) style) regular expres- |
| 88 | sions. |
| 89 | |
| 90 | Word search |
| 91 | The command ``^A'' searches for the word referenced by the cur- |
| 92 | sor. |
| 93 | |
| 94 | Number increment |
| 95 | The command ``#'' increments the number referenced by the cursor. |
| 96 | |
| 97 | Previous file |
| 98 | The command ``:prev[ious][!]'' edits the previous file from the |
| 99 | argument list. |
| 100 | |
| 101 | Left-Right scrolling |
| 102 | The command ``:set leftright'' makes n\bnv\bvi\bi do left-right screen |
| 103 | scrolling, instead of the traditional v\bvi\bi line wrapping. |
| 104 | |
| 105 | R\bRE\bEC\bCO\bOV\bVE\bER\bRY\bY |
| 106 | There is no recovery program for n\bnv\bvi\bi, nor does n\bnv\bvi\bi run setuid. Users may |
| 107 | recover any file which they may read, and the superuser may recover any |
| 108 | edit session. |
| 109 | |
| 110 | Edit sessions are backed by files in _\b/_\bv_\ba_\br_\b/_\bt_\bm_\bp_\b/_\bv_\bi_\b._\br_\be_\bc_\bo_\bv_\be_\br, and are named |
| 111 | ``vi.XXXX'', where ``XXXX'' is a number related to the process id. When |
| 112 | a file is first modified, a second file, which contains an email message |
| 113 | for the user, is created, and is named ``recover.XXXX'', where, again, |
| 114 | ``XXXX'' is associated with the process id. Both files are removed at |
| 115 | the end of a normal edit session, but will remain if the edit session is |
| 116 | abnormally terminated or the user enters the ex/vi ``preserve'' command. |
| 117 | The use of the _\b/_\bv_\ba_\br_\b/_\bt_\bm_\bp directory may be changed setting the r\bre\bec\bcd\bdi\bir\br op- |
| 118 | tion in the user's or system startup information. |
| 119 | |
| 120 | The recovery directory should have the ``sticky-bit'' set so that only |
| 121 | the owners of files may remove them. If this is not possible on the sys- |
| 122 | tem, then a pseudo-user should own the recovery directory. The recovery |
| 123 | directory must be both read and write-able by any user. |
| 124 | |
| 125 | The recovery file has all of the necessary information in it to enable |
| 126 | the user to recover the edit session. In addition, it has all of the |
| 127 | necessary email headers for sendmail. When the system is rebooted, all |
| 128 | of the files in _\b/_\bv_\ba_\br_\b/_\bt_\bm_\bp_\b/_\bv_\bi_\b._\br_\be_\bc_\bo_\bv_\be_\br named ``recover.XXXX'' should be sent |
| 129 | by email, using the -\b-t\bt flag of sendmail (or a similar mechanism in other |
| 130 | mailers). A simple way to do this is to insert the following script into |
| 131 | |
| 132 | your _\b/_\be_\bt_\bc_\b/_\br_\bc_\b._\bl_\bo_\bc_\ba_\bl (or other startup) file: |
| 133 | virecovery=`echo /var/tmp/vi.recover/recover.*` |
| 134 | if [ "$virecovery" != "/var/tmp/vi.recover/recover.*" ]; then |
| 135 | echo 'Recovering vi editor sessions' |
| 136 | for i in $virecovery; do |
| 137 | sendmail -t < $i |
| 138 | done |
| 139 | fi |
| 140 | |
| 141 | If e\bex\bx/\b/v\bvi\bi receives a hangup (SIGHUP) signal, it will email the recovery |
| 142 | information to the user itself. |
| 143 | |
| 144 | If you don't have the sendmail program on your system, the source file |
| 145 | _\bn_\bv_\bi_\b/_\br_\be_\bc_\bo_\bv_\be_\br_\b._\bc will have to be modified to use your local mail delivery |
| 146 | programs. |
| 147 | |
| 148 | S\bST\bTA\bAR\bRT\bTU\bUP\bP I\bIN\bNF\bFO\bOR\bRM\bMA\bAT\bTI\bIO\bON\bN |
| 149 | E\bEx\bx/\b/v\bvi\bi interprets one of two possible environmental variables and reads up |
| 150 | to three of five possible files during startup. The variables and files |
| 151 | are expected to contain e\bex\bx commands, not v\bvi\bi commands. In addition, they |
| 152 | are interpreted _\bb_\be_\bf_\bo_\br_\be the file to be edited is read, and therefore many |
| 153 | e\bex\bx commands may not be used. Generally, any command that requires output |
| 154 | to the screen or that needs a file upon which to operate, will cause an |
| 155 | error if included in a startup file or environmental variable. |
| 156 | |
| 157 | First, the file _\b/_\be_\bt_\bc_\b/_\bv_\bi_\b._\be_\bx_\br_\bc is read. Second, the environmental variable |
| 158 | NEXINIT (or the variable EXINIT, if NEXINIT isn't set) is interpreted. |
| 159 | Third, if neither NEXINIT or EXINIT was set, the file _\b$_\bH_\bO_\bM_\bE_\b/_\b._\bn_\be_\bx_\br_\bc (or |
| 160 | the file _\b$_\bH_\bO_\bM_\bE_\b/_\b._\be_\bx_\br_\bc, if _\b$_\bH_\bO_\bM_\bE_\b/_\b._\bn_\be_\bx_\br_\bc doesn't exist) is read. Fourth, |
| 161 | the file _\b._\bn_\be_\bx_\br_\bc (or the file _\b._\be_\bx_\br_\bc, if _\b._\bn_\be_\bx_\br_\bc doesn't exist) is read. |
| 162 | |
| 163 | Startup files will not be read if they are owned by anyone other than the |
| 164 | real user-id of the user running v\bvi\bi, (or by ``root'' in the case of the |
| 165 | file _\b/_\be_\bt_\bc_\b/_\bv_\bi_\b._\be_\bx_\br_\bc) or if they are writable by anyone other than the own- |
| 166 | er. Home directory startup files (i.e. _\b$_\bH_\bO_\bM_\bE_\b/_\b._\bn_\be_\bx_\br_\bc and _\b$_\bH_\bO_\bM_\bE_\b/_\b._\be_\bx_\br_\bc) |
| 167 | will not be read if the ``HOME'' environmental variable is not set. Lo- |
| 168 | cal startup files (i.e. _\b._\bn_\be_\bx_\br_\bc and _\b._\be_\bx_\br_\bc) will not be read if the e\bex\bxr\brc\bc |
| 169 | option is turned off in the _\b/_\be_\bt_\bc_\b/_\bv_\bi_\b._\be_\bx_\br_\bc, _\b$_\bH_\bO_\bM_\bE_\b/_\b._\bn_\be_\bx_\br_\bc, or _\b$_\bH_\bO_\bM_\bE_\b/_\b._\be_\bx_\br_\bc |
| 170 | files, or in the NEXINIT or EXINIT environmental variables. It is not an |
| 171 | error for any of the startup environmental variables or files not to ex- |
| 172 | ist. |
| 173 | |
| 174 | Because the e\bex\bx command set supported by n\bne\bex\bx/\b/n\bnv\bvi\bi is a superset of the com- |
| 175 | mand set supported by most historical implementations of e\bex\bx, n\bne\bex\bx/\b/n\bnv\bvi\bi can |
| 176 | use the startup files created for the historical implementations, but the |
| 177 | converse is often not true. |
| 178 | |
| 179 | S\bSI\bIZ\bZI\bIN\bNG\bG T\bTH\bHE\bE S\bSC\bCR\bRE\bEE\bEN\bN |
| 180 | The size of the screen can be set in a number of ways. E\bEx\bx/\b/v\bvi\bi takes the |
| 181 | following steps until values are obtained for both the number of rows and |
| 182 | number of columns in the screen. |
| 183 | |
| 184 | 1. If the environmental variable LINES exists, it is used to specify |
| 185 | the number of rows in the screen. |
| 186 | 2. If the environmental variable COLUMNS exists, it is used to specify |
| 187 | the number of columns in the screen. |
| 188 | 3. The TIOCGWINSZ ioctl(2) is attempted on the standard error file de- |
| 189 | scriptor. |
| 190 | 4. The termcap entry is checked for the ``li'' entry (rows) and the |
| 191 | ``co'' entry (columns). |
| 192 | 5. The number of rows is set to 24, and the number of columns is set to |
| 193 | 80. |
| 194 | |
| 195 | If a window change size signal (SIGWINCH) is received, the same steps are |
| 196 | taken with the exception that the first two steps are skipped. |
| 197 | |
| 198 | R\bRE\bEG\bGU\bUL\bLA\bAR\bR E\bEX\bXP\bPR\bRE\bES\bSS\bSI\bIO\bON\bNS\bS A\bAN\bND\bD R\bRE\bEP\bPL\bLA\bAC\bCE\bEM\bME\bEN\bNT\bT S\bST\bTR\bRI\bIN\bNG\bGS\bS |
| 199 | Regular expressions are used in line addresses, as the first part of |
| 200 | s\bsu\bub\bbs\bst\bti\bit\btu\but\bte\be, g\bgl\blo\bob\bba\bal\bl, and v\bvg\bgl\blo\bob\bba\bal\bl commands, and in search patterns. |
| 201 | |
| 202 | The regular expressions supported by e\bex\bx and v\bvi\bi are, by default, the Basic |
| 203 | Regular Expressions (BRE's) described in the IEEE POSIX Standard 1003.2. |
| 204 | The e\bex\bxt\bte\ben\bnd\bde\bed\bd option causes all regular expressions to be interpreted as |
| 205 | the Extended Regular Expressions (ERE's) described by the same standard. |
| 206 | (See re_format(7) for more information. Generally speaking, BRE's are |
| 207 | ed(1) and grep(1) style regular expressions, and ERE's are egrep(1) style |
| 208 | regular expressions.) |
| 209 | |
| 210 | There are some special strings and characters that can be used in RE's: |
| 211 | 1. An empty RE (e.g. ``//'') is equivalent to the last RE used. |
| 212 | 2. The construct ``\<'' matches the beginning of a word. |
| 213 | 3. The construct ``\>'' matches the end of a word. |
| 214 | 4. The character ``~'' matches the replacement part of the last |
| 215 | s\bsu\bub\bbs\bst\bti\bit\btu\but\bte\be command. |
| 216 | |
| 217 | When the m\bma\bag\bgi\bic\bc option is _\bn_\bo_\bt set, the only characters with special mean- |
| 218 | ings are ``^'' at the beginning of an RE, ``$'' at the end of an RE, and |
| 219 | the escaping character ``\''. The characters ``.'', ``*'', ``['', and |
| 220 | ``~'' are treated as ordinary characters unless preceded by a ``\''; when |
| 221 | preceded by a ``\'' they regain their special meaning. |
| 222 | |
| 223 | Replacement strings are the second part of a s\bsu\bub\bbs\bst\bti\bit\btu\but\bte\be command. |
| 224 | |
| 225 | The character ``&'' (or ``\&'' if the m\bma\bag\bgi\bic\bc option is _\bn_\bo_\bt set) in the re- |
| 226 | placement string stands for the text matched by the RE that's being re- |
| 227 | placed. The character ``~'' (or ``\~'' if the m\bma\bag\bgi\bic\bc option is _\bn_\bo_\bt set) |
| 228 | stands for the replacement part of the previous s\bsu\bub\bbs\bst\bti\bit\btu\but\bte\be command. |
| 229 | |
| 230 | The string ``\#'', where ``#'' is an integer value from 1 to 9, stands |
| 231 | for the text matched by the portion of the RE enclosed in the #'th set of |
| 232 | escaped parentheses, e.g. ``\('' and ``\)''. For example, |
| 233 | ``s/abc\(.*\)def/\1/'' deletes the strings ``abc'' and ``def'' from the |
| 234 | matched pattern. |
| 235 | |
| 236 | The strings ``\l'', ``\u'', ``\L'', and ``\U'' can be used to modify the |
| 237 | case of elements in the replacement string. The string ``\l'' causes the |
| 238 | next character to be converted to lowercase; the string ``\u'' behaves |
| 239 | similarly, but converts to uppercase. The strings ``\L'' causes charac- |
| 240 | ters up to the end of the string or the next occurrence of the strings |
| 241 | ``\e'' or ``\E'' to be converted to lowercase; the string ``\U'' behaves |
| 242 | similarly, but converts to uppercase. |
| 243 | |
| 244 | In v\bvi\bi, inserting a <control-M> into the replacement string will cause the |
| 245 | matched line to be split into two lines at that point. |
| 246 | |
| 247 | S\bSE\bET\bT O\bOP\bPT\bTI\bIO\bON\bNS\bS |
| 248 | There are a large number of options that may be set (or unset) to change |
| 249 | the editor's behavior. This section describes the options, their abbre- |
| 250 | viations and their default values. |
| 251 | |
| 252 | In each entry below, the first part of the tag line is the full name of |
| 253 | the option, followed by any equivalent abbreviations. (Regardless of the |
| 254 | abbreviations, it is only necessary to use the minimum number of charac- |
| 255 | ters necessary to distinguish an abbreviation from all other commands for |
| 256 | it to be accepted, in n\bne\bex\bx/\b/n\bnv\bvi\bi. Historically, only the full name and the |
| 257 | official abbreviations were accepted by e\bex\bx/\b/v\bvi\bi. Using full names in your |
| 258 | startup files and environmental variables will probably make them more |
| 259 | portable.) The part in square brackets is the default value of the op- |
| 260 | tion. Most of the options are boolean, i.e. they are either on or off, |
| 261 | and do not have an associated value. |
| 262 | |
| 263 | |
| 264 | Options apply to both e\bex\bx and v\bvi\bi modes, unless otherwise specified. |
| 265 | |
| 266 | For information on modifying the options or to display the options and |
| 267 | their current values, see the ``set'' command in the Ex Commands section. |
| 268 | altwerase [off] |
| 269 | V\bVi\bi only. Change how v\bvi\bi does word erase during text input. When |
| 270 | this option is set, text is broken up into three classes: alphabet- |
| 271 | ic, numeric and underscore characters, other non-blank characters, |
| 272 | and blank characters. Changing from one class to another marks the |
| 273 | end of a word. In addition, the class of the first character |
| 274 | erased is ignored (which is exactly what you want when erasing |
| 275 | pathname components). |
| 276 | autoindent, ai [off] |
| 277 | If this option is set, whenever you create a new line (using the v\bvi\bi |
| 278 | A\bA, a\ba, C\bC, c\bc, I\bI, i\bi, O\bO, o\bo, R\bR, r\br, S\bS, and s\bs commands, or the e\bex\bx a\bap\bpp\bpe\ben\bnd\bd, |
| 279 | c\bch\bha\ban\bng\bge\be, and i\bin\bns\bse\ber\brt\bt commands) the new line is automatically indented |
| 280 | to align the cursor with the first non-blank character of the line |
| 281 | from which you created it. Lines are indented using tab characters |
| 282 | to the extent possible (based on the value of the t\bta\bab\bbs\bst\bto\bop\bp option) |
| 283 | and then using space characters as necessary. For commands insert- |
| 284 | ing text into the middle of a line, any blank characters to the |
| 285 | right of the cursor are discarded, and the first non-blank charac- |
| 286 | ter to the right of the cursor is aligned as described above. |
| 287 | |
| 288 | The indent characters are themselves somewhat special. If you do |
| 289 | not enter more characters on the new line before moving moving to |
| 290 | another line, or entering <escape>, the indent character will be |
| 291 | deleted and the line will be empty. For example, if you enter |
| 292 | <carriage-return> twice in succession, the line created by the |
| 293 | first <carriage-return> will not have any characters in it, regard- |
| 294 | less of the indentation of the previous or subsequent line. |
| 295 | |
| 296 | Indent characters also require that you enter additional erase |
| 297 | characters to delete them. For example, if you have an indented |
| 298 | line, containing only blanks, the first <word-erase> character you |
| 299 | enter will erase up to end of the indent characters, and the second |
| 300 | will erase back to the beginning of the line. (Historically, only |
| 301 | the ^\b^D\bD key would erase the indent characters. Both the ^\b^D\bD key and |
| 302 | the usual erase keys work in n\bnv\bvi\bi .\b.)\b) In addition, if the cursor is |
| 303 | positioned at the end of the indent characters, the keys ``0^D'' |
| 304 | will erase all of the indent characters for the current line, re- |
| 305 | setting the indentation level to 0. Similarly, the keys ``^^D'' |
| 306 | (i.e. a carat followed by a <control-D>) will erase all of the in- |
| 307 | dent characters for the current line, leaving the indentation level |
| 308 | for future created lines unaffected. |
| 309 | |
| 310 | Finally, if a\bau\but\bto\boi\bin\bnd\bde\ben\bnt\bt is set, the S\bS and c\bcc\bc commands change from |
| 311 | the first non-blank of the line to the end of the line, instead of |
| 312 | from the beginning of the line to the end of the line. |
| 313 | autoprint, ap [off] |
| 314 | E\bEx\bx only. E\bEx\bx only. Cause the current line to be automatically dis- |
| 315 | played after the e\bex\bx commands <\b<, >\b>, c\bco\bop\bpy\by, d\bde\bel\ble\bet\bte\be, j\bjo\boi\bin\bn, m\bmo\bov\bve\be, p\bpu\but\bt, |
| 316 | t\bt, U\bUn\bnd\bdo\bo, and u\bun\bnd\bdo\bo. This automatic display is suppressed during |
| 317 | g\bgl\blo\bob\bba\bal\bl and v\bvg\bgl\blo\bob\bba\bal\bl commands, and for any command where optional |
| 318 | flags are used to explicitly display the line. |
| 319 | autowrite, aw [off] |
| 320 | If this option is set, the v\bvi\bi !\b! ^\b^^\b^ ^\b^]\b] and ^\b^Z\bZ commands, and the e\bex\bx |
| 321 | e\bed\bdi\bit\bt, n\bne\bex\bxt\bt, r\bre\bew\bwi\bin\bnd\bd, s\bst\bto\bop\bp, s\bsu\bus\bsp\bpe\ben\bnd\bd, t\bta\bag\bg, t\bta\bag\bgp\bpo\bop\bp, and t\bta\bag\bgt\bto\bop\bp commands |
| 322 | automatically write the current file back to the current file name |
| 323 | if it has been modified since it was last written. If the write |
| 324 | fails, the command fails and goes no further. |
| 325 | |
| 326 | Appending the optional force flag ``!'' to the e\bex\bx commands n\bne\bex\bxt\bt, |
| 327 | r\bre\bew\bwi\bin\bnd\bd, s\bst\bto\bop\bp, s\bsu\bus\bsp\bpe\ben\bnd\bd, t\bta\bag\bg, t\bta\bag\bgp\bpo\bop\bp, and t\bta\bag\bgt\bto\bop\bp stops the automatic |
| 328 | write from being attempted. |
| 329 | |
| 330 | |
| 331 | (Historically, the n\bne\bex\bxt\bt command ignored the optional force flag.) |
| 332 | Note, the e\bex\bx commands e\bed\bdi\bit\bt, q\bqu\bui\bit\bt, s\bsh\bhe\bel\bll\bl, and x\bxi\bit\bt are _\bn_\bo_\bt affected |
| 333 | by the a\bau\but\bto\bow\bwr\bri\bit\bte\be option. |
| 334 | beautify, bf [off] |
| 335 | If this option is set, all control characters that are not current- |
| 336 | ly being specially interpreted, other than <tab>, <newline>, and |
| 337 | <form-feed>, are discarded from commands read in by e\bex\bx from command |
| 338 | files, and from input text entered to v\bvi\bi (either into the file or |
| 339 | to the colon command line). Text files read by e\bex\bx/\b/v\bvi\bi are _\bn_\bo_\bt af- |
| 340 | fected by the b\bbe\bea\bau\but\bti\bif\bfy\by option. |
| 341 | cdpath [environment variable CDPATH, or ``.''] |
| 342 | This option is used to specify a colon separated list of directo- |
| 343 | ries which are used as path prefixes for any relative path names |
| 344 | used as arguments for the c\bcd\bd command. The value of this option de- |
| 345 | faults to the value of the environmental variable CDPATH if it is |
| 346 | set, otherwise to the current directory. For compatibility with |
| 347 | the POSIX 1003.2 shell, the c\bcd\bd command does _\bn_\bo_\bt check the current |
| 348 | directory as a path prefix for relative path names unless it is ex- |
| 349 | plicitly specified. It may be so specified by entering an empty |
| 350 | string or a ``.'' into the CDPATH variable or the option value. |
| 351 | columns, co [80] |
| 352 | The number of columns in the screen. Setting this option causes |
| 353 | e\bex\bx/\b/v\bvi\bi to set (or reset) the environmental variable COLUMNS. See the |
| 354 | SCREEN SIZING section for more information. |
| 355 | comment [off] |
| 356 | V\bVi\bi only. If the first non-empty line of the file begins with the |
| 357 | string ``/*'', this option causes v\bvi\bi to skip to the end of that C |
| 358 | comment (probably a terribly boring legal notice) before displaying |
| 359 | the file. |
| 360 | directory, dir [environment variable TMPDIR, or /tmp] |
| 361 | The directory where temporary files are created. The environmental |
| 362 | variable TMPDIR is used as the default value if it exists, other- |
| 363 | wise _\b/_\bt_\bm_\bp is used. |
| 364 | edcompatible, ed [off] |
| 365 | This option causes the presence or absence of g\bg and c\bc suffixes on |
| 366 | s\bsu\bub\bbs\bst\bti\bit\btu\but\bte\be commands to be remembered, and to be toggled by repeat- |
| 367 | ing the suffices. The suffix r\br makes the substitution be as in the |
| 368 | ~\b~ command, instead of like the &\b& command. |
| 369 | _\bT_\bh_\bi_\bs _\bo_\bp_\bt_\bi_\bo_\bn _\bi_\bs _\bn_\bo_\bt _\by_\be_\bt _\bi_\bm_\bp_\bl_\be_\bm_\be_\bn_\bt_\be_\bd_\b. |
| 370 | errorbells, eb [off] |
| 371 | E\bEx\bx only. Causes e\bex\bx error messages to be preceded by a bell. |
| 372 | _\bT_\bh_\bi_\bs _\bo_\bp_\bt_\bi_\bo_\bn _\bi_\bs _\bn_\bo_\bt _\by_\be_\bt _\bi_\bm_\bp_\bl_\be_\bm_\be_\bn_\bt_\be_\bd_\b. |
| 373 | exrc, ex [off] |
| 374 | If this option is turned off in the system or $HOME startup files, |
| 375 | the local startup files are never read (unless they are the same as |
| 376 | the system or $HOME startup files). Turning it on has no effect, |
| 377 | i.e. the normal checks for local startup files are performed, re- |
| 378 | gardless. See the STARTUP INFORMATION section for more informa- |
| 379 | tion. |
| 380 | extended [off] |
| 381 | This option causes all regular expressions to be treated as POSIX |
| 382 | 1003.2 extended regular expressions (which are similar to historic |
| 383 | egrep(1) style expressions). |
| 384 | flash [on] |
| 385 | This option causes the screen to flash instead of beeping the key- |
| 386 | board, on error, if the terminal has the capability. |
| 387 | hardtabs, ht [8] |
| 388 | This option defines the spacing between hardware tab settings, i.e. |
| 389 | the tab expansion done by the operating system and/or the terminal |
| 390 | itself. As n\bne\bex\bx/\b/n\bnv\bvi\bi never writes tabs to the terminal, unlike his- |
| 391 | toric versions of e\bex\bx/\b/v\bvi\bi, this option does not currently have any |
| 392 | affect. |
| 393 | ignorecase, ic [off] |
| 394 | This option causes regular expressions, both in e\bex\bx commands and in |
| 395 | |
| 396 | searches, to be evaluated in a case-insensitive manner. |
| 397 | keytime [6] |
| 398 | The 10th's of a second e\bex\bx/\b/v\bvi\bi waits for a subsequent key to complete |
| 399 | a key mapping. |
| 400 | leftright [off] |
| 401 | V\bVi\bi only. This option causes the screen to be scrolled left-right |
| 402 | to view lines longer than the screen, instead of the traditional v\bvi\bi |
| 403 | screen interface which folds long lines at the right-hand margin of |
| 404 | the terminal. |
| 405 | lines, li [24] |
| 406 | V\bVi\bi only. The number of lines in the screen. Setting this option |
| 407 | causes e\bex\bx/\b/v\bvi\bi to set (or reset) the environmental variable LINES. |
| 408 | See the Screen Sizing section for more information. |
| 409 | lisp [off] |
| 410 | V\bVi\bi only. This option changes the behavior of the v\bvi\bi (\b(, )\b), {\b{, }\b}, [\b[[\b[ |
| 411 | and ]\b]]\b] commands to match the Lisp language. Also, the a\bau\but\bto\boi\bin\bnd\bde\ben\bnt\bt |
| 412 | option's behavior is changed to be appropriate for Lisp. |
| 413 | _\bT_\bh_\bi_\bs _\bo_\bp_\bt_\bi_\bo_\bn _\bi_\bs _\bn_\bo_\bt _\by_\be_\bt _\bi_\bm_\bp_\bl_\be_\bm_\be_\bn_\bt_\be_\bd_\b. |
| 414 | list [off] |
| 415 | This option causes lines to be displayed in an unambiguous fashion. |
| 416 | Specifically, tabs are displayed as control characters, i.e. |
| 417 | ``^I'', and the ends of lines are marked with a ``$'' character. |
| 418 | magic [on] |
| 419 | This option is on by default. Turning the m\bma\bag\bgi\bic\bc option off causes |
| 420 | all regular expression characters except for ``^'' and ``$'', to be |
| 421 | treated as ordinary characters. To re-enable characters individu- |
| 422 | ally, when the m\bma\bag\bgi\bic\bc option is off, precede them with an ``\''. See |
| 423 | the REGULAR EXPRESSIONS AND REPLACEMENT STRINGS section for more |
| 424 | information. |
| 425 | matchtime [7] |
| 426 | V\bVi\bi only. The 10th's of a second e\bex\bx/\b/v\bvi\bi pauses on the matching char- |
| 427 | acter when the s\bsh\bho\bow\bwm\bma\bat\btc\bch\bh option is set. |
| 428 | mesg [on] |
| 429 | This option allows other users to contact you using the talk(1) and |
| 430 | write(1) utilities, while you are editing. E\bEx\bx/\b/v\bvi\bi does not turn |
| 431 | message on, i.e. if messages were turned off when the editor was |
| 432 | invoked, they will stay turned off. This option only permits you |
| 433 | to disallow messages for the edit session. See the mesg(1) utility |
| 434 | for more information. |
| 435 | modelines, modeline [off] |
| 436 | If the m\bmo\bod\bde\bel\bli\bin\bne\bes\bs option is set, e\bex\bx/\b/v\bvi\bi has historically scanned the |
| 437 | first and last five lines of each file as it is read for editing, |
| 438 | looking for any e\bex\bx commands that have been placed in those lines. |
| 439 | After the startup information has been processed, and before the |
| 440 | user starts editing the file, any commands embedded in the file are |
| 441 | executed. Commands are recognized by the letters ``e'' or ``v'' |
| 442 | followed by ``x'' or ``i'', at the beginning of a line or following |
| 443 | a tab or space character, and followed by a ``:'', an e\bex\bx command, |
| 444 | and another ``:''. This option is a security problem of immense |
| 445 | proportions, and should not be used under any circumstances. |
| 446 | _\bT_\bh_\bi_\bs _\bo_\bp_\bt_\bi_\bo_\bn _\bw_\bi_\bl_\bl _\bn_\be_\bv_\be_\br _\bb_\be _\bi_\bm_\bp_\bl_\be_\bm_\be_\bn_\bt_\be_\bd_\b. |
| 447 | number, nu [off] |
| 448 | Precede each line displayed with its current line number. |
| 449 | open [on] |
| 450 | E\bEx\bx only. If this option is not set, the o\bop\bpe\ben\bn and v\bvi\bis\bsu\bua\bal\bl commands |
| 451 | are disallowed. |
| 452 | optimize, opt [on] |
| 453 | V\bVi\bi only. Throughput of text is expedited by setting the terminal |
| 454 | to no do automatic carriage returns when printing more than one |
| 455 | (logical) line of output, greatly speeding output on terminals |
| 456 | without addressable cursors when text with leading white space is |
| 457 | printed. |
| 458 | _\bT_\bh_\bi_\bs _\bo_\bp_\bt_\bi_\bo_\bn _\bi_\bs _\bn_\bo_\bt _\by_\be_\bt _\bi_\bm_\bp_\bl_\be_\bm_\be_\bn_\bt_\be_\bd_\b. |
| 459 | paragraphs, para [IPLPPPQPP LIpplpipbp] |
| 460 | V\bVi\bi only. Define additional paragraph boundaries for the {\b{ and }\b} |
| 461 | commands. The value of this option must be a character string con- |
| 462 | sisting of zero or more character pairs. |
| 463 | |
| 464 | In the text to be edited, the character string <newline>.<char- |
| 465 | pair>, (where <char-pair> is one of the character pairs in the op- |
| 466 | tion's value) defines a paragraph boundary. For example, if the |
| 467 | option were set to ``LaA ##'', then all of the following additional |
| 468 | paragraph boundaries would be recognized: |
| 469 | <newline>.La |
| 470 | <newline>.A<space> |
| 471 | <newline>.## |
| 472 | prompt [on] |
| 473 | E\bEx\bx only. This option causes e\bex\bx to prompt for command input with a |
| 474 | ``:'' character; when it's not set, no prompt is displayed. |
| 475 | readonly, ro [off] |
| 476 | This option causes a force flag to be required to attempt to write |
| 477 | the file back to the original file name. Setting this option is |
| 478 | equivalent to using the -\b-R\bR command line option, or editing a file |
| 479 | which lacks write permission. |
| 480 | recdir [/var/tmp/vi.recover] |
| 481 | The directory where recovery files are stored. |
| 482 | redraw, re [off] |
| 483 | V\bVi\bi only. The editor simulates (using great amounts of output), an |
| 484 | intelligent terminal on a dumb terminal (e.g. during insertions in |
| 485 | visual mode the characters to the right of the cursor are refreshed |
| 486 | as each input character is typed). |
| 487 | _\bT_\bh_\bi_\bs _\bo_\bp_\bt_\bi_\bo_\bn _\bi_\bs _\bn_\bo_\bt _\by_\be_\bt _\bi_\bm_\bp_\bl_\be_\bm_\be_\bn_\bt_\be_\bd_\b. |
| 488 | remap [on] |
| 489 | If this option is set, it's possible to define macros in terms of |
| 490 | other macros. Otherwise, each key is only remapped up to one time. |
| 491 | For example, if ``A'' is mapped to ``B'', and ``B'' is mapped to |
| 492 | ``C'', The keystroke ``A'' will be mapped to ``C'' if r\bre\bem\bma\bap\bp is set, |
| 493 | and to ``B'' if it is not set. |
| 494 | remapmax [on] |
| 495 | If this option is set, a key may only be remapped 50 times. If it |
| 496 | is not set, a key may be remapped an infinite number of times, and |
| 497 | the editor can be placed into infinite loops. |
| 498 | report [5] |
| 499 | Set the threshold of the number of lines that need to be changed |
| 500 | before a message will be displayed to the user. The value is the |
| 501 | largest value about which the editor is silent, i.e. by default, 6 |
| 502 | lines must change before the user is notified. |
| 503 | ruler [off] |
| 504 | V\bVi\bi only. Display a row/column ruler on the colon command line. |
| 505 | scroll, scr [window / 2] |
| 506 | Set the number of lines scrolled by the v\bvi\bi commands ^\b^D\bD and ^\b^U\bU. |
| 507 | |
| 508 | Historically, the e\bex\bx z\bz command, when specified without a count, |
| 509 | used two times the size of the scroll value; the POSIX 1003.2 stan- |
| 510 | dard specified the window size, which is a better choice. |
| 511 | sections, sect [NHSHH HUnhsh] |
| 512 | V\bVi\bi only. Define additional section boundaries for the [\b[[\b[ and ]\b]]\b] |
| 513 | commands. The s\bse\bec\bct\bti\bio\bon\bns\bs option should be set to a character string |
| 514 | consisting of zero or more character pairs. In the text to be |
| 515 | edited, the character string <newline>.<char-pair>, (where <char- |
| 516 | pair> is one of the character pairs in the option's value), defines |
| 517 | a section boundary in the same manner that p\bpa\bar\bra\bag\bgr\bra\bap\bph\bh option bound- |
| 518 | aries are defined. |
| 519 | shell, sh [environment variable SHELL, or /bin/sh] |
| 520 | Select the shell used by the editor. The specified path is the |
| 521 | pathname of the shell invoked by the v\bvi\bi !\b! shell escape command and |
| 522 | by the e\bex\bx s\bsh\bhe\bel\bll\bl command. This program is also used to resolve any |
| 523 | shell meta-characters in e\bex\bx commands. |
| 524 | shiftwidth, sw [8] |
| 525 | Set the autoindent and shift command indentation width. This width |
| 526 | is used by the a\bau\but\bto\boi\bin\bnd\bde\ben\bnt\bt option and by the <\b<, >\b>, and s\bsh\bhi\bif\bft\bt com- |
| 527 | |
| 528 | mands. |
| 529 | showdirty [off] |
| 530 | V\bVi\bi only. Display an asterisk on the colon command line if the file |
| 531 | has been modified. |
| 532 | showmatch, sm [off] |
| 533 | V\bVi\bi only. This option causes v\bvi\bi, when a ``}'' or ``)'' is entered, |
| 534 | to briefly move the cursor the matching ``{'' or ``(''. See the |
| 535 | m\bma\bat\btc\bch\bht\bti\bim\bme\be option for more information. |
| 536 | showmode [off] |
| 537 | V\bVi\bi only. This option causes v\bvi\bi to display the strings ``Command'' |
| 538 | or ``Input'' on the colon command line, based on the current mode |
| 539 | of the editor. |
| 540 | sidescroll [16] |
| 541 | V\bVi\bi only. Sets the number of columns that are shifted to the left |
| 542 | or right, when v\bvi\bi is doing left-right scrolling and the left or |
| 543 | right margin is crossed. See the l\ble\bef\bft\btr\bri\big\bgh\bht\bt option for more infor- |
| 544 | mation. |
| 545 | slowopen, slow [off] |
| 546 | This option affects the display algorithm used by v\bvi\bi, holding off |
| 547 | display updating during input of new text to improve throughput |
| 548 | when the terminal in use is slow and unintelligent. |
| 549 | _\bT_\bh_\bi_\bs _\bo_\bp_\bt_\bi_\bo_\bn _\bi_\bs _\bn_\bo_\bt _\by_\be_\bt _\bi_\bm_\bp_\bl_\be_\bm_\be_\bn_\bt_\be_\bd_\b. |
| 550 | sourceany [off] |
| 551 | If this option is turned on, v\bvi\bi historically read startup files |
| 552 | that were owned by someone other than the editor user. See the |
| 553 | STARTUP INFORMATION section for more information. This option is a |
| 554 | security problem of immense proportions, and should not be used un- |
| 555 | der any circumstances. |
| 556 | _\bT_\bh_\bi_\bs _\bo_\bp_\bt_\bi_\bo_\bn _\bw_\bi_\bl_\bl _\bn_\be_\bv_\be_\br _\bb_\be _\bi_\bm_\bp_\bl_\be_\bm_\be_\bn_\bt_\be_\bd_\b. |
| 557 | tabstop, ts [8] |
| 558 | This option sets tab widths for the editor display. |
| 559 | taglength, tl [0] |
| 560 | This option sets the maximum number of characters that are consid- |
| 561 | ered significant in a tag name. Setting the value to 0 makes all |
| 562 | of the characters in the tag name significant. |
| 563 | tags, tag [tags /var/db/libc.tags /sys/kern/tags] |
| 564 | Sets the list of tags files, in search order, which are used when |
| 565 | the editor searches for a tag. |
| 566 | term, ttytype, tty [environment variable TERM] |
| 567 | Set the terminal type. Setting this option causes e\bex\bx/\b/v\bvi\bi to set (or |
| 568 | reset) the environmental variable TERM. |
| 569 | terse [off] |
| 570 | This option has historically made editor messages less verbose. It |
| 571 | has no effect in this implementation. See the v\bve\ber\brb\bbo\bos\bse\be option for |
| 572 | more information. |
| 573 | timeout, to [on] |
| 574 | If this option is set, e\bex\bx/\b/v\bvi\bi waits for a specific period for a sub- |
| 575 | sequent key to complete a key mapping (see the k\bke\bey\byt\bti\bim\bme\be option). If |
| 576 | the option is not set, the editor waits until enough keys are en- |
| 577 | tered to resolve the ambiguity, regardless of how long it takes. |
| 578 | ttywerase [off] |
| 579 | V\bVi\bi only. This option changes how v\bvi\bi does word erase during text |
| 580 | input. If this option is set, text is broken up into two classes, |
| 581 | blank characters and non-blank characters. Changing from one class |
| 582 | to another marks the end of a word. |
| 583 | verbose [off] |
| 584 | only. V\bVi\bi historically bells the terminal for many obvious mis- |
| 585 | takes, e.g. trying to move past the left-hand margin, or past the |
| 586 | end of the file. If this option is set, an error message is dis- |
| 587 | played for all errors. |
| 588 | w300 [no default] |
| 589 | V\bVi\bi only. Set the window size if the baud rate is less than 1200 |
| 590 | baud. See the w\bwi\bin\bnd\bdo\bow\bw option for more information. |
| 591 | w1200 [no default] |
| 592 | V\bVi\bi only. Set the window size if the baud rate is equal to 1200 |
| 593 | |
| 594 | baud. See the w\bwi\bin\bnd\bdo\bow\bw option for more information. |
| 595 | w9600 [no default] |
| 596 | V\bVi\bi only. Set the window size if the baud rate is greater than 1200 |
| 597 | baud. See the w\bwi\bin\bnd\bdo\bow\bw option for more information. |
| 598 | warn [on] |
| 599 | E\bEx\bx only. This option causes a warning message to the terminal if |
| 600 | the file has been modified, since it was last written, before a !\b! |
| 601 | command. |
| 602 | window, w, wi [environment variable LINES] |
| 603 | This option determines the default number of lines in a screenful, |
| 604 | as written by the z\bz command. It also determines the number of |
| 605 | lines scrolled by the v\bvi\bi commands ^\b^F\bF and ^\b^B\bB. The value of window |
| 606 | can be unrelated to the real screen size, although it starts out as |
| 607 | the number of lines on the screen (see the SCREEN SIZING section). |
| 608 | Setting the value of the w\bwi\bin\bnd\bdo\bow\bw option is the same as using the -\b-w\bw |
| 609 | command line option. |
| 610 | |
| 611 | If the value of w\bwi\bin\bnd\bdo\bow\bw (as set by the w\bwi\bin\bnd\bdo\bow\bw, w\bw3\b30\b00\b0, w\bw1\b12\b20\b00\b0 or w\bw9\b96\b60\b00\b0 |
| 612 | options) is smaller than the actual size of the screen, large |
| 613 | screen movements will result in displaying only that smaller number |
| 614 | of lines on the screen. (Further movements in that same area will |
| 615 | result in the screen being filled.) This can provide a performance |
| 616 | improvement when viewing different places in one or more files over |
| 617 | a slow link. |
| 618 | wrapmargin, wm [0] |
| 619 | V\bVi\bi only. If the value of wrapmargin is non-zero, v\bvi\bi will break |
| 620 | lines, that are more than that number of characters long, into two |
| 621 | lines at the blank character closest to the value. If wrapmargin |
| 622 | is 0, or if there is no blank character upon which to break the |
| 623 | line, the line will not be broken. |
| 624 | wrapscan, ws [on] |
| 625 | This option causes searches to wrap around the end or the beginning |
| 626 | of the file, and back to the starting point. Otherwise, the end or |
| 627 | beginning of the file terminates the search. |
| 628 | writeany, wa [off] |
| 629 | If this option is set, file-overwriting checks that would usually |
| 630 | be made before the w\bwr\bri\bit\bte\be and x\bxi\bit\bt commands, or before an automatic |
| 631 | write (see the a\bau\but\bto\bow\bwr\bri\bit\bte\be option), are not made. This allows a |
| 632 | write to any file, provided the file permissions allow it. |
| 633 | |
| 634 | 4.4BSD March 18, 1994 10 |