VI(1) VI(1) NNAAMMEE ex, vi, view - text editors SSYYNNOOPPSSIISS eexx [--eeFFRRrrSSssvv] [--cc _c_m_d] [--tt _t_a_g] [--ww _s_i_z_e] [file ...] vvii [--eeFFllRRrrSSvv] [--cc _c_m_d] [--tt _t_a_g] [--ww _s_i_z_e] [file ...] vviieeww [--eeFFRRrrSSvv] [--cc _c_m_d] [--tt _t_a_g] [--ww _s_i_z_e] [file ...] LLIICCEENNSSEE The vi program is freely redistributable. You are welcome to copy, modify and share it with others under the condi- tions listed in the LICENSE file. If any company (not individual!) finds vi sufficiently useful that you would have purchased it, or if any company wishes to redis- tribute it, contributions to the authors would be appreci- ated. DDEESSCCRRIIPPTTIIOONN _V_i is a screen oriented text editor. _E_x is a line-ori- ented text editor. _E_x and _v_i are different interfaces to the same program, and it is possible to switch back and forth during an edit session. _V_i_e_w is the equivalent of using the --RR (read-only) option of _v_i. This manual page is the one provided with the _n_e_x_/_n_v_i ver- sions of the _e_x_/_v_i text editors. _N_e_x_/_n_v_i are intended as bug-for-bug compatible replacements for the original Fourth Berkeley Software Distribution (4BSD) _e_x and _v_i programs. For the rest of this manual page, _n_e_x_/_n_v_i is used only when it's necessary to distinguish it from the historic implementations of _e_x_/_v_i. This manual page is intended for users already familiar with _e_x_/_v_i. Anyone else should almost certainly read a good tutorial on the editor before this manual page. If you're in an unfamiliar environment, and you absolutely have to get work done immediately, read the section after the options description, entitled ``Fast Startup''. It's probably enough to get you going. The following options are available: --cc Execute ccmmdd immediately after starting the edit session. Particularly useful for initial position- ing in the file, however ccmmdd is not limited to positioning commands. This is the POSIX 1003.2 interface for the historic ``+cmd'' syntax. _N_e_x_/_n_v_i supports both the old and new syntax. --ee Start editing in ex mode, as if the command name were _e_x. --FF Don't copy the entire file when first starting to edit. (The default is to make a copy in case some- one else modifies the file during your edit ses- sion.) --ll Start editing with the lisp and showmatch options set. --RR Start editing in read-only mode, as if the command name was _v_i_e_w, or the rreeaaddoonnllyy option was set. --rr Recover the specified files, or, if no files are specified, list the files that could be recovered. If no recoverable files by the specified name exist, the file is edited as if the --rr option had not been specified. --SS Run with the sseeccuurree edit option set, disallowing all access to external programs. --ss Enter batch mode; applicable only to _e_x edit ses- sions. Batch mode is useful when running _e_x scripts. Prompts, informative messages and other user oriented message are turned off, and no startup files or environmental variables are read. This is the POSIX 1003.2 interface for the historic ``-'' argument. _N_e_x_/_n_v_i supports both the old and new syntax. --tt Start editing at the specified tag. (See _c_t_a_g_s(1)). --ww Set the initial window size to the specified number of lines. --vv Start editing in vi mode, as if the command name was _v_i or _v_i_e_w. Command input for _e_x_/_v_i is read from the standard input. In the _v_i interface, it is an error if standard input is not a terminal. In the _e_x interface, if standard input is not a terminal, _e_x will read commands from it regardless, however, the session will be a batch mode session, exactly as if the --ss option had been specified. _E_x_/_v_i exits 0 on success, and greater than 0 if an error occurs. FFAASSTT SSTTAARRTTUUPP This section will tell you the minimum amount that you need to do simple editing tasks using _v_i. If you've never used any screen editor before, you're likely to have prob- lems even with this simple introduction. In that case you should find someone that already knows _v_i and have them walk you through this section. _V_i is a screen editor. This means that it takes up almost the entire screen, displaying part of the file on each screen line, except for the last line of the screen. The last line of the screen is used for you to give commands to _v_i, and for _v_i to give information to you. The other fact that you need to understand is that _v_i is a modeful editor, i.e. you are either entering text or you are executing commands, and you have to be in the right mode to do one or the other. You will be in command mode when you first start editing a file. There are commands that switch you into input mode. There is only one key that takes you out of input mode, and that is the key. (Key names are written using less-than and greater- than signs, e.g. means the ``escape'' key, usu- ally labeled ``esc'' on your terminal's keyboard.) If you're ever confused as to which mode you're in, keep entering the key until _v_i beeps at you. (Gener- ally, _v_i will beep at you if you try and do something that's not allowed. It will also display error messages.) To start editing a file, enter the command ``vi file_name''. The command you should enter as soon as you start editing is ``:set verbose show- mode''. This will make the editor give you verbose error messages and display the current mode at the bottom of the screen. The commands to move around the file are: hh Move the cursor left one character. jj Move the cursor down one line. kk Move the cursor up one line. ll Move the cursor right one character. <> The cursor arrow keys should work, too. //tteexxtt<> Search for the string ``text'' in the file, and move the cursor to its first character. The commands to enter new text are: aa Append new text, _a_f_t_e_r the cursor. ii Insert new text, _b_e_f_o_r_e the cursor. oo Open a new line below the line the cursor is on, and start entering text. OO Open a new line above the line the cursor is on, and start entering text. <> Once you've entered input mode using the one of the aa, ii, OO or oo commands, use <> to quit enter- ing text and return to command mode. The commands to copy text are: yyyy Copy the line the cursor is on. pp Append the copied line after the line the cursor is on. The commands to delete text are: dddd Delete the line the cursor is on. xx Delete the character the cursor is on. The commands to write the file are: ::ww<> Write the file back to the file with the name that you originally used as an argument on the _v_i com- mand line. ::ww ffiillee__nnaammee<> Write the file back to the file with the name ``file_name''. The commands to quit editing and exit the editor are: ::qq<> Quit editing and leave vi (if you've modified the file, but not saved your changes, _v_i will refuse to quit). ::qq!!<> Quit, discarding any modifications that you may have made. One final caution. Unusual characters can take up more than one column on the screen, and long lines can take up more than a single screen line. The above commands work on ``physical'' characters and lines, i.e. they affect the entire line no matter how many screen lines it takes up and the entire character no matter how many screen columns it takes up. VVII CCOOMMMMAANNDDSS The following section describes the commands available in the command mode of the _v_i editor. In each entry below, the tag line is a usage synopsis for the command charac- ter. [[ccoouunntt]] <> Search forward _c_o_u_n_t times for the current word. [[ccoouunntt]] <> Page backwards _c_o_u_n_t screens. [[ccoouunntt]] <> Scroll forward _c_o_u_n_t lines. [[ccoouunntt]] <> Scroll forward _c_o_u_n_t lines, leaving the current line and column as is, if possible. [[ccoouunntt]] <> Page forward _c_o_u_n_t screens. <> Display the file information. <> [[ccoouunntt]] hh Move the cursor back _c_o_u_n_t characters in the cur- rent line. [[ccoouunntt]] <> [[ccoouunntt]] <> [[ccoouunntt]] jj Move the cursor down _c_o_u_n_t lines without changing the current column. <> <> Repaint the screen. [[ccoouunntt]] <> [[ccoouunntt]] ++ Move the cursor down _c_o_u_n_t lines to the first non- blank character of that line. [[ccoouunntt]] <> [[ccoouunntt]] kk Move the cursor up _c_o_u_n_t lines, without changing the current column. <> Return to the most recent tag context. <> Scroll backwards _c_o_u_n_t lines. <> Switch to the next lower screen in the window, or, to the first screen if there are no lower screens in the window. <> Scroll backwards _c_o_u_n_t lines, leaving the current line and column as is, if possible. <> Suspend the current editor session. <> Execute _e_x commands or cancel partial commands. <> Push a tag reference onto the tag stack. <> Switch to the most recently edited file. [[ccoouunntt]] <> [[ccoouunntt]] ll Move the cursor forward _c_o_u_n_t characters without changing the current line. [[ccoouunntt]] !! mmoottiioonn sshheellll--aarrgguummeenntt((ss)) Replace text with results from a shell command. [[ccoouunntt]] ## ##||++||-- Increment or decrement the cursor number. [[ccoouunntt]] $$ Move the cursor to the end of a line. %% Move to the matching character. && Repeat the previous substitution command on the current line. ''<> ``<> Return to a context marked by the character _<_c_h_a_r_- _a_c_t_e_r_>. [[ccoouunntt]] (( Back up _c_o_u_n_t sentences. [[ccoouunntt]] )) Move forward _c_o_u_n_t sentences. [[ccoouunntt]] ,, Reverse find character _c_o_u_n_t times. [[ccoouunntt]] -- Move to first nonblank of the previous line, _c_o_u_n_t times. [[ccoouunntt]] .. Repeat the last _v_i command that modified text. //RREE<> //RREE// [[ooffffsseett]]<> ??RREE<> ??RREE?? [[ooffffsseett]]<> NN nn Search forward or backward for a regular expres- sion. 00 Move to the first character in the current line. :: Execute an ex command. [[ccoouunntt]] ;; Repeat the last character find _c_o_u_n_t times. [[ccoouunntt]] << mmoottiioonn [[ccoouunntt]] >> mmoottiioonn Shift lines left or right. @@ bbuuffffeerr Execute a named buffer. [[ccoouunntt]] AA Enter input mode, appending the text after the end of the line. [[ccoouunntt]] BB Move backwards _c_o_u_n_t bigwords. [[bbuuffffeerr]] [[ccoouunntt]] CC Change text from the current position to the end- of-line. [[bbuuffffeerr]] DD Delete text from the current position to the end- of-line. [[ccoouunntt]] EE Move forward _c_o_u_n_t end-of-bigwords. [[ccoouunntt]] FF <> Search _c_o_u_n_t times backward through the current line for _<_c_h_a_r_a_c_t_e_r_>. [[ccoouunntt]] GG Move to line _c_o_u_n_t, or the last line of the file if _c_o_u_n_t not specified. [[ccoouunntt]] HH Move to the screen line _c_o_u_n_t _- _1 lines below the top of the screen. [[ccoouunntt]] II Enter input mode, inserting the text at the begin- ning of the line. [[ccoouunntt]] JJ Join lines. [[ccoouunntt]] LL Move to the screen line _c_o_u_n_t _- _1 lines above the bottom of the screen. MM Move to the screen line in the middle of the screen. [[ccoouunntt]] OO Enter input mode, appending text in a new line above the current line. [[bbuuffffeerr]] PP Insert text from a buffer. QQ Exit _v_i (or visual) mode and switch to _e_x mode. [[ccoouunntt]] RR Enter input mode, replacing the characters in the current line. [[bbuuffffeerr]] [[ccoouunntt]] SS Substitute _c_o_u_n_t lines. [[ccoouunntt]] TT <> Search backwards, _c_o_u_n_t times, through the current line for the character _a_f_t_e_r the specified _<_c_h_a_r_a_c_- _t_e_r_>. UU Restore the current line to its state before the cursor last moved to it. [[ccoouunntt]] WW Move forward _c_o_u_n_t bigwords. [[bbuuffffeerr]] [[ccoouunntt]] XX Delete _c_o_u_n_t characters before the cursor. [[bbuuffffeerr]] [[ccoouunntt]] YY Copy (or ``yank'') _c_o_u_n_t lines into the specified buffer. ZZZZ Write the file and exit _v_i. [[ccoouunntt]] [[[[ Back up _c_o_u_n_t section boundaries. [[ccoouunntt]] ]]]] Move forward _c_o_u_n_t section boundaries. ^^ Move to first nonblank character on the current line. [[ccoouunntt]] __ Move down _c_o_u_n_t _- _1 lines, to the first nonblank character. [[ccoouunntt]] aa Enter input mode, appending the text after the cur- sor. [[ccoouunntt]] bb Move backwards _c_o_u_n_t words. [[bbuuffffeerr]] [[ccoouunntt]] cc mmoottiioonn Change a region of text. [[bbuuffffeerr]] [[ccoouunntt]] dd mmoottiioonn Delete a region of text. [[ccoouunntt]] ee Move forward _c_o_u_n_t end-of-words. [[ccoouunntt]] ff<> Search forward, _c_o_u_n_t times, through the rest of the current line for _<_c_h_a_r_a_c_t_e_r_>. [[ccoouunntt]] ii Enter input mode, inserting the text before the cursor. mm <> Save the current context (line and column) as _<_c_h_a_r_a_c_t_e_r_>. [[ccoouunntt]] oo Enter input mode, appending text in a new line under the current line. [[bbuuffffeerr]] pp Append text from a buffer. [[ccoouunntt]] rr <> Replace _c_o_u_n_t characters. [[bbuuffffeerr]] [[ccoouunntt]] ss Substitute _c_o_u_n_t characters in the current line starting with the current character. [[ccoouunntt]] tt <> Search forward, _c_o_u_n_t times, through the current line for the character immediately _b_e_f_o_r_e _<_c_h_a_r_a_c_- _t_e_r_>. uu Undo the last change made to the file. [[ccoouunntt]] ww Move forward _c_o_u_n_t words. [[bbuuffffeerr]] [[ccoouunntt]] xx Delete _c_o_u_n_t characters. [[bbuuffffeerr]] [[ccoouunntt]] yy mmoottiioonn Copy (or ``yank'') a text region specified by the _c_o_u_n_t and motion into a buffer. [[ccoouunntt11]] zz [[ccoouunntt22]] --||..||++||^^||<> Redraw, optionally repositioning and resizing the screen. [[ccoouunntt]] {{ Move backward _c_o_u_n_t paragraphs. [[ccoouunntt]] || Move to a specific _c_o_l_u_m_n position on the current line. [[ccoouunntt]] }} Move forward _c_o_u_n_t paragraphs. [[ccoouunntt]] ~~ Reverse the case of the next _c_o_u_n_t character(s). [[ccoouunntt]] ~~ mmoottiioonn Reverse the case of the characters in a text region specified by the _c_o_u_n_t and _m_o_t_i_o_n. <> Interrupt the current operation. VVII TTEEXXTT IINNPPUUTT CCOOMMMMAANNDDSS The following section describes the commands available in the text input mode of the _v_i editor. <> Replay the previous input. <> Erase to the previous sshhiiffttwwiiddtthh column boundary. ^^<> Erase all of the autoindent characters, and reset the autoindent level. 00<> Erase all of the autoindent characters. <> Insert sufficient _<_t_a_b_> and _<_s_p_a_c_e_> characters to move forward to the next sshhiiffttwwiiddtthh column bound- ary. <> <> Erase the last character. <> Quote the next character. <> Resolve all text input into the file, and return to command mode. <> Erase the current line. <> <> Erase the last word. The definition of word is dependent on the aallttwweerraassee and ttttyywweerraassee options. <>[[00--99AA--FFaa--ff]]++ Insert a character with the specified hexadecimal value into the text. <> Interrupt text input mode, returning to command mode. EEXX CCOOMMMMAANNDDSS The following section describes the commands available in the _e_x editor. In each entry below, the tag line is a usage synopsis for the command. <> Scroll the screen. !! aarrgguummeenntt((ss)) [[rraannggee]]!! aarrgguummeenntt((ss)) Execute a shell command, or filter lines through a shell command. "" A comment. [[rraannggee]] nnuu[[mmbbeerr]] [[ccoouunntt]] [[ffllaaggss]] [[rraannggee]] ## [[ccoouunntt]] [[ffllaaggss]] Display the selected lines, each preceded with its line number. @@ bbuuffffeerr ** bbuuffffeerr Execute a buffer. [[lliinnee]] aa[[ppppeenndd]][[!!]] The input text is appended after the specified line. [[rraannggee]] cc[[hhaannggee]][[!!]] [[ccoouunntt]] The input text replaces the specified range. ccss[[ccooppee]] aadddd || ffiinndd || hheellpp || kkiillll || rreesseett Execute a Cscope command. [[rraannggee]] dd[[eelleettee]] [[bbuuffffeerr]] [[ccoouunntt]] [[ffllaaggss]] Delete the lines from the file. ddii[[ssppllaayy]] bb[[uuffffeerrss]] || cc[[oonnnneeccttiioonnss]] || ss[[ccrreeeennss]] || tt[[aaggss]] Display buffers, Cscope connections, screens or tags. [[EEee]][[ddiitt]][[!!]] [[++ccmmdd]] [[ffiillee]] [[EEee]]xx[[!!]] [[++ccmmdd]] [[ffiillee]] Edit a different file. eexxuu[[ssaaggee]] [[ccoommmmaanndd]] Display usage for an _e_x command. ff[[iillee]] [[ffiillee]] Display and optionally change the file name. [[FFff]]gg [[nnaammee]] _V_i mode only. Foreground the specified screen. [[rraannggee]] gg[[lloobbaall]] //ppaatttteerrnn// [[ccoommmmaannddss]] [[rraannggee]] vv //ppaatttteerrnn// [[ccoommmmaannddss]] Apply commands to lines matching (or not matching) a pattern. hhee[[llpp]] Display a help message. [[lliinnee]] ii[[nnsseerrtt]][[!!]] The input text is inserted before the specified line. [[rraannggee]] jj[[ooiinn]][[!!]] [[ccoouunntt]] [[ffllaaggss]] Join lines of text together. [[rraannggee]] ll[[iisstt]] [[ccoouunntt]] [[ffllaaggss]] Display the lines unambiguously. mmaapp[[!!]] [[llhhss rrhhss]] Define or display maps (for _v_i only). [[lliinnee]] mmaa[[rrkk]] <> [[lliinnee]] kk <> Mark the line with the mark _<_c_h_a_r_a_c_t_e_r_>. [[rraannggee]] mm[[oovvee]] lliinnee Move the specified lines after the target line. mmkk[[eexxrrcc]][[!!]] ffiillee Write the abbreviations, editor options and maps to the specified file. [[NNnn]][[eexxtt]][[!!]] [[ffiillee ......]] Edit the next file from the argument list. [[lliinnee]] oo[[ppeenn]] //ppaatttteerrnn// [[ffllaaggss]] Enter open mode. pprree[[sseerrvvee]] Save the file in a form that can later be recovered using the _e_x --rr option. [[PPpp]]rreevv[[iioouuss]][[!!]] Edit the previous file from the argument list. [[rraannggee]] pp[[rriinntt]] [[ccoouunntt]] [[ffllaaggss]] Display the specified lines. [[lliinnee]] ppuu[[tt]] [[bbuuffffeerr]] Append buffer contents to the current line. qq[[uuiitt]][[!!]] End the editing session. [[lliinnee]] rr[[eeaadd]][[!!]] [[ffiillee]] Read a file. rreecc[[oovveerr]] ffiillee Recover _f_i_l_e if it was previously saved. rreess[[iizzee]] [[++||--]]ssiizzee _V_i mode only. Grow or shrink the current screen. rreeww[[iinndd]][[!!]] Rewind the argument list. ssee[[tt]] [[ooppttiioonn[[==[[vvaalluuee]]]] ......]] [[nnooooppttiioonn ......]] [[ooppttiioonn?? ......]] [[aallll]] Display or set editor options. sshh[[eellll]] Run a shell program. ssoo[[uurrccee]] ffiillee Read and execute _e_x commands from a file. [[rraannggee]] ss[[uubbssttiittuuttee]] [[//ppaatttteerrnn//rreeppllaaccee//]] [[ooppttiioonnss]] [[ccoouunntt]] [[ffllaaggss]] [[rraannggee]] && [[ooppttiioonnss]] [[ccoouunntt]] [[ffllaaggss]] [[rraannggee]] ~~ [[ooppttiioonnss]] [[ccoouunntt]] [[ffllaaggss]] Make substitutions. ssuu[[ssppeenndd]][[!!]] sstt[[oopp]][[!!]] <> Suspend the edit session. [[TTtt]]aa[[gg]][[!!]] ttaaggssttrriinngg Edit the file containing the specified tag. ttaaggnn[[eexxtt]][[!!]] Edit the file containing the next context for the current tag. ttaaggpp[[oopp]][[!!]] [[ffiillee || nnuummbbeerr]] Pop to the specified tag in the tags stack. ttaaggpp[[rreevv]][[!!]] Edit the file containing the previous context for the current tag. uunnmm[[aapp]][[!!]] llhhss Unmap a mapped string. vvee[[rrssiioonn]] Display the version of the _e_x_/_v_i editor. [[lliinnee]] vvii[[ssuuaall]] [[ttyyppee]] [[ccoouunntt]] [[ffllaaggss]] _E_x mode only. Enter _v_i. [[VVii]]ii[[ssuuaall]][[!!]] [[++ccmmdd]] [[ffiillee]] _V_i mode only. Edit a new file. vviiuu[[ssaaggee]] [[ccoommmmaanndd]] Display usage for a _v_i command. [[rraannggee]] ww[[rriittee]][[!!]] [[>>>>]] [[ffiillee]] [[rraannggee]] ww[[rriittee]] [[!!]] [[ffiillee]] [[rraannggee]] wwnn[[!!]] [[>>>>]] [[ffiillee]] [[rraannggee]] wwqq[[!!]] [[>>>>]] [[ffiillee]] Write the file. [[rraannggee]] xx[[iitt]][[!!]] [[ffiillee]] Write the file if it has been modified. [[rraannggee]] yyaa[[nnkk]] [[bbuuffffeerr]] [[ccoouunntt]] Copy the specified lines to a buffer. [[lliinnee]] zz [[ttyyppee]] [[ccoouunntt]] [[ffllaaggss]] Adjust the window. SSEETT OOPPTTIIOONNSS There are a large number of options that may be set (or unset) to change the editor's behavior. This section describes the options, their abbreviations and their default values. In each entry below, the first part of the tag line is the full name of the option, followed by any equivalent abbre- viations. The part in square brackets is the default value of the option. Most of the options are boolean, i.e. they are either on or off, and do not have an associ- ated value. Options apply to both _e_x and _v_i modes, unless otherwise specified. aallttwweerraassee [[ooffff]] _V_i only. Select an alternate word erase algorithm. aauuttooiinnddeenntt,, aaii [[ooffff]] Automatically indent new lines. aauuttoopprriinntt,, aapp [[ooffff]] _E_x only. Display the current line automatically. aauuttoowwrriittee,, aaww [[ooffff]] Write modified files automatically when changing files. bbaacckkuupp [[""""]] Backup files before they are overwritten. bbeeaauuttiiffyy,, bbff [[ooffff]] Discard control characters. ccddppaatthh [[eennvviirroonnmmeenntt vvaarriiaabbllee CCDDPPAATTHH,, oorr ccuurrrreenntt ddiirreeccttoorryy]] The directory paths used as path prefixes for the ccdd command. cceeddiitt [[nnoo ddeeffaauulltt]] Set the character to edit the colon command-line history. ccoolluummnnss,, ccoo [[8800]] Set the number of columns in the screen. ccoommmmeenntt [[ooffff]] _V_i only. Skip leading comments in shell, C and C++ language files. ddiirreeccttoorryy,, ddiirr [[eennvviirroonnmmeenntt vvaarriiaabbllee TTMMPPDDIIRR,, oorr //ttmmpp]] The directory where temporary files are created. eeddccoommppaattiibbllee,, eedd [[ooffff]] Remember the values of the ``c'' and ``g'' suffices to the ssuubbssttiittuuttee commands, instead of initializing them as unset for each new command. eerrrroorrbbeellllss,, eebb [[ooffff]] _E_x only. Announce error messages with a bell. eexxrrcc,, eexx [[ooffff]] Read the startup files in the local directory. eexxtteennddeedd [[ooffff]] Regular expressions are extended (i.e. _e_g_r_e_p(1)-style) expressions. ffiilleecc [[nnoo ddeeffaauulltt]] Set the character to perform file path completion on the colon command line. ffllaasshh [[oonn]] Flash the screen instead of beeping the keyboard on error. hhaarrddttaabbss,, hhtt [[88]] Set the spacing between hardware tab settings. iicclloowweerr [[ooffff]] Makes all Regular Expressions case-insensitive, as long as an upper-case letter does not appear in the search string. iiggnnoorreeccaassee,, iicc [[ooffff]] Ignore case differences in regular expressions. kkeeyyttiimmee [[66]] The 10th's of a second _e_x_/_v_i waits for a subsequent key to complete a key mapping. lleeffttrriigghhtt [[ooffff]] _V_i only. Do left-right scrolling. lliinneess,, llii [[2244]] _V_i only. Set the number of lines in the screen. lliisspp [[ooffff]] _V_i only. Modify various search commands and options to work with Lisp. _T_h_i_s _o_p_t_i_o_n _i_s _n_o_t _y_e_t _i_m_p_l_e_m_e_n_t_e_d_. lliisstt [[ooffff]] Display lines in an unambiguous fashion. lloocckk [[oonn]] Attempt to get an exclusive lock on any file being edited, read or written. mmaaggiicc [[oonn]] Treat certain characters specially in regular expressions. mmaattcchhttiimmee [[77]] _V_i only. The 10th's of a second _e_x_/_v_i pauses on the matching character when the sshhoowwmmaattcchh option is set. mmeessgg [[oonn]] Permit messages from other users. mmooddeelliinneess,, mmooddeelliinnee [[ooffff]] Read the first and last few lines of each file for _e_x commands. _T_h_i_s _o_p_t_i_o_n _w_i_l_l _n_e_v_e_r _b_e _i_m_p_l_e_- _m_e_n_t_e_d_. nnoopprriinntt [[""""]] Characters that are never handled as printable characters. nnuummbbeerr,, nnuu [[ooffff]] Precede each line displayed with its current line number. ooccttaall [[ooffff]] Display unknown characters as octal numbers, instead of the default hexadecimal. ooppeenn [[oonn]] _E_x only. If this option is not set, the ooppeenn and vviissuuaall commands are disallowed. ooppttiimmiizzee,, oopptt [[oonn]] _V_i only. Optimize text throughput to dumb termi- nals. _T_h_i_s _o_p_t_i_o_n _i_s _n_o_t _y_e_t _i_m_p_l_e_m_e_n_t_e_d_. ppaarraaggrraapphhss,, ppaarraa [[IIPPLLPPPPPPQQPPPP LLIIppppllppiippbbpp]] _V_i only. Define additional paragraph boundaries for the {{ and }} commands. ppaatthh [[]] Define additional directories to search for files being edited. pprriinntt [[""""]] Characters that are always handled as printable characters. pprroommpptt [[oonn]] _E_x only. Display a command prompt. rreeaaddoonnllyy,, rroo [[ooffff]] Mark the file and session as read-only. rreeccddiirr [[//vvaarr//ttmmpp//vvii..rreeccoovveerr]] The directory where recovery files are stored. rreeddrraaww,, rree [[ooffff]] _V_i only. Simulate an intelligent terminal on a dumb one. _T_h_i_s _o_p_t_i_o_n _i_s _n_o_t _y_e_t _i_m_p_l_e_m_e_n_t_e_d_. rreemmaapp [[oonn]] Remap keys until resolved. rreeppoorrtt [[55]] Set the number of lines about which the editor reports changes or yanks. rruulleerr [[ooffff]] _V_i only. Display a row/column ruler on the colon command line. ssccrroollll,, ssccrr [[wwiinnddooww // 22]] Set the number of lines scrolled. sseeaarrcchhiinnccrr [[ooffff]] Makes the // and ?? commands incremental. sseeccttiioonnss,, sseecctt [[NNHHSSHHHH HHUUnnhhsshh]] _V_i only. Define additional section boundaries for the [[[[ and ]]]] commands. sseeccuurree [[ooffff]] Turns off all access to external programs. sshheellll,, sshh [[eennvviirroonnmmeenntt vvaarriiaabbllee SSHHEELLLL,, oorr //bbiinn//sshh]] Select the shell used by the editor. sshheellllmmeettaa [[~~{{[[**??$$``''""\\]] Set the meta characters checked to determine if file name expansion is necessary. sshhiiffttwwiiddtthh,, ssww [[88]] Set the autoindent and shift command indentation width. sshhoowwmmaattcchh,, ssmm [[ooffff]] _V_i only. Note matching ``{'' and ``('' for ``}'' and ``)'' characters. sshhoowwmmooddee,, ssmmdd [[ooffff]] _V_i only. Display the current editor mode and a ``modified'' flag. ssiiddeessccrroollll [[1166]] _V_i only. Set the amount a left-right scroll will shift. sslloowwooppeenn,, ssllooww [[ooffff]] Delay display updating during text input. _T_h_i_s _o_p_t_i_o_n _i_s _n_o_t _y_e_t _i_m_p_l_e_m_e_n_t_e_d_. ssoouurrcceeaannyy [[ooffff]] Read startup files not owned by the current user. _T_h_i_s _o_p_t_i_o_n _w_i_l_l _n_e_v_e_r _b_e _i_m_p_l_e_m_e_n_t_e_d_. ttaabbssttoopp,, ttss [[88]] This option sets tab widths for the editor display. ttaagglleennggtthh,, ttll [[00]] Set the number of significant characters in tag names. ttaaggss,, ttaagg [[ttaaggss //vvaarr//ddbb//lliibbcc..ttaaggss //ssyyss//kkeerrnn//ttaaggss]] Set the list of tags files. tteerrmm,, ttttyyttyyppee,, ttttyy [[eennvviirroonnmmeenntt vvaarriiaabbllee TTEERRMM]] Set the terminal type. tteerrssee [[ooffff]] This option has historically made editor messages less verbose. It has no effect in this implementa- tion. ttiillddeeoopp [[ooffff]] Modify the ~~ command to take an associated motion. ttiimmeeoouutt,, ttoo [[oonn]] Time out on keys which may be mapped. ttttyywweerraassee [[ooffff]] _V_i only. Select an alternate erase algorithm. vveerrbboossee [[ooffff]] _V_i only. Display an error message for every error. ww330000 [[nnoo ddeeffaauulltt]] _V_i only. Set the window size if the baud rate is less than 1200 baud. ww11220000 [[nnoo ddeeffaauulltt]] _V_i only. Set the window size if the baud rate is equal to 1200 baud. ww99660000 [[nnoo ddeeffaauulltt]] _V_i only. Set the window size if the baud rate is greater than 1200 baud. wwaarrnn [[oonn]] _E_x only. This option causes a warning message to the terminal if the file has been modified, since it was last written, before a !! command. wwiinnddooww,, ww,, wwii [[eennvviirroonnmmeenntt vvaarriiaabbllee LLIINNEESS]] Set the window size for the screen. wwiinnddoowwnnaammee [[ooffff]] Change the icon/window name to the current file name even if it can't be restored on editor exit. wwrraapplleenn,, wwll [[00]] _V_i only. Break lines automatically, the specified number of columns from the left-hand margin. If both the wwrraapplleenn and wwrraappmmaarrggiinn edit options are set, the wwrraappmmaarrggiinn value is used. wwrraappmmaarrggiinn,, wwmm [[00]] _V_i only. Break lines automatically, the specified number of columns from the right-hand margin. If both the wwrraapplleenn and wwrraappmmaarrggiinn edit options are set, the wwrraappmmaarrggiinn value is used. wwrraappssccaann,, wwss [[oonn]] Set searches to wrap around the end or beginning of the file. wwrriitteeaannyy,, wwaa [[ooffff]] Turn off file-overwriting checks. EENNVVIIRROONNMMEENNTTAALL VVAARRIIAABBLLEESS _C_O_L_U_M_N_S The number of columns on the screen. This value overrides any system or terminal specific values. If the _C_O_L_U_M_N_S environmental variable is not set when _e_x_/_v_i runs, or the ccoolluummnnss option is explic- itly reset by the user, _e_x_/_v_i enters the value into the environment. _E_X_I_N_I_T A list of _e_x startup commands, read if the variable _N_E_X_I_N_I_T is not set. _H_O_M_E The user's home directory, used as the initial directory path for the startup ``$_H_O_M_E/.nexrc'' and ``$_H_O_M_E/.exrc'' files. This value is also used as the default directory for the _v_i ccdd command. _L_I_N_E_S The number of rows on the screen. This value over- rides any system or terminal specific values. If the _L_I_N_E_S environmental variable is not set when _e_x_/_v_i runs, or the lliinneess option is explicitly reset by the user, _e_x_/_v_i enters the value into the envi- ronment. _N_E_X_I_N_I_T A list of _e_x startup commands. _S_H_E_L_L The user's shell of choice (see also the sshheellll option). _T_E_R_M The user's terminal type. The default is the type ``unknown''. If the _T_E_R_M environmental variable is not set when _e_x_/_v_i runs, or the tteerrmm option is explicitly reset by the user, _e_x_/_v_i enters the value into the environment. _T_M_P_D_I_R The location used to stored temporary files (see also the ddiirreeccttoorryy edit option). AASSYYNNCCHHRROONNOOUUSS EEVVEENNTTSS SIGALRM _V_i_/_e_x uses this signal for periodic backups of file modifications and to display ``busy'' messages when operations are likely to take a long time. SIGHUP SIGTERM If the current buffer has changed since it was last written in its entirety, the editor attempts to save the modified file so it can be later recov- ered. See the _v_i_/_e_x Reference manual section enti- tled ``Recovery'' for more information. SIGINT When an interrupt occurs, the current operation is halted, and the editor returns to the command level. If interrupted during text input, the text already input is resolved into the file as if the text input had been normally terminated. SIGWINCH The screen is resized. See the _v_i_/_e_x Reference manual section entitled ``Sizing the Screen'' for more information. SIGCONT SIGQUIT SIGTSTP _V_i_/_e_x ignores these signals. FFIILLEESS /bin/sh The default user shell. /etc/vi.exrc System-wide vi startup file. /tmp Temporary file directory. /var/tmp/vi.recover The default recovery file directory. $HOME/.nexrc 1st choice for user's home directory startup file. $HOME/.exrc 2nd choice for user's home directory startup file. .nexrc 1st choice for local directory startup file. .exrc 2nd choice for local directory startup file. SSEEEE AALLSSOO _c_t_a_g_s(1), _m_o_r_e(3), _c_u_r_s_e_s(3), _d_b_o_p_e_n(3) The ``Vi Quick Reference'' card. ``An Introduction to Display Editing with Vi'', found in the ``UNIX User's Manual Supplementary Documents'' section of both the 4.3BSD and 4.4BSD manual sets. This document is the closest thing available to an introduction to the _v_i screen editor. ``Ex Reference Manual (Version 3.7)'', found in the ``UNIX User's Manual Supplementary Documents'' section of both the 4.3BSD and 4.4BSD manual sets. This document is the final reference for the _e_x editor, as distributed in most historic 4BSD and System V systems. ``Edit: A tutorial'', found in the ``UNIX User's Manual Supplementary Documents'' section of the 4.3BSD manual set. This document is an introduction to a simple version of the _e_x screen editor. ``Ex/Vi Reference Manual'', found in the ``UNIX User's Manual Supplementary Documents'' section of the 4.4BSD manual set. This document is the final reference for the _n_e_x_/_n_v_i text editors, as distributed in 4.4BSD and 4.4BSD- Lite. _R_o_f_f source for all of these documents is distributed with _n_e_x_/_n_v_i in the _n_v_i_/_U_S_D_._d_o_c directory of the _n_e_x_/_n_v_i source code. The files ``autowrite'', ``input'', ``quoting'' and ``structures'' found in the _n_v_i_/_d_o_c_s_/_i_n_t_e_r_n_a_l_s directory of the _n_e_x_/_n_v_i source code. HHIISSTTOORRYY The _n_e_x_/_n_v_i replacements for the _e_x_/_v_i editor first appeared in 4.4BSD. SSTTAANNDDAARRDDSS _N_e_x_/_n_v_i is close to IEEE Std1003.2 (``POSIX''). That doc- ument differs from historical _e_x_/_v_i practice in several places; there are changes to be made on both sides. October 10, 1996 VI(1)