VVii//EExx RReeffeerreennccee MMaannuuaall _K_e_i_t_h _B_o_s_t_i_c Computer Science Division Department of Electrical Engineering and Computer Science University of California, Berkeley Berkeley, California 94720 October 21, 1997 _A_b_s_t_r_a_c_t This document is the reference guide for the 4.4BSD implementations of nneexx/nnvvii, which are implementations of the historic Berkeley eexx/vvii editors. _L_i_c_e_n_s_i_n_g Copyright (c) 1991, 1992, 1993, 1994 The Regents of the University of California. All Rights Reserved. Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996 Keith Bostic. All Rights Reserved. The vi program is freely redistributable. You are wel- come to copy, modify and share it with others under the con- ditions 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 redistribute it, contributions to the authors would be appreciated. _A_c_k_n_o_w_l_e_d_g_e_m_e_n_t_s Bruce Englar encouraged the early development of the historic eexx/vvii editor. Peter Kessler helped bring sanity to version 2's command layout. Bill Joy wrote versions 1 and 2.0 through 2.7, and created the frame- work that users see in the present editor. Mark Horton added macros and other features and made eexx/vvii work on a large number of terminals and Unix systems. NNvvii is originally derived from software contributed to the University of California, Berkeley by Steve Kirk- endall, the author of the vvii clone eellvviiss. IEEE Standard Portable Operating System Interface for Computer Environments (POSIX) 1003.2 style Regular Expression support was done by Henry Spencer. The curses library was originally done by Ken Arnold. Scrolling and reworking for nnvvii was done by Elan Amir. George Neville-Neil added the Tcl interpreter, and Sven Verdoolaege added the Perl interpreter. Rob Mayoff added Cscope support. The Institute of Electrical and Electronics Engi- neers has given us permission to reprint portions of their documentation. Portions of this document are reprinted and reproduced from IEEE Std 1003.2-1992, IEEE Standard Portable Operating System Interface for Comput- er Environments (POSIX), copyright 1992 by the Institute of Electrical and Electronics Engineers, Inc. The financial support of UUNET Communications Ser- vices is gratefully acknowledged. UUSSDD::1133--44 VVii//EExx RReeffeerreennccee 11.. DDeessccrriippttiioonn VVii is a screen oriented text editor. EExx is a line-ori- ented text editor. EExx and vvii are different interfaces to the same program, and it is possible to switch back and forth during an edit session. VViieeww is the equivalent of using the --RR (read-only) option of vvii. This reference manual is the one provided with the nneexx/nnvvii versions of the eexx/vvii text editors. NNeexx/nnvvii are intended as bug-for-bug compatible replacements for the original Fourth Berkeley Software Distribution (4BSD) eexx/vvii programs. This reference manual is accompanied by a tradi- tional-style manual page. That manual page describes the functionality found in eexx/vvii in far less detail than the description here. In addition, it describes the system interface to eexx/vvii, e.g. command line options, session recovery, signals, environmental variables, and similar things. This reference is intended for users already familiar with eexx/vvii. Anyone else should almost certainly read a good tutorial on the editor first. If you are in an unfamiliar environment, and you absolutely have to get work done imme- diately, see the section entitled "FFaasstt SSttaarrttuupp" in the man- ual page. It is probably enough to get you started. There are a few features in nneexx/nnvvii that are not found in historic versions of eexx/vvii. Some of the more interesting of those features are briefly described in the next section, entitled "AAddddiittiioonnaall FFeeaattuurreess". For the rest of this docu- ment, nneexx/nnvvii is used only when it is necessary to distin- guish it from the historic implementations of eexx/vvii. Future versions of this software will be periodically made available by anonymous ftp, and can be retrieved from ftp.cs.berkeley.edu, in the directory ucb/4bsd. 22.. AAddddiittiioonnaall FFeeaattuurreess iinn NNeexx//NNvvii There are a few features in nneexx/nnvvii that are not found in historic versions of eexx/vvii. Some of the more interesting of these are as follows: 88--bbiitt cclleeaann ddaattaa,, llaarrggee lliinneess,, ffiilleess NNeexx/nnvvii will edit any format file. Line lengths are limited by available memory, and file sizes are limited by available disk space. The vvii text input mode com- mand <> can insert any possible character value into the text. BBaacckkggrroouunndd aanndd ffoorreeggrroouunndd ssccrreeeennss The bbgg command backgrounds the current screen, and the VVii//EExx RReeffeerreennccee UUSSDD::1133--55 ffgg command foregrounds backgrounded screens. The ddiiss-- ppllaayy command can be used to list the background screens. CCoommmmaanndd EEddiittiinngg You can enter a normal editing window on the collected commands that you've entered on the vvii colon command- line, and then modify and/or execute the commands. See the cceeddiitt edit option for more information. DDiissppllaayyss The ddiissppllaayy command can be used to display the current buffers, the backgrounded screens, and the tags stack. EExxtteennddeedd RReegguullaarr EExxpprreessssiioonnss The eexxtteennddeedd option causes Regular Expressions to be interpreted as as Extended Regular Expressions, (i.e. _e_g_r_e_p(1) style Regular Expressions). FFiillee NNaammee CCoommpplleettiioonn It is possible to do file name completion and file name displays when entering commands on the vvii colon com- mand-line. See the ffiilleecc option for more information. IInnffiinniittee uunnddoo Changes made during an edit session may be rolled back- ward and forward. A .. command immediately after a uu command continues either forward or backward depending on whether the uu command was an undo or a redo. LLeefftt--rriigghhtt ssccrroolllliinngg The lleeffttrriigghhtt option causes nnvvii to do left-right screen scrolling, instead of the traditional vvii line wrapping. MMeessssaaggee CCaattaallooggss It is possible to display informational and error mes- sages in different languages by providing a catalog of messages. See the mmssggccaatt option and the file cata- log/README ffoorr mmoorree iinnffoorrmmaattiioonn.. IInnccrreemmeennttiinngg nnuummbbeerrss The ## command increments or decrements the number ref- erenced by the cursor. PPrreevviioouuss ffiillee The pprreevviioouuss command edits the previous file from the argument list. SSccrriippttiinngg llaanngguuaaggeess The ::ppee[[rrll]] ccmmdd, ::ppeerrlldd[[oo]] ccmmdd and ::ttcc[[ll]] ccmmdd commands execute Perl and Tcl/Tk commands, respectively, on lines from the edit buffer. See the "SSccrriippttiinngg LLaann-- gguuaaggeess" section and the specific commands for more UUSSDD::1133--66 VVii//EExx RReeffeerreennccee information. SSpplliitt ssccrreeeennss The EEddiitt, EExx, NNeexxtt, PPrreevviioouuss, TTaagg and VViissuuaall (in vvii mode) commands divide the screen into multiple editing regions and then perform their normal function in a new screen area. The <> command rotates between the foreground screens. The rreessiizzee command can be used to grow or shrink a particular screen. TTaagg ssttaacckkss Tags are now maintained in a stack. The <> command returns to the previous tag location. The ttaagg-- ppoopp command returns to the most recent tag location by default, or, optionally to a specific tag number in the tag stack, or the most recent tag from a specified file. The ddiissppllaayy command can be used to list the tags stack. The ttaaggttoopp command returns to the top of the tag stack. UUssaaggee iinnffoorrmmaattiioonn The eexxuussaaggee and vviiuussaaggee commands provide usage informa- tion for all of the eexx and vvii commands by default, or, optionally, for a specific command or key. WWoorrdd sseeaarrcchh The <> command searches for the word refer- enced by the cursor. 33.. SSttaarrttuupp IInnffoorrmmaattiioonn EExx/vvii interprets one of two possible environmental variables and reads up to three of five possible files dur- ing startup. The variables and files are expected to con- tain eexx commands, not vvii commands. In addition, they are interpreted _b_e_f_o_r_e the file to be edited is read, and there- fore many eexx commands may not be used. Generally, any com- mand that requires output to the screen or that needs a file upon which to operate, will cause an error if included in a startup file or environmental variable. Because the eexx command set supported by nneexx/nnvvii is a superset of the command set supported by historical imple- mentations of eexx, nneexx/nnvvii can use the startup files created for the historical implementations, but the converse may not be true. If the --ss (the historic - option) is specified, or if standard input is redirected from a file, all environmental variables and startup files are ignored. Otherwise, startup files and environmental variables are handled in the following order: VVii//EExx RReeffeerreennccee UUSSDD::1133--77 (1) The file /etc/vi.exrc is read, as long as it is owned by root or the effective user ID of the user. (2) The environmental variable NEXINIT (or the variable EXINIT, if NEXINIT is not set) is interpreted. (3) If neither NEXINIT or EXINIT was set, and the HOME environmental variable is set, the file $HOME/.nexrc (or the file $HOME/.exrc, if $HOME/.nexrc does not exist) is read, as long as the effective user ID of the user is root or is the same as the owner of the file. When the $HOME directory is being used for both nneexx/nnvvii and an historic implementation of eexx/vvii, a possible solution is to put nneexx/nnvvii specific commands in the .nexrc ffiillee,, aalloonngg wwiitthh aa ::ssoouurrccee $$HHOOMMEE//..eexxrrcc ccoommmmaanndd ttoo rreeaadd iinn tthhee ccoommmmaannddss ccoommmmoonn ttoo bbootthh iimmppllee-- mmeennttaattiioonnss.. (4) If the eexxrrcc option was turned on by one of the previ- ous startup information sources, the file .nexrc ((oorr tthhee ffiillee ..eexxrrcc, if .nexrc ddooeess nnoott eexxiisstt)) iiss rreeaadd,, aass lloonngg aass tthhee eeffffeeccttiivvee uusseerr IIDD ooff tthhee uusseerr iiss tthhee ssaammee aass tthhee oowwnneerr ooff tthhee ffiillee.. No startup file is read if it is writable by anyone other than its owner. It is not an error for any of the startup environmental variables or files not to exist. Once all environmental variables are interpreted, and all startup files are read, the first file to be edited is read in (or a temporary file is created). Then, any com- mands specified using the --cc option are executed, in the context of that file. 44.. RReeccoovveerryy There is no recovery program for nneexx/nnvvii, nor does nneexx/nnvvii run setuid. Recovery files are created readable and writable by the owner only. Users may recover any file which they can read, and the superuser may recover any edit session. Edit sessions are backed by files in the directory named by the rreeccddiirr option (the directory /var/tmp/vi.recover bbyy ddeeffaauulltt)),, aanndd aarree nnaammeedd ""vvii..XXXXXXXXXXXX"",, wwhheerree ""XXXXXXXXXXXX"" iiss aa nnuummbbeerr rreellaatteedd ttoo tthhee pprroocceessss IIDD.. WWhheenn aa ffiillee iiss ffiirrsstt mmooddiiffiieedd,, aa sseeccoonndd rreeccoovveerryy ffiillee ccoonnttaaiinniinngg aann eemmaaiill mmeessssaaggee ffoorr tthhee uusseerr iiss ccrreeaatteedd,, aanndd iiss nnaammeedd ""rreeccoovveerr..XXXXXXXXXXXX"",, wwhheerree,, aaggaaiinn,, ""XXXXXXXXXXXX"" iiss aassssoocciiaatteedd wwiitthh UUSSDD::1133--88 VVii//EExx RReeffeerreennccee tthhee pprroocceessss IIDD.. BBootthh ffiilleess aarree rreemmoovveedd aatt tthhee eenndd ooff aa nnoorr-- mmaall eeddiitt sseessssiioonn,, bbuutt wwiillll rreemmaaiinn iiff tthhee eeddiitt sseessssiioonn iiss aabbnnoorrmmaallllyy tteerrmmiinnaatteedd oorr tthhee uusseerr rruunnss tthhee eexx pprreesseerrvvee ccoomm-- mmaanndd.. The rreeccddiirr option may be set in either the user's or system's startup information, changing the recovery direc- tory. (Note, however, that if a memory based file system is used as the backup directory, each system reboot will delete all of the recovery files! The same caution applies to directories such as /tmp wwhhiicchh aarree cclleeaarreedd ooff tthheeiirr ccoonntteennttss bbyy aa ssyysstteemm rreebboooott,, oorr //uussrr//ttmmpp which is periodically cleared of old files on many systems.) The recovery directory should be owned by root, or at least by a pseudo-user. In addition, if directory "sticky- bit" semantics are available, the directory should have the sticky-bit set so that files may only be removed by their owners. The recovery directory must be read, write, and executable by any user, i.e. mode 1777. If the recovery directory does not exist, eexx/vvii will attempt to create it. This can result in the recovery directory being owned by a normal user, which means that that user will be able to remove other user's recovery and backup files. This is annoying, but is not a security issue as the user cannot otherwise access or modify the files. The recovery file has all of the necessary information in it to enable the user to recover the edit session. In addition, it has all of the necessary email headers for _s_e_n_d_m_a_i_l(8). When the system is rebooted, all of the files in /var/tmp/vi.recover _n_a_m_e_d _"rreeccoovveerr..XXXXXXXXXXXX_" _s_h_o_u_l_d _b_e _s_e_n_t _t_o _t_h_e_i_r _o_w_n_e_r_s_, _b_y _e_m_a_i_l_, _u_s_i_n_g _t_h_e --tt _o_p_t_i_o_n _o_f sseennddmmaaiill _(_o_r _a _s_i_m_i_l_a_r _m_e_c_h_a_n_i_s_m _i_n _o_t_h_e_r _m_a_i_l_e_r_s_)_. _I_f eexx_/vvii _r_e_c_e_i_v_e_s _a _h_a_n_g_u_p _(_S_I_G_H_U_P_) _s_i_g_n_a_l_, _o_r _t_h_e _u_s_e_r _e_x_e_c_u_t_e_s _t_h_e eexx pprreesseerrvvee _c_o_m_m_a_n_d_, eexx_/vvii _w_i_l_l _a_u_t_o_m_a_t_i_c_a_l_l_y _e_m_a_i_l _t_h_e _r_e_c_o_v_e_r_y _i_n_f_o_r_m_a_t_i_o_n _t_o _t_h_e _u_s_e_r_. If your system does not have the sseennddmmaaiill utility (or a mailer program which supports its interface) the source file nvi/common/recover.c wwiillll hhaavvee ttoo bbee mmooddiiffiieedd ttoo uussee yyoouurr llooccaall mmaaiill ddeelliivveerryy pprrooggrraammss.. NNoottee,, iiff nneexx//nnvvii iiss cchhaannggeedd ttoo uussee aannootthheerr mmaaiilleerr,, iitt iiss iimmppoorrttaanntt ttoo rreemmeemmbbeerr tthhaatt tthhee oowwnneerr ooff tthhee ffiillee ggiivveenn ttoo tthhee mmaaiilleerr iiss tthhee nneexx//nnvvii uusseerr,, ssoo nnootthhiinngg iinn tthhee ffiillee sshhoouulldd bbee ttrruusstteedd aass iitt mmaayy hhaavvee bbeeeenn mmooddiiffiieedd iinn aann eeffffoorrtt ttoo ccoommpprroommiissee tthhee ssyysstteemm.. Finally, the owner execute bit is set on backup files when they are created, and unset when they are first modi- fied, e.g. backup files that have no associated email recov- ery file will have this bit set. (There is also a small window where empty files can be created and not yet have VVii//EExx RReeffeerreennccee UUSSDD::1133--99 this bit set. This is due to the method in which the files are created.) Such files should be deleted when the system reboots. A simple way to do this cleanup is to run the Bourne shell script rreeccoovveerr, from your /etc/rc.local ((oorr ootthheerr ssyyss-- tteemm ssttaarrttuupp)) ffiillee.. TThhee ssccrriipptt sshhoouulldd wwoorrkk wwiitthh tthhee hhiissttoorriicc BBoouurrnnee sshheellll,, aa PPOOSSIIXX 11000033..22 sshheellll oorr tthhee KKoorrnn sshheellll.. TThhee rreeccoovveerr ssccrriipptt iiss iinnssttaalllleedd aass ppaarrtt ooff tthhee nneexx//nnvvii iinnssttaallllaa-- ttiioonn pprroocceessss.. Consult the manual page for details on recovering pre- served or aborted editing sessions. 55.. SSiizziinngg tthhee SSccrreeeenn The size of the screen can be set in a number of ways. EExx/vvii takes the following steps until values are obtained for both the number of rows and number of columns in the screen. (1) If the environmental variable LINES exists, it is used to specify the number of rows in the screen. (2) If the environmental variable COLUMNS exists, it is used to specify the number of columns in the screen. (3) The TIOCGWINSZ _i_o_c_t_l(2) is attempted on the standard error file descriptor. (4) The termcap entry (or terminfo entry on System V machines) is checked for the "li" entry (rows) and the "co" entry (columns). (5) The number of rows is set to 24, and the number of columns is set to 80. If a window change size signal (SIGWINCH) is received, the new window size is retrieved using the TIOCGWINSZ _i_o_c_t_l(2) call, and all other information is ignored. 66.. CChhaarraacctteerr DDiissppllaayy In both eexx and vvii printable characters as defined by _i_s_p_r_i_n_t(3) are displayed using the local character set. Non-printable characters, for which _i_s_c_n_t_r_l(3) returns true, and which are less than octal \040, are displayed as the string "^_"_, _w_h_e_r_e _<_c_h_a_r_a_c_t_e_r_> is the charac- ter that is the original character's value offset from the "@_" _c_h_a_r_a_c_t_e_r_. _F_o_r _e_x_a_m_p_l_e_, _t_h_e _o_c_t_a_l _c_h_a_r_a_c_t_e_r _\_0_0_1 _i_s _d_i_s_p_l_a_y_e_d _a_s _"_^_A". If _i_s_c_n_t_r_l(3) returns true for the octal character \177, it is displayed as the string "^?_"_. _A_l_l UUSSDD::1133--1100 VVii//EExx RReeffeerreennccee _o_t_h_e_r _c_h_a_r_a_c_t_e_r_s _a_r_e _d_i_s_p_l_a_y_e_d _a_s _e_i_t_h_e_r _h_e_x_a_d_e_c_i_m_a_l _v_a_l_u_e_s_, _i_n _t_h_e _f_o_r_m _"_0_x_<_h_i_g_h_-_h_a_l_f_b_y_t_e_> _._._. _0_x_<_l_o_w_-_h_a_l_f_b_y_t_e_>", or as octal values, in the form "\ ... \_"_. _T_h_e _d_i_s_p_l_a_y _o_f _u_n_k_n_o_w_n _c_h_a_r_a_c_t_e_r_s _i_s _b_a_s_e_d _o_n _t_h_e _v_a_l_u_e _o_f _t_h_e ooccttaall _o_p_t_i_o_n_. In vvii command mode, the cursor is always positioned on the last column of characters which take up more than one column on the screen. In vvii text input mode, the cursor is positioned on the first column of characters which take up more than one column on the screen. 77.. MMuullttiippllee SSccrreeeennss NNvvii supports multiple screens by dividing the window into regions. It also supports stacks of screens by permit- ting the user to change the set of screens that are cur- rently displayed. The EEddiitt, EExx, FFgg, NNeexxtt, PPrreevviioouuss, TTaagg and VViissuuaall (in vvii mode) commands divide the current screen into two regions of approximately equal size and then perform their usual action in a new screen area. If the cursor is in the lower half of the screen, the screen will split up, i.e. the new screen will be above the old one. If the cursor is in the upper half of the screen, the new screen will be below the old one. When more than one screen is editing a file, changes in any screen are reflected in all other screens editing the same file. Exiting a screen without saving any changes (or explicitly discarding them) is permitted until the last screen editing the file is exited, at which time the changes must be saved or discarded. The rreessiizzee command permits resizing of individual screens. Screens may be grown, shrunk or set to an absolute number of rows. The ^^WW command is used to switch between screens. Each ^^WW moves to the next lower screen in the window, or to the first screen in the window if there are no lower screens. The bbgg command "backgrounds" the current screen. The screen disappears from the window, and the rows it occupied are taken over by a neighboring screen. It is an error to attempt to background the only screen in the window. The ddiissppllaayy ssccrreeeennss command displays the names of the files associated with the current backgrounded screens in the window. VVii//EExx RReeffeerreennccee UUSSDD::1133--1111 The ffgg [[ffiillee]] command moves the specified screen from the list of backgrounded screens to the foreground. If no file argument is specified, the first screen on the list is foregrounded. By default, foregrounding consists of back- grounding the current screen, and replacing its space in the window with the foregrounded screen. Capitalizing the first letter of the command, i.e. FFgg, will foreground the backgrounded screen in a new screen instead of swapping it with the current screen. If the last foregrounded screen in the window is exited, and there are backgrounded screens, the first screen on the list of backgrounded screens takes over the window. 88.. TTaaggss,, TTaagg SSttaacckkss,, aanndd CCssccooppee NNvvii supports the historic vvii tag command <>, and the historic eexx tag command ttaagg. These commands change the current file context to a new location, based on infor- mation found in the tags ffiilleess.. IIff yyoouu aarree uunnffaammiilliiaarr wwiitthh tthheessee ccoommmmaannddss,, yyoouu sshhoouulldd rreevviieeww tthheeiirr ddeessccrriippttiioonn iinn tthhee eexx aanndd vvii ccoommmmaannddss sseeccttiioonn ooff tthhiiss mmaannuuaall.. FFoorr aaddddiittiioonnaall iinnffoorrmmaattiioonn oonn ttaaggss ffiilleess,, sseeee tthhee ddiissccuussssiioonn ooff tthhee ttaaggss eeddiitt ooppttiioonn aanndd tthhee ssyysstteemm _c_t_a_g_s((11)) mmaannuuaall ppaaggee.. In addition, nnvvii supports the notion of "tags stacks", using the <> command. The <> command returns the user to the previous context, i.e., the last place from which a <> or ttaagg command was entered. These three commands provide the basic functionality which allows you to use vvii to review source code in a structured manner. NNvvii also provides two other basic eexx commands for tag support: ttaaggppoopp and ttaaggttoopp. The ttaaggppoopp command is identical to the <> command, with the additional functional- ity that you may specify that modifications to the current file are to be discarded. This cannot be done using the <> command. The ttaaggttoopp command discards all of the contexts that have been pushed onto the tag stack, returning to the context from which the first <> or ttaagg com- mand was entered. The historic _c_t_a_g_s(1) tags file format supports only a single location per tag, normally the function declaration or structure or string definition. More sophisticated source code tools often provide multiple locations per tag, e.g., a list of the places from which a function is called or a string definition is used. An example of this func- tionality is the System V source code tool, ccssccooppee. CCssccooppee creates a database of information on source code UUSSDD::1133--1122 VVii//EExx RReeffeerreennccee files, and supports a query language for that information as described in the _c_s_c_o_p_e(1) manual page. NNvvii contains an interface to the ccssccooppee query language which permits you to query ccssccooppee and then sequentially step through the loca- tions in the sources files which ccssccooppee returns. There are two nnvvii commands which support this ability to step through multiple locations. They are the eexx commands ttaaggnneexxtt and ttaaggpprreevv. The ttaaggnneexxtt command moves to the next location for the current tag. The ttaaggpprreevv command moves to the previous location for the current tag. (See the ttaaggnneexxtt and ttaaggpprreevv command discussion in the eexx commands section of this manual for more information.) At any time during this sequential walk, you may use the <>, ttaagg or ccssccooppee commands to move to a new tag context, and then use the <> or ttaaggppoopp commands to return and continue stepping through the locations for this tag. This is similar to the previous model of a simple tag stack, except that each entry in the tag stack may have more than one file context that is of interest. Although there is no widely distributed version of _c_t_a_g_s(1) that creates tags files with multiple locations per tag, nnvvii has been written to understand the obvious exten- sion to the historic tags file format, i.e., more than a single line in the tags file with the same initial tag name. If you wish to extend your ccttaaggss implementation or other tool with which you build tags files, this extension should be simple and will require no changes to nnvvii. The nnvvii and ccssccooppee interface is based on the new eexx command ccssccooppee, which has five subcommands: aadddd, ffiinndd, hheellpp, kkiillll and rreesseett. The subcommand ffiinndd itself has eight sub- commands: cc, dd, ee, ff, gg, ii, ss and tt. ccss[[ccooppee]] aa[[dddd]] ffiillee The aadddd command attaches to the specified ccssccooppee database. The file name is expanded using the standard filename expansions. If ffiillee is a directory, the file "cscope.out" in that directory is used as the database. After nnvvii attaches to a new database, all subsequent ccssccooppee queries will be asked of that database. The result of any single query is the collection of response to the query from all of the attached databases. If the "CSCOPE_DIRS" environmental variable is set when nnvvii is run, it is expected to be a or -separated list of ccssccooppee databases or directories containing ccssccooppee databases, to which the user wishes to attach. ::ccss[[ccooppee]] ff[[iinndd]] cc||dd||ee||ff||gg||ii||ss||tt bbuuffffeerr||ppaatttteerrnn The ffiinndd command is the ccssccooppee query command for nnvvii. For this command, nnvvii queries all attached ccssccooppee VVii//EExx RReeffeerreennccee UUSSDD::1133--1133 databases for the pattern. If the pattern is a double- quote character followed by a valid buffer name (e.g., ")),, tthheenn tthhee ccoonntteennttss ooff tthhee nnaammeedd bbuuffffeerr aarree uusseedd aass tthhee ppaatttteerrnn.. OOtthheerrwwiissee,, tthhee ppaatttteerrnn iiss aa RReegguullaarr EExxpprreessssiioonn.. TThhee ffiinndd ccoommmmaanndd ppuusshheess tthhee ccuurrrreenntt llooccaattiioonn oonnttoo tthhee ttaaggss ssttaacckk,, aanndd sswwiittcchheess ttoo tthhee ffiirrsstt llooccaattiioonn rreessuulltt-- iinngg ffrroomm tthhee qquueerryy,, iiff tthhee qquueerryy rreettuurrnneedd aatt lleeaasstt oonnee rreessuulltt.. FFiillee nnaammeess rreettuurrnneedd bbyy tthhee ccssccooppee qquueerryy,, iiff nnoott aabbssoo-- lluuttee ppaatthhss,, aarree sseeaarrcchheedd ffoorr rreellaattiivvee ttoo tthhee ddiirreeccttoorryy wwhheerree tthhee ccssccooppee ddaattaabbaassee iiss llooccaatteedd.. IInn aaddddiittiioonn,, iiff tthhee ffiillee ""ccssccooppee..ttppaatthh"" aappppeeaarrss iinn tthhee ssaammee ddiirreeccttoorryy aass tthhee ccssccooppee ddaattaabbaassee,, iitt iiss eexxppeecctteedd ttoo ccoonnttaaiinn aa ccoolloonn--sseeppaarraatteedd lliisstt ooff ddiirreeccttoorryy nnaammeess wwhheerree ffiilleess rreeffeerreenncceedd bbyy iittss aassssoocciiaatteedd ccssccooppee ddaattaabbaassee mmaayy bbee ffoouunndd.. TThhee ffiinndd ssuubbccoommmmaanndd iiss oonnee ooff tthhee ffoolllloowwiinngg:: c Find callers of the name. d Find all function calls made from name. e Find pattern. f Find files with name as substring. g Find definition of name. i Find files #including name. s Find all uses of name. t Find assignments to name. ::ccss[[ccooppee]] hh[[eellpp]] [[ccoommmmaanndd]] List the ccssccooppee commands, or optionally list usage help for any single ccssccooppee command. ::ddiissppllaayy cc[[oonnnneeccttiioonnss]] Display the list of ccssccooppee databases to which nnvvii is currently connected. ::ccss[[ccooppee]] kk[[iillll]] ## Disconnect from a specific ccssccooppee database. The con- nection number is the one displayed by the eexx ddiissppllaayy ccoonnnneeccttiioonnss command. ::ccss[[ccooppee]] rr[[eesseett]] Disconnect from all attached ccssccooppee databases. Cscope is not freely redistributable software, but is fairly inexpensive and easily available. To purchase a copy of ccssccooppee, see http://www.att.com/ssg/products/toolch- est.html. UUSSDD::1133--1144 VVii//EExx RReeffeerreennccee 99.. RReegguullaarr EExxpprreessssiioonnss aanndd RReeppllaacceemmeenntt SSttrriinnggss Regular expressions are used in line addresses, as the first part of the eexx ssuubbssttiittuuttee, gglloobbaall, and vv commands, and in search patterns. The regular expressions supported by eexx/vvii are, by default, the Basic Regular Expressions (BRE's) described in the IEEE POSIX Standard 1003.2. The eexxtteennddeedd option causes all regular expressions to be interpreted as the Extended Regular Expressions (ERE's) described by the same standard. (See _r_e___f_o_r_m_a_t(7) for more information.) Generally speak- ing, BRE's are the Regular Expressions found in _e_d(1) and _g_r_e_p(1), and ERE's are the Regular Expressions found in _e_g_r_e_p(1). The following is not intended to provide a description of Regular Expressions. The information here only describes strings and characters which have special meanings in the eexx/vvii version of RE's, or options which change the meanings of characters that normally have special meanings in RE's. (1) An empty RE (e.g. "//" or "??" is equivalent to the last RE used. (2) The construct "\<" matches the beginning of a word. (3) The construct "\>" matches the end of a word. (4) The character "~" matches the replacement part of the last ssuubbssttiittuuttee command. When the mmaaggiicc option is _n_o_t set, the only characters with special meanings are a "^_" _c_h_a_r_a_c_t_e_r _a_t _t_h_e _b_e_g_i_n_n_i_n_g _o_f _a_n _R_E_, _a _"_$" character at the end of an RE, and the escaping character "\_"_. _T_h_e _c_h_a_r_a_c_t_e_r_s _"_.", "*_"_, _"_[" and "~_" _a_r_e _t_r_e_a_t_e_d _a_s _o_r_d_i_n_a_r_y _c_h_a_r_a_c_t_e_r_s _u_n_l_e_s_s _p_r_e_c_e_d_e_d _b_y _a _"_\"; when preceded by a "\_" _t_h_e_y _r_e_g_a_i_n _t_h_e_i_r _s_p_e_c_i_a_l _m_e_a_n_- _i_n_g_. Replacement strings are the second part of a ssuubbssttiittuuttee command. The character "&" (or "\&" if the mmaaggiicc option is _n_o_t set) in the replacement string stands for the text matched by the RE that is being replaced. The character "~_" _(_o_r _"_\_~" if the mmaaggiicc option is _n_o_t set) stands for the replace- ment part of the previous ssuubbssttiittuuttee command. It is only valid after a ssuubbssttiittuuttee command has been performed. The string "\#", where "#" is an integer value from 1 to 9, stands for the text matched by the portion of the RE enclosed in the "#"'th set of escaped parentheses, e.g. VVii//EExx RReeffeerreennccee UUSSDD::1133--1155 "\(" and "\)". For example, "s/abc\(.*\)def/\1/" deletes the strings "abc" and "def" from the matched pattern. The strings "\l", "\u", "\L" and "\U" can be used to modify the case of elements in the replacement string. The string "\l" causes the next character to be converted to lowercase; the string "\u" behaves similarly, but converts to uppercase (e.g. s/abc/\U&/ replaces the string abc with ABC). The string "\L" causes characters up to the end of the string or the next occurrence of the strings "\e" or "\E" to be converted to lowercase; the string "\U" behaves similarly, but converts to uppercase. If the entire replacement pattern is "%", then the last replacement pattern is used again. In vvii, inserting a iinnttoo tthhee rreeppllaacceemmeenntt ssttrriinngg wwiillll ccaauussee tthhee mmaattcchheedd lliinnee ttoo bbee sspplliitt iinnttoo ttwwoo lliinneess aatt tthhaatt ppooiinntt.. ((TThhee <> will be discarded.) 1100.. SSccrriippttiinngg LLaanngguuaaggeess The nnvvii editor currently supports two scripting lan- guages, Tcl/Tk and Perl. (Note that Perl4 isn't sufficient, and that the Perl5 used must be version 5.002 or later. See the "BBuuiillddiinngg NNvvii" section for more information. The scripting language interface is still being worked on, therefore the following information is probably incom- plete, probably wrong in cases, and likely to change. See the perl_api and tcl_api source directories for more infor- mation. As a quick reference, the following function calls are provided for both the Perl and Tcl interfaces. The Perl interface uses a slightly different naming convention, e.g. ``viFindScreen'' is named ``VI::FindScreen''. vviiFFiinnddSSccrreeeenn ffiillee Return the screenIdaassssoocciiaatteedd ffiillee. vviiAAppppeennddLLiinnee ssccrreeeennIIdd lliinneeNNuummbbeerr tteexxtt Append text aass aa nneeww lliinnee aafftteerr lliinnee nnuummbbeerr lliinneeNNuummbbeerr, in the screen screenId.. vviiDDeellLLiinnee ssccrreeeennIIdd lliinneeNNuumm Delete the line lineNumber ffrroomm tthhee ssccrreeeenn ssccrreeeennIIdd. vviiGGeettLLiinnee ssccrreeeennIIdd lliinneeNNuummbbeerr Return the line lineNumber ffrroomm tthhee ssccrreeeenn ssccrreeeennIIdd. vviiIInnsseerrttLLiinnee ssccrreeeennIIdd lliinneeNNuummbbeerr tteexxtt Insert text aass aa nneeww lliinnee bbeeffoorree lliinnee nnuummbbeerr lliinneeNNuummbbeerr in the screen screenId.. UUSSDD::1133--1166 VVii//EExx RReeffeerreennccee vviiLLaassttLLiinnee ssccrreeeennIIdd Return the line number of the last line in the screen screenId.. vviiSSeettLLiinnee ssccrreeeennIIdd lliinneeNNuummbbeerr tteexxtt Change the line lineNumber iinn tthhee ssccrreeeenn ssccrreeeennIIdd to match the specified text.. vviiGGeettMMaarrkk ssccrreeeennIIdd mmaarrkk Return the current line and column for the specified mark ffrroomm tthhee ssccrreeeenn ssccrreeeennIIdd. vviiSSeettMMaarrkk ssccrreeeennIIdd mmaarrkk lliinnee ccoolluummnn Set the specified mark ttoo bbee aatt lliinnee lliinnee, column col- umn,, iinn tthhee ssccrreeeenn ssccrreeeennIIdd. vviiGGeettCCuurrssoorr ssccrreeeennIIdd Return the current line and column for the cursor in the screen screenId.. vviiSSeettCCuurrssoorr ssccrreeeennIIdd lliinnee ccoolluummnn Set the cursor in the screen screenId ttoo tthhee ssppeecciiffiieedd lliinnee and column.. vviiMMssgg ssccrreeeennIIdd tteexxtt Display the specified text aass aa vvii mmeessssaaggee iinn tthhee ssccrreeeenn ssccrreeeennIIdd. vviiNNeewwSSccrreeeenn ssccrreeeennIIdd [[ffiillee]] Create a new screen. vviiEEnnddSSccrreeeenn ssccrreeeennIIdd Exit the screen screenId.. vviiSSwwiittcchhSSccrreeeenn ssccrreeeennIIdd ssccrreeeennIIdd Switch from the screen screenId ttoo tthhee ssccrreeeenn ssccrreeeennIIdd. vviiMMaappKKeeyy ssccrreeeennIIdd kkeeyy ttccllpprroocc Map the specified key iinn tthhee ssccrreeeenn ssccrreeeennIIdd to the Tcl procedure tclproc.. vviiUUnnmmMMaappKKeeyy ssccrreeeennIIdd kkeeyy Unmap the specified key iinn tthhee ssccrreeeenn ssccrreeeennIIdd vviiGGeettOOpptt ssccrreeeennIIdd ooppttiioonn Return the value of the specified option ffrroomm tthhee ssccrreeeenn ssccrreeeennIIdd. vviiSSeettOOpptt ssccrreeeennIIdd ccoommmmaanndd Set one or more options in the screen screenId.. VVii//EExx RReeffeerreennccee UUSSDD::1133--1177 1111.. GGeenneerraall EEddiittoorr DDeessccrriippttiioonn When eexx or vvii are executed, the text of a file is read (or a temporary file is created), and then all editing changes happen within the context of the copy of the file. _N_o _c_h_a_n_g_e_s _a_f_f_e_c_t _t_h_e _a_c_t_u_a_l _f_i_l_e _u_n_t_i_l _t_h_e _f_i_l_e _i_s _w_r_i_t_t_e_n _o_u_t, either using a write command or another command which is affected by the aauuttoowwrriittee option. All files are locked (using the _f_l_o_c_k(2) or _f_c_n_t_l(2) interfaces) during the edit session, to avoid inadvertently making modifications to multiple copies of the file. If a lock cannot be obtained for a file because it is locked by another process, the edit session is read-only (as if the rreeaaddoonnllyy option or the --RR flag had been specified). If a lock cannot be obtained for other reasons, the edit session will continue, but the file status information (see the <> command) will reflect this fact. Both eexx and vvii are modeful editors, i.e. they have two modes, "command" mode and "text input" mode. The former is intended to permit you to enter commands which modifies already existing text. The latter is intended to permit you to enter new text. When eexx first starts running, it is in command mode, and usually displays a prompt (see the pprroommpptt option for more information). The prompt is a single colon (":"")) cchhaarraacctteerr.. TThheerree aarree tthhrreeee ccoommmmaannddss tthhaatt sswwiittcchh eexx iinnttoo tteexxtt iinnppuutt mmooddee:: aappppeenndd,, cchhaannggee aanndd iinnsseerrtt.. OOnnccee iinn iinnppuutt mmooddee,, eenntteerriinngg aa lliinnee ccoonnttaaiinniinngg oonnllyy aa ssiinnggllee ppeerriioodd (("".."")) eennddss tteexxtt iinnppuutt mmooddee aanndd rreettuurrnnss ttoo ccoommmmaanndd mmooddee,, wwhheerree tthhee pprroommpptt iiss rreeddiissppllaayyeedd.. When vvii first starts running, it is in command mode as well. There are eleven commands that switch vvii into text input mode: AA, aa, CC, cc, II, ii, OO, oo, RR, SS and ss. Once in input mode, entering an cchhaarraacctteerr eennddss tteexxtt iinnppuutt mmooddee aanndd rreettuurrnnss ttoo ccoommmmaanndd mmooddee.. EExx/vvii present three different interfaces to editing a file. EExx presents a line oriented interface. VVii presents a full screen display oriented interface, also known as "visual mode". In addition, there is a third mode, "open mode", which is line oriented, but supports cursor movement and editing within the displayed line, similarly to visual mode. Open mode is not yet implemented in nnvvii. The following words have special meanings in both the eexx and vvii command descriptions: <> The interrupt character is used to interrupt the cur- rent operation. Normally ,, wwhhaatteevveerr cchhaarraacc-- tteerr iiss sseett ffoorr tthhee ccuurrrreenntt tteerrmmiinnaall iiss uusseedd.. UUSSDD::1133--1188 VVii//EExx RReeffeerreennccee <> The literal next character is used to escape the subse- quent character from any special meaning. This charac- ter is always .. IIff tthhee tteerrmmiinnaall iiss nnoott sseett uupp ttoo ddoo XXOONN//XXOOFFFF ffllooww ccoonnttrrooll,, tthheenn <> is used to mean literal next as well. ccuurrrreenntt ppaatthhnnaammee The pathname of the file currently being edited by vi. When the percent character ("%"")) aappppeeaarrss iinn aa ffiillee nnaammee eenntteerreedd aass ppaarrtt ooff aann eexx ccoommmmaanndd aarrgguummeenntt,, iitt iiss rreeppllaacceedd bbyy tthhee ccuurrrreenntt ppaatthhnnaammee.. ((TThhee ""%%"" cchhaarraacctteerr ccaann bbee eessccaappeedd bbyy pprreecceeddiinngg iitt wwiitthh aa bbaacckkssllaasshh..)) aalltteerrnnaattee ppaatthhnnaammee The name of the last file name mentioned in an eexx com- mand, or, the previous current pathname if the last file mentioned becomes the current file. When the hash mark character ("#"")) aappppeeaarrss iinn aa ffiillee nnaammee eenntteerreedd aass ppaarrtt ooff aann eexx ccoommmmaanndd aarrgguummeenntt,, iitt iiss rreeppllaacceedd bbyy tthhee aalltteerrnnaattee ppaatthhnnaammee.. ((TThhee ""##"" cchhaarraacctteerr ccaann bbee eessccaappeedd bbyy pprreecceeddiinngg iitt wwiitthh aa bbaacckkssllaasshh..)) bbuuffffeerr One of a number of named areas for saving copies of text. Commands that change or delete text can save the changed or deleted text into a specific buffer, for later use, if the command allows it (i.e. the eexx cchhaannggee command cannot save the changed text in a named buffer). Buffers are named with a single character, preceded by a double quote, e.g. " iinn vvii aanndd wwiitthhoouutt tthhee ddoouubbllee qquuoottee,, ee..gg.. <>,, iinn eexx.. ((TThhee ddoouubbllee qquuoottee iissnn''tt nneecceessssaarryy ffoorr eexx bbeeccaauussee bbuuffffeerrss nnaammeess aarree ddeennootteedd bbyy tthheeiirr ppoossiittiioonn iinn tthhee ccoomm-- mmaanndd lliinnee..)) HHiissttoorriicc iimmpplleemmeennttaattiioonnss ooff eexx//vvii lliimmiitteedd <> ttoo tthhee aallpphhaannuummeerriicc cchhaarraacctteerrss;; nneexx//nnvvii ppeerrmmiittss tthhee uussee ooff aannyy cchhaarraacctteerr wwiitthhoouutt aannootthheerr mmeeaann-- iinngg iinn tthhee ppoossiittiioonn wwhheerree aa bbuuffffeerr nnaammee iiss eexxppeecctteedd.. BBuuffffeerrss nnaammeedd bbyy uuppppeerrccaassee cchhaarraacctteerrss aarree tthhee ssaammee aass bbuuffffeerrss nnaammeedd bbyy lloowweerrccaassee cchhaarraacctteerrss,, ee..gg.. tthhee bbuuffffeerr nnaammeedd bbyy tthhee EEnngglliisshh cchhaarraacctteerr ""AA"" iiss tthhee ssaammee aass tthhee bbuuffffeerr nnaammeedd bbyy tthhee cchhaarraacctteerr ""aa"",, wwiitthh tthhee eexxcceeppttiioonn tthhaatt,, iiff tthhee bbuuffffeerr ccoonntteennttss aarree bbeeiinngg cchhaannggeedd ((aass wwiitthh aa tteexxtt ddeelleettiioonn oorr vvii cchhaannggee ccoommmmaanndd)),, tthhee tteexxtt iiss _a_p_p_e_n_d_e_d ttoo tthhee bbuuffffeerr,, iinnsstteeaadd ooff rreeppllaacciinngg tthhee ccuurr-- rreenntt ccoonntteennttss.. TThhee bbuuffffeerrss nnaammeedd bbyy tthhee nnuummeerriicc cchhaarraacctteerrss ((iinn EEnngglliisshh,, ""11_" _t_h_r_o_u_g_h _"_9"")),, aarree ssppeecciiaall.. IIff aa rreeggiioonn ooff tteexxtt iinncclluuddiinngg cchhaarraacctteerrss ffrroomm mmoorree tthhaann oonnee lliinnee,, oorr aa ssiinnggllee lliinnee ooff tteexxtt ssppeecciiffiieedd bbyy uussiinngg aa lliinnee--oorriieenntteedd mmoottiioonn,, iiss cchhaannggeedd oorr ddeelleetteedd iinn tthhee ffiillee uussiinngg tthhee vvii VVii//EExx RReeffeerreennccee UUSSDD::1133--1199 cchhaannggee oorr ddeelleettee ccoommmmaannddss,, aa ccooppyy ooff tthhee tteexxtt iiss ppllaacceedd iinnttoo tthhee nnuummeerriicc bbuuffffeerr ""11"",, rreeggaarrddlleessss ooff tthhee uusseerr ssppeecciiffyyiinngg aannootthheerr bbuuffffeerr iinn wwhhiicchh ttoo ssaavvee iitt.. IInn aaddddiittiioonn,, tthheerree aarree aa ffeeww ccoommmmaannddss wwhhiicchh,, wwhheenn uusseedd aass aa mmoottiioonn wwiitthh tthhee vvii cchhaannggee aanndd ddeelleettee ccoommmmaannddss,, _a_l_w_a_y_s ccooppyy tthhee ssppeecciiffiieedd rreeggiioonn ooff tteexxtt iinnttoo tthhee nnuummeerriicc bbuuffffeerrss rreeggaarrddlleessss ooff tthhee rreeggiioonn iinncclluuddiinngg cchhaarraacctteerrss ffrroomm mmoorree tthhaann oonnee lliinnee.. TThheessee ccoommmmaannddss aarree:: <> %% (( )) ``<> // ?? NN nn {{ }} Before this copy is done, the previous contents of buffer "1"" aarree mmoovveedd iinnttoo bbuuffffeerr ""22", "2"" iinnttoo bbuuffffeerr ""33", and so on. The contents of buffer "9"" aarree ddiiss-- ccaarrddeedd.. IInn vvii,, tteexxtt mmaayy bbee eexxpplliicciittllyy ssttoorreedd iinnttoo tthhee nnuummeerriicc bbuuffffeerrss.. IInn tthhiiss ccaassee,, tthhee bbuuffffeerr rroottaattiioonn ddeessccrriibbeedd aabboovvee ooccccuurrss bbeeffoorree tthhee rreeppllaacceemmeenntt ooff tthhee bbuuffffeerr''ss ccoonntteennttss.. TThhee nnuummeerriicc bbuuffffeerrss aarree oonnllyy aavvaaiill-- aabbllee iinn vviissuuaall aanndd ooppeenn mmooddeess,, aanndd aarree nnoott aacccceessssiibbllee bbyy eexx iinn aannyy wwaayy,, aalltthhoouugghh cchhaannggeedd aanndd ddeelleetteedd tteexxtt iiss ssttiillll ssttoorreedd tthheerree wwhhiillee iinn eexx mmooddee.. WWhheenn aa vvii ccoommmmaanndd ssyynnooppssiiss sshhoowwss bbootthh aa [[bbuuffffeerr]] aanndd aa [[ccoouunntt]],, tthheeyy mmaayy bbee pprreesseenntteedd iinn aannyy oorrddeerr.. FFiinnaallllyy,, aallll bbuuffffeerrss aarree eeiitthheerr ""lliinnee"" oorr ""cchhaarraacctteerr"" oorriieenntteedd.. AAllll eexx ccoommmmaannddss wwhhiicchh ssttoorree tteexxtt iinnttoo bbuuffffeerrss aarree lliinnee oorriieenntteedd.. SSoommee vvii ccoommmmaannddss wwhhiicchh ssttoorree tteexxtt iinnttoo bbuuffffeerrss aarree lliinnee oorriieenntteedd,, aanndd ssoommee aarree cchhaarraacctteerr oorriieenntteedd;; tthhee ddeessccrriippttiioonn ffoorr eeaacchh aapppplliiccaabbllee vvii ccoommmmaanndd nnootteess wwhheetthheerr tteexxtt ccooppiieedd iinnttoo bbuuffffeerrss uussiinngg tthhee ccoommmmaanndd iiss lliinnee oorr cchhaarraacctteerr oorriieenntteedd.. IInn aaddddii-- ttiioonn,, tthhee vvii ccoommmmaanndd ddiissppllaayy bbuuffffeerrss ddiissppllaayyss tthhee ccuurr-- rreenntt oorriieennttaattiioonn ffoorr eeaacchh bbuuffffeerr.. GGeenneerraallllyy,, tthhee oonnllyy iimmppoorrttaannccee aattttaacchheedd ttoo tthhiiss oorriieennttaattiioonn iiss tthhaatt iiff tthhee bbuuffffeerr iiss ssuubbsseeqquueennttllyy iinnsseerrtteedd iinnttoo tthhee tteexxtt,, lliinnee oorriieenntteedd bbuuffffeerrss ccrreeaattee nneeww lliinneess ffoorr eeaacchh ooff tthhee lliinneess tthheeyy ccoonnttaaiinn,, aanndd cchhaarraacctteerr oorriieenntteedd bbuuffffeerrss ccrreeaattee nneeww lliinneess ffoorr aannyy lliinneess _o_t_h_e_r tthhaann tthhee ffiirrsstt aanndd llaasstt lliinneess tthheeyy ccoonnttaaiinn.. TThhee ffiirrsstt aanndd llaasstt lliinneess aarree iinnsseerrtteedd iinnttoo tthhee tteexxtt aatt tthhee ccuurrrreenntt ccuurrssoorr ppoossiittiioonn,, bbeeccoommiinngg ppaarrtt ooff tthhee ccuurrrreenntt lliinnee.. IIff tthheerree iiss mmoorree tthhaann oonnee lliinnee iinn tthhee bbuuffffeerr,, hhoowweevveerr,, tthhee ccuurrrreenntt lliinnee iittsseellff wwiillll bbee sspplliitt.. uunnnnaammeedd bbuuffffeerr The unnamed buffer is a text storage area which is used by commands that use or operate on a buffer when no UUSSDD::1133--2200 VVii//EExx RReeffeerreennccee buffer is specified by the user. If the command stores text into a buffer, the text is stored into the unnamed buffer even if a buffer is also specified by the user. It is not possible to append text to the unnamed buffer. If text is appended to a named buffer, the named buffer contains both the old and new text, while the unnamed buffer contains only the new text. There is no way to explicitly reference the unnamed buffer. Historically, the contents of the unnamed buffer were discarded by many different commands, even ones that didn't store text into it. NNeexx/nnvvii never discards the contents of the unnamed buffer until new text replaces them. wwhhiitteessppaaccee The characters and . <> The character represented by an ASCII .. TThhiiss cchhaarraacctteerr iiss aallmmoosstt aallwwaayyss ttrreeaatteedd iiddeennttiiccaallllyy ttoo aa <> character, but differs in that it can be escaped into the file text or into a command. <> The character represented by an ASCII .. TThhiiss cchhaarraacctteerr iiss aallmmoosstt aallwwaayyss ttrreeaatteedd iiddeennttiiccaallllyy ttoo aa <> character, but differs in that it cannot be escaped into the file text or into a command. 1122.. VVii DDeessccrriippttiioonn VVii takes up the entire screen to display the edited file, except for the bottom line of the screen. The bottom line of the screen is used to enter eexx commands, and for vvii error and informational messages. If no other information is being displayed, the default display can show the current cursor row and cursor column, an indication of whether the file has been modified, and the current mode of the editor. See the rruulleerr and sshhoowwmmooddee options for more information. Empty lines do not have any special representation on the screen, but lines on the screen that would logically come after the end of the file are displayed as a single tilde ("~") character. To differentiate between empty lines and lines consisting of only whitespace characters, use the lliisstt option. Historically, implementations of vvii have also displayed some lines as single asterisk ("@"")) cchhaarraacctteerrss.. TThheessee wweerree lliinneess tthhaatt wweerree nnoott ccoorrrreeccttllyy ddiissppllaayyeedd,, ii..ee.. lliinneess oonn tthhee ssccrreeeenn tthhaatt ddiidd nnoott ccoorrrreessppoonndd ttoo lliinneess iinn tthhee ffiillee,, oorr lliinneess tthhaatt ddiidd nnoott ffiitt oonn tthhee ccuurrrreenntt ssccrreeeenn.. NNvvii nneevveerr ddiissppllaayyss lliinneess iinn tthhiiss ffaasshhiioonn.. VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--2211 VVii is a modeful editor, i.e. it has two modes, "com- mand" mode and "text input" mode. When vvii first starts, it is in command mode. There are several commands that change vvii into text input mode. The cchhaarraacctteerr iiss uusseedd ttoo rreessoollvvee tthhee tteexxtt iinnppuutt iinnttoo tthhee ffiillee,, aanndd eexxiitt bbaacckk iinnttoo ccoommmmaanndd mmooddee.. IInn vvii ccoommmmaanndd mmooddee,, tthhee ccuurrssoorr iiss aallwwaayyss ppoossiittiioonneedd oonn tthhee llaasstt ccoolluummnn ooff cchhaarraacctteerrss wwhhiicchh ttaakkee uupp mmoorree tthhaann oonnee ccoolluummnn oonn tthhee ssccrreeeenn.. IInn vvii tteexxtt iinnsseerrtt mmooddee,, tthhee ccuurrssoorr iiss ppoossiittiioonneedd oonn tthhee ffiirrsstt ccoolluummnn ooff cchhaarraacctteerrss wwhhiicchh ttaakkee uupp mmoorree tthhaann oonnee ccoolluummnn oonn tthhee ssccrreeeenn.. When positioning the cursor to a new line and column, the type of movement is defined by the distance to the new cursor position. If the new position is close, the screen is scrolled to the new location. If the new position is far away, the screen is repainted so that the new position is on the screen. If the screen is scrolled, it is moved a mini- mal amount, and the cursor line will usually appear at the top or bottom of the screen. If the screen is repainted, the cursor line will appear in the center of the screen, unless the cursor is sufficiently close to the beginning or end of the file that this isn't possible. If the lleeffttrriigghhtt option is set, the screen may be scrolled or repainted in a horizontal direction as well as in a vertical one. A major difference between the historical vvii presenta- tion and nnvvii is in the scrolling and screen oriented posi- tion commands, <>, <>, <>, <>, <>, <>, HH, LL and MM. In histori- cal implementations of vvii, these commands acted on physical (as opposed to logical, or screen) lines. For lines that were sufficiently long in relation to the size of the screen, this meant that single line scroll commands might repaint the entire screen, scrolling or screen positioning commands might not change the screen or move the cursor at all, and some lines simply could not be displayed, even though vvii would edit the file that contained them. In nnvvii, these commands act on logical, i.e. screen lines. You are unlikely to notice any difference unless you are editing files with lines significantly longer than a screen width. VVii keeps track of the currently "most attractive" cur- sor position. Each command description (for commands that alter the current cursor position), specifies if the cursor is set to a specific location in the line, or if it is moved to the "most attractive cursor position". The latter means that the cursor is moved to the cursor position that is hor- izontally as close as possible to the current cursor posi- tion. If the current line is shorter than the cursor posi- tion vvii would select, the cursor is positioned on the last character in the line. (If the line is empty, the cursor is positioned on the first column of the line.) If a command moves the cursor to the most attractive position, it does UUSSDD::1133--2222 VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) not alter the current cursor position, and a subsequent movement will again attempt to move the cursor to that posi- tion. Therefore, although a movement to a line shorter than the currently most attractive position will cause the cursor to move to the end of that line, a subsequent movement to a longer line will cause the cursor to move back to the most attractive position. In addition, the $$ command makes the end of each line the most attractive cursor position rather than a specific column. Each vvii command described below notes where the cursor ends up after it is executed. This position is described in terms of characters on the line, i.e. "the previous charac- ter", or, "the last character in the line". This is to avoid needing to continually refer to on what part of the character the cursor rests. The following words have special meaning for vvii com- mands. pprreevviioouuss ccoonntteexxtt The position of the cursor before the command which caused the last absolute movement was executed. Each vvii command described in the next section that is con- sidered an absolute movement is so noted. In addition, specifying _a_n_y address to an eexx command is considered an absolute movement. mmoottiioonn A second vvii command can be used as an optional trailing argument to the vvii <<, >>, !!, cc, dd, yy, and (depending on the ttiillddeeoopp option) ~~ commands. This command indicates the end of the region of text that's affected by the command. The motion command may be either the command character repeated (in which case it means the current line) or a cursor movement command. In the latter case, the region affected by the command is from the starting or stopping cursor position which comes first in the file, to immediately before the starting or stopping cursor position which comes later in the file. Commands that operate on lines instead of using begin- ning and ending cursor positions operate on all of the lines that are wholly or partially in the region. In addition, some other commands become line oriented depending on where in the text they are used. The com- mand descriptions below note these special cases. The following commands may all be used as motion compo- nents for vvii commands: VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--2233 $ % ' ( ) + , - / 0 ; ? B E F G H L M N T W [[ ]] ^ _ ` b e f h j k l n t w { | } The optional count prefix available for some of the vvii commands that take motion commands, or the count prefix available for the vvii commands that are used as motion components, may be included and is _a_l_w_a_y_s considered part of the motion argument. For example, the commands "c2w_" _a_n_d _"_2_c_w" are equivalent, and the region affected by the cc command is two words of text. In addition, if the optional count prefix is specified for both the vvii command and its motion component, the effect is multi- plicative and is considered part of the motion argu- ment. For example, the commands "4cw"" aanndd ""22cc22ww" are equivalent, and the region affected by the cc command is four words of text. ccoouunntt A positive number used as an optional argument to most commands, either to give a size or a position (for dis- play or movement commands), or as a repeat count (for commands that modify text). The count argument is always optional and defaults to 1 unless otherwise noted in the command description. When a vvii command synopsis shows both a [buffer] aanndd [[ccoouunntt]], they may be presented in any order. wwoorrdd Generally, in languages where it is applicable, vvii rec- ognizes two kinds of words. First, a sequence of let- ters, digits and underscores, delimited at both ends by: characters other than letters, digits, or under- scores, the beginning or end of a line, and the begin- ning or end of the file. Second, a sequence of charac- ters other than letters, digits, underscores, or whitespace characters, delimited at both ends by: a letter, digit, underscore, or whitespace character, the beginning or end of a line, and the beginning or end of the file. For example, the characters " !@#abc$%^ "" ccoonnttaaiinn tthhrreeee wwoorrddss:: ""!!@@##", "abc"" aanndd ""$$%%^^". UUSSDD::1133--2244 VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) Groups of empty lines (or lines containing only whites- pace characters) are treated as a single word. bbiiggwwoorrdd A set of non-whitespace characters preceded and fol- lowed by whitespace characters or the beginning or end of the file or line. For example, the characters " !@#abc$%^ "" ccoonnttaaiinn oonnee bbiiggwwoorrdd:: ""!!@@##aabbcc$$%%^^". Groups of empty lines (or lines containing only whites- pace characters) are treated as a single bigword. ppaarraaggrraapphh An area of text that begins with either the beginning of a file, an empty line, or a section boundary, and continues until either an empty line, section boundary, or the end of the file. Groups of empty lines (or lines containing only whites- pace characters) are treated as a single paragraph. Additional paragraph boundaries can be defined using the ppaarraaggrraapphhss option. sseeccttiioonn An area of text that starts with the beginning of the file or a line whose first character is an open brace ("{"")) aanndd ccoonnttiinnuueess uunnttiill tthhee nneexxtt sseeccttiioonn oorr tthhee eenndd ooff tthhee ffiillee.. AAddddiittiioonnaall sseeccttiioonn bboouunnddaarriieess ccaann bbee ddeeffiinneedd uussiinngg tthhee sseeccttiioonnss ooppttiioonn.. sseenntteennccee An area of text that begins with either the beginning of the file or the first nonblank character following the previous sentence, paragraph, or section boundary and continues until the end of the file or a period ("."")) eexxccllaammaattiioonn ppooiinntt ((""!!") or question mark ("?"")) cchhaarraacctteerr,, ffoolllloowweedd bbyy eeiitthheerr aann eenndd--ooff--lliinnee oorr ttwwoo wwhhiitteessppaaccee cchhaarraacctteerrss.. AAnnyy nnuummbbeerr ooff cclloossiinngg ppaarreenntthhee-- sseess ((""))"), brackets ("]"")),, ddoouubbllee--qquuoottee ((""""") or single quote ("'"")) cchhaarraacctteerrss ccaann aappppeeaarr bbeettwweeeenn tthhee ppeerriioodd,, eexxccllaammaattiioonn ppooiinntt,, oorr qquueessttiioonn mmaarrkk aanndd tthhee wwhhiitteessppaaccee cchhaarraacctteerrss oorr eenndd--ooff--lliinnee.. GGrroouuppss ooff eemmppttyy lliinneess ((oorr lliinneess ccoonnttaaiinniinngg oonnllyy wwhhiitteess-- ppaaccee cchhaarraacctteerrss)) aarree ttrreeaatteedd aass aa ssiinnggllee sseenntteennccee.. 1133.. VVii CCoommmmaannddss The following section describes the commands available in the command mode of the vvii editor. In each entry below, VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--2255 the tag line is a usage synopsis for the command character. In addition, the final line and column the cursor rests upon, and any options which affect the command are noted. [[ccoouunntt]] <> Search forward count ttiimmeess ffoorr tthhee ccuurrrreenntt wwoorrdd.. TThhee ccuurrrreenntt wwoorrdd bbeeggiinnss aatt tthhee ffiirrsstt nnoonn--wwhhiitteessppaaccee cchhaarraacc-- tteerr oonn oorr aafftteerr tthhee ccuurrrreenntt ccuurrssoorr ppoossiittiioonn,, aanndd eexxtteennddss uupp ttoo tthhee nneexxtt nnoonn--wwoorrdd cchhaarraacctteerr oorr tthhee eenndd ooff tthhee lliinnee.. TThhee sseeaarrcchh iiss lliitteerraall,, ii..ee.. nnoo cchhaarraacctteerrss iinn tthhee wwoorrdd hhaavvee aannyy ssppeecciiaall mmeeaanniinngg iinn tteerrmmss ooff RReegguullaarr EExxpprreessssiioonnss.. IItt iiss aann eerrrroorr iiff nnoo mmaattcchhiinngg ppaatttteerrnn iiss ffoouunndd bbeettwweeeenn tthhee ssttaarrttiinngg ppoossiittiioonn aanndd tthhee eenndd ooff tthhee ffiillee.. TThhee <> ccoommmmaanndd iiss aann aabbssoolluuttee mmoovveemmeenntt.. TThhee <> ccoommmmaanndd mmaayy bbee uusseedd aass tthhee mmoottiioonn ccoommppoonneenntt ooff ootthheerr vvii ccoommmmaannddss,, iinn wwhhiicchh ccaassee aannyy tteexxtt ccooppiieedd iinnttoo aa bbuuffffeerr iiss cchhaarraacctteerr oorriieenntteedd.. Line: Set to the line where the word is found. Column: Set to the first character of the word. Options: Affected by the iiggnnoorreeccaassee and wwrraappssccaann options. [[ccoouunntt]] <> Page backward count ssccrreeeennss.. TTwwoo lliinneess ooff oovveerrllaapp aarree mmaaiinnttaaiinneedd,, iiff ppoossssiibbllee,, bbyy ddiissppllaayyiinngg tthhee wwiinnddooww ssttaarrttiinngg aatt lliinnee ((ttoopp__lliinnee -- ccoouunntt ** wwiinnddooww__ssiizzee)) ++ 22, where window_size iiss tthhee vvaalluuee ooff tthhee wwiinnddooww ooppttiioonn.. ((IInn tthhee ccaassee ooff sspplliitt ssccrreeeennss,, tthhiiss ssiizzee iiss ccoorrrreecctteedd ttoo tthhee ccuurrrreenntt ssccrreeeenn ssiizzee..)) IItt iiss aann eerrrroorr iiff tthhee mmoovveemmeenntt iiss ppaasstt tthhee bbeeggiinnnniinngg ooff tthhee ffiillee.. Line: Set to the last line of text displayed on the screen. Column: Set to the first nonblank character of the line. Options: Affected by the wwiinnddooww option. [[ccoouunntt]] <> Scroll forward count lliinneess.. IIff ccoouunntt is not specified, scroll forward the number of lines specified by the last <> or <> command. If this is the first <> or <> command, scroll forward half the number of lines in the screen. (In the case of split screens, the default scrolling dis- tance is corrected to half the current screen size.) It is an error if the movement is past the end of the file. Line: Set to the current line plus the number of lines scrolled. UUSSDD::1133--2266 VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) Column: Set to the first nonblank character of the line. Options: None. [[ccoouunntt]] <> Scroll forward count lliinneess,, lleeaavviinngg tthhee ccuurrssoorr oonn tthhee ccuurrrreenntt lliinnee aanndd ccoolluummnn,, iiff ppoossssiibbllee.. IItt iiss aann eerrrroorr iiff tthhee mmoovveemmeenntt iiss ppaasstt tthhee eenndd ooff tthhee ffiillee.. Line: Unchanged unless the current line scrolls off the screen, in which case it is set to the first line on the screen. Column: Unchanged unless the current line scrolls off the screen, in which case it is set to the most attractive cursor position. Options: None. [[ccoouunntt]] <> Page forward count ssccrreeeennss.. TTwwoo lliinneess ooff oovveerrllaapp aarree mmaaiinnttaaiinneedd,, iiff ppoossssiibbllee,, bbyy ddiissppllaayyiinngg tthhee wwiinnddooww ssttaarrttiinngg aatt lliinnee ttoopp__lliinnee ++ ccoouunntt ** wwiinnddooww__ssiizzee -- 22, where window_size iiss tthhee vvaalluuee ooff tthhee wwiinnddooww ooppttiioonn.. ((IInn tthhee ccaassee ooff sspplliitt ssccrreeeennss,, tthhiiss ssiizzee iiss ccoorrrreecctteedd ttoo tthhee ccuurrrreenntt ssccrreeeenn ssiizzee..)) IItt iiss aann eerrrroorr iiff tthhee mmoovveemmeenntt iiss ppaasstt tthhee eenndd ooff tthhee ffiillee.. Line: Set to the first line on the screen. Column: Set to the first nonblank character of the current line. Options: Affected by the wwiinnddooww option. <> Display the file information. The information includes the current pathname, the current line, the number of total lines in the file, the current line as a percent- age of the total lines in the file, if the file has been modified, was able to be locked, if the file's name has been changed, and if the edit session is read- only. Line: Unchanged. Column: Unchanged. Options: None. [[ccoouunntt]] <> [[ccoouunntt]] hh Move the cursor back count cchhaarraacctteerrss iinn tthhee ccuurrrreenntt lliinnee.. IItt iiss aann eerrrroorr iiff tthhee ccuurrssoorr iiss oonn tthhee ffiirrsstt cchhaarraacctteerr iinn tthhee lliinnee.. TThhee <> aanndd hh ccoommmmaannddss mmaayy bbee uusseedd aass tthhee mmoottiioonn ccoommppoonneenntt ooff ootthheerr vvii ccoommmmaannddss,, iinn wwhhiicchh ccaassee aannyy tteexxtt ccooppiieedd iinnttoo aa bbuuffffeerr iiss cchhaarraacctteerr oorriieenntteedd.. VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--2277 Line: Unchanged. Column: Set to the current - count character, or, the first character in the line if count is greater than or equal to the number of charac- ters in the line before the cursor. Options: None. [[ccoouunntt]] <> [[ccoouunntt]] <> [[ccoouunntt]] jj Move the cursor down count lliinneess wwiitthhoouutt cchhaannggiinngg tthhee ccuurrrreenntt ccoolluummnn.. IItt iiss aann eerrrroorr iiff tthhee mmoovveemmeenntt iiss ppaasstt tthhee eenndd ooff tthhee ffiillee.. TThhee <>,, <> aanndd jj ccoommmmaannddss mmaayy bbee uusseedd aass tthhee mmoottiioonn ccoommppoonneenntt ooff ootthheerr vvii ccoommmmaannddss,, iinn wwhhiicchh ccaassee aannyy tteexxtt ccooppiieedd iinnttoo aa bbuuffffeerr iiss lliinnee oorriieenntteedd.. Line: Set to the current line plus count.. Column: The most attractive cursor position. Options: None. <> <> Repaint the screen. Line: Unchanged. Column: Unchanged. Options: None. [[ccoouunntt]] <> [[ccoouunntt]] ++ Move the cursor down count lliinneess ttoo tthhee ffiirrsstt nnoonnbbllaannkk cchhaarraacctteerr ooff tthhaatt lliinnee.. IItt iiss aann eerrrroorr iiff tthhee mmoovveemmeenntt iiss ppaasstt tthhee eenndd ooff tthhee ffiillee.. TThhee <> aanndd ++ ccoommmmaannddss mmaayy bbee uusseedd aass tthhee mmoottiioonn ccoommppoonneenntt ooff ootthheerr vvii ccoommmmaannddss,, iinn wwhhiicchh ccaassee aannyy tteexxtt ccooppiieedd iinnttoo aa bbuuffffeerr iiss lliinnee oorriieenntteedd.. Line: Set to the current line plus count.. Column: Set to the first nonblank character in the line. Options: None. [[ccoouunntt]] <> [[ccoouunntt]] kk Move the cursor up count lliinneess,, wwiitthhoouutt cchhaannggiinngg tthhee ccuurrrreenntt ccoolluummnn.. IItt iiss aann eerrrroorr iiff tthhee mmoovveemmeenntt iiss ppaasstt tthhee bbeeggiinnnniinngg ooff tthhee ffiillee.. TThhee <> aanndd kk ccoommmmaannddss mmaayy bbee uusseedd aass tthhee mmoottiioonn ccoommppoonneenntt ooff ootthheerr vvii ccoommmmaannddss,, iinn wwhhiicchh ccaassee UUSSDD::1133--2288 VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) aannyy tteexxtt ccooppiieedd iinnttoo aa bbuuffffeerr iiss lliinnee oorriieenntteedd.. Line: Set to the current line minus count.. Column: The most attractive cursor position. Options: None. <> Return to the most recent tag context. The <> command is an absolute movement. Line: Set to the context of the previous tag com- mand. Column: Set to the context of the previous tag com- mand. Options: None. [[ccoouunntt]] <> Scroll backward count lliinneess.. IIff ccoouunntt is not speci- fied, scroll backward the number of lines specified by the last <> or <> command. If this is the first <> or <> command, scroll backward half the number of lines in the screen. (In the case of split screens, the default scrolling dis- tance is corrected to half the current screen size.) It is an error if the movement is past the beginning of the file. Line: Set to the current line minus the amount scrolled. Column: Set to the first nonblank character in the line. Options: None. <> Switch to the next lower screen in the window, or, to the first screen if there are no lower screens in the window. Line: Set to the previous cursor position in the window. Column: Set to the previous cursor position in the window. Options: None. [[ccoouunntt]] <> Scroll backward count lliinneess,, lleeaavviinngg tthhee ccuurrrreenntt lliinnee aanndd ccoolluummnn aass iiss,, iiff ppoossssiibbllee.. IItt iiss aann eerrrroorr iiff tthhee mmoovveemmeenntt iiss ppaasstt tthhee bbeeggiinnnniinngg ooff tthhee ffiillee.. Line: Unchanged unless the current line scrolls off the screen, in which case it is set to the last line of text displayed on the screen. VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--2299 Column: Unchanged unless the current line scrolls off the screen, in which case it is the most attractive cursor position. Options: None. <> Suspend the current editor session. If the file has been modified since it was last completely written, and the aauuttoowwrriittee option is set, the file is written before the editor session is suspended. If this write fails, the editor session is not suspended. Line: Unchanged. Column: Unchanged. Options: Affected by the aauuttoowwrriittee option. <> Execute eexx commands or cancel partial commands. If an eexx command is being entered (e.g. //, ??, :: or !!), the command is executed. If a partial command has been entered, e.g. "[0-9]*"",, oorr ""[[00--99]]**[[!!<<>>ccddyy]]", the com- mand is cancelled. Otherwise, it is an error. Line: When an eexx command is being executed, the cur- rent line is set as described for that com- mand. Otherwise, unchanged. Column: When an eexx command is being executed, the cur- rent column is set as described for that com- mand. Otherwise, unchanged. Options: None. <> Push a tag reference onto the tag stack. The tags files (see the ttaaggss option for more information) are searched for a tag matching the current word. The cur- rent word begins at the first non-whitespace character on or after the current cursor position, and extends up to the next non-word character or the end of the line. If a matching tag is found, the current file is dis- carded and the file containing the tag reference is edited. If the current file has been modified since it was last completely written, the command will fail. The <> command is an absolute movement. Line: Set to the line containing the matching tag string. Column: Set to the start of the matching tag string. Options: Affected by the ttaaggss and ttaagglleennggtthh options. <> Switch to the most recently edited file. UUSSDD::1133--3300 VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) If the file has been modified since it was last com- pletely written, and the aauuttoowwrriittee option is set, the file is written out. If this write fails, the command will fail. Otherwise, if the current file has been modified since it was last completely written, the com- mand will fail. Line: Set to the line the cursor was on when the file was last edited. Column: Set to the column the cursor was on when the file was last edited. Options: Affected by the aauuttoowwrriittee option. [[ccoouunntt]] <> [[ccoouunntt]] ll Move the cursor forward count cchhaarraacctteerrss wwiitthhoouutt cchhaanngg-- iinngg tthhee ccuurrrreenntt lliinnee.. IItt iiss aann eerrrroorr iiff tthhee ccuurrssoorr iiss oonn tthhee llaasstt cchhaarraacctteerr iinn tthhee lliinnee.. TThhee <> aanndd ll ccoommmmaannddss mmaayy bbee uusseedd aass tthhee mmoottiioonn ccoommppoonneenntt ooff ootthheerr vvii ccoommmmaannddss,, iinn wwhhiicchh ccaassee aannyy tteexxtt ccooppiieedd iinnttoo aa bbuuffffeerr iiss cchhaarraacctteerr oorriieenntteedd.. IInn aaddddii-- ttiioonn,, tthheessee ccoommmmaannddss mmaayy bbee uusseedd aass tthhee mmoottiioonn ccoommppoo-- nneennttss ooff ootthheerr ccoommmmaannddss wwhheenn tthhee ccuurrssoorr iiss oonn tthhee llaasstt cchhaarraacctteerr iinn tthhee lliinnee,, wwiitthhoouutt eerrrroorr.. Line: Unchanged. Column: Set to the current character plus the next count characters, or to the last character on the line if count is greater than the number of characters in the line after the current character. Options: None. [[ccoouunntt]] !! mmoottiioonn sshheellll--aarrgguummeenntt((ss))<> Replace text with results from a shell command. Pass the lines specified by the count aanndd mmoottiioonn arguments as standard input to the program named by the sshheellll option, and replace those lines with the output (both standard error and standard output) of that command. After the motion is entered, vvii prompts for arguments to the shell command. Within those arguments, "%"" aanndd ""##" characters are expanded to the current and alternate pathnames, respectively. The "!"" cchhaarraacctteerr iiss eexxppaannddeedd wwiitthh tthhee ccoommmmaanndd tteexxtt ooff tthhee pprreevviioouuss !! oorr ::!! ccoommmmaannddss.. ((TThheerreeffoorree,, tthhee ccoommmmaanndd !!<>!! rreeppeeaattss tthhee pprreevvii-- oouuss !! ccoommmmaanndd..)) TThhee ssppeecciiaall mmeeaanniinnggss ooff ""%%"",, ""##"" aanndd ""!!"" ccaann bbee oovveerrrriiddddeenn bbyy eessccaappiinngg tthheemm wwiitthh aa bbaacckk-- ssllaasshh.. IIff nnoo !! oorr ::!! ccoommmmaanndd hhaass yyeett bbeeeenn eexxeeccuutteedd,, iitt iiss aann eerrrroorr ttoo uussee aann uunneessccaappeedd ""!!"" cchhaarraacctteerr aass aa VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--3311 sshheellll aarrgguummeenntt.. TThhee !! ccoommmmaanndd ddooeess _n_o_t ddoo sshheellll eexxppaannssiioonn oonn tthhee ssttrriinnggss pprroovviiddeedd aass aarrgguummeennttss.. IIff aannyy ooff tthhee aabboovvee eexxppaannssiioonnss cchhaannggee tthhee aarrgguummeennttss tthhee uusseerr eenntteerreedd,, tthhee ccoommmmaanndd iiss rreeddiissppllaayyeedd aatt tthhee bboottttoomm ooff tthhee ssccrreeeenn.. VVii tthheenn eexxeeccuutteess tthhee pprrooggrraamm nnaammeedd bbyy tthhee sshheellll ooppttiioonn,, wwiitthh aa --cc ffllaagg ffoolllloowweedd bbyy tthhee aarrgguummeennttss ((wwhhiicchh aarree bbuunnddlleedd iinnttoo aa ssiinnggllee aarrgguummeenntt)).. TThhee !! ccoommmmaanndd iiss ppeerrmmiitttteedd iinn aann eemmppttyy ffiillee.. IIff tthhee ffiillee hhaass bbeeeenn mmooddiiffiieedd ssiinnccee iitt wwaass llaasstt ccoomm-- pplleetteellyy wwrriitttteenn,, tthhee !! ccoommmmaanndd wwiillll wwaarrnn yyoouu.. Line: The first line of the replaced text. Column: The first column of the replaced text. Options: Affected by the sshheellll option. [[ccoouunntt]] ## ##||++||-- Increment or decrement the number referenced by the cursor. If the trailing character is a + oorr ##, the number is incremented by count.. IIff tthhee ttrraaiilliinngg cchhaarr-- aacctteerr iiss aa --, the number is decremented by count.. AA lleeaaddiinngg ""00XX" or "0x"" ccaauusseess tthhee nnuummbbeerr ttoo bbee iinntteerr-- pprreetteedd aass aa hheexxaaddeecciimmaall nnuummbbeerr.. OOtthheerrwwiissee,, aa lleeaaddiinngg ""00" causes the number to be interpreted as an octal number, unless a non-octal digit is found as part of the number. Otherwise, the number is interpreted as a decimal number, and may have a leading + oorr -- sign. The current number begins at the first non-blank char- acter at or after the current cursor position, and extends up to the end of the line or the first charac- ter that isn't a possible character for the numeric type. The format of the number (e.g. leading 0's, signs) is retained unless the new value cannot be rep- resented in the previous format. Octal and hexadecimal numbers, and the result of the operation, must fit into an "unsigned long"".. SSiimmii-- llaarrllyy,, ddeecciimmaall nnuummbbeerrss aanndd tthheeiirr rreessuulltt mmuusstt ffiitt iinnttoo aa ""ssiiggnneedd lloonngg". It is an error to use this command when the cursor is not positioned at a number. Line: Unchanged. Column: Set to the first character in the cursor num- ber. Options: None. [[ccoouunntt]] $$ Move the cursor to the end of a line. If count iiss UUSSDD::1133--3322 VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) ssppeecciiffiieedd,, tthhee ccuurrssoorr mmoovveess ddoowwnn ccoouunntt -- 11 lines. It is not an error to use the $$ command when the cursor is on the last character in the line or when the line is empty. The $$ command may be used as the motion component of other vvii commands, in which case any text copied into a buffer is character oriented, unless the cursor is at, or before the first nonblank character in the line, in which case it is line oriented. It is not an error to use the $$ command as a motion component when the cursor is on the last character in the line, although it is an error when the line is empty. Line: Set to the current line plus count minus 1. Column: Set to the last character in the line. Options: None. %% Move to the matching character. The cursor moves to the parenthesis or curly brace which _m_a_t_c_h_e_s the paren- thesis or curly brace found at the current cursor posi- tion or which is the closest one to the right of the cursor on the line. It is an error to execute the %% command on a line without a parenthesis or curly brace. Historically, any count ssppeecciiffiieedd ttoo tthhee %% ccoommmmaanndd wwaass iiggnnoorreedd.. TThhee %% ccoommmmaanndd iiss aann aabbssoolluuttee mmoovveemmeenntt.. TThhee %% ccoommmmaanndd mmaayy bbee uusseedd aass tthhee mmoottiioonn ccoommppoonneenntt ooff ootthheerr vvii ccoomm-- mmaannddss,, iinn wwhhiicchh ccaassee aannyy tteexxtt ccooppiieedd iinnttoo aa bbuuffffeerr iiss cchhaarraacctteerr oorriieenntteedd,, uunnlleessss tthhee ssttaarrttiinngg ppooiinntt ooff tthhee rreeggiioonn iiss aatt oorr bbeeffoorree tthhee ffiirrsstt nnoonnbbllaannkk cchhaarraacctteerr oonn iittss lliinnee,, aanndd tthhee eennddiinngg ppooiinntt iiss aatt oorr aafftteerr tthhee llaasstt nnoonnbbllaannkk cchhaarraacctteerr oonn iittss lliinnee,, iinn wwhhiicchh ccaassee iitt iiss lliinnee oorriieenntteedd.. Line: Set to the line containing the matching char- acter. Column: Set to the matching character. Options: None. && Repeat the previous substitution command on the current line. Historically, any count ssppeecciiffiieedd ttoo tthhee && ccoommmmaanndd wwaass iiggnnoorreedd.. Line: Unchanged. Column: Unchanged if the cursor was on the last char- acter in the line, otherwise, set to the first VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--3333 nonblank character in the line. Options: Affected by the eeddccoommppaattiibbllee, eexxtteennddeedd, iiggnnoorreeccaassee and mmaaggiicc options. ''<> ``<> Return to a context marked by the character .. IIff <> is the "'"" oorr ""``" character, return to the previous context. If iiss aannyy ootthheerr cchhaarraacctteerr,, rreettuurrnn ttoo tthhee ccoonntteexxtt mmaarrkkeedd bbyy tthhaatt cchhaarraacctteerr ((sseeee tthhee mm ccoommmmaanndd ffoorr mmoorree iinnffoorrmmaattiioonn)).. IIff tthhee ccoommmmaanndd iiss tthhee '' ccoommmmaanndd,, oonnllyy tthhee lliinnee vvaalluuee iiss rreessttoorreedd,, aanndd tthhee ccuurrssoorr iiss ppllaacceedd oonn tthhee ffiirrsstt nnoonn-- bbllaannkk cchhaarraacctteerr ooff tthhaatt lliinnee.. IIff tthhee ccoommmmaanndd iiss tthhee `` ccoommmmaanndd,, bbootthh tthhee lliinnee aanndd ccoolluummnn vvaalluueess aarree rreessttoorreedd.. IItt iiss aann eerrrroorr iiff tthhee ccoonntteexxtt nnoo lloonnggeerr eexxiissttss bbeeccaauussee ooff lliinnee ddeelleettiioonn.. ((CCoonntteexxttss ffoollllooww lliinneess tthhaatt aarree mmoovveedd,, oorr wwhhiicchh aarree ddeelleetteedd aanndd tthheenn rreessttoorreedd..)) TThhee '' aanndd `` ccoommmmaannddss aarree bbootthh aabbssoolluuttee mmoovveemmeennttss.. TThheeyy mmaayy bbee uusseedd aass aa mmoottiioonn ccoommppoonneenntt ffoorr ootthheerr vvii ccoomm-- mmaannddss.. FFoorr tthhee '' ccoommmmaanndd,, aannyy tteexxtt ccooppiieedd iinnttoo aa bbuuffffeerr iiss lliinnee oorriieenntteedd.. FFoorr tthhee `` ccoommmmaanndd,, aannyy tteexxtt ccooppiieedd iinnttoo aa bbuuffffeerr iiss cchhaarraacctteerr oorriieenntteedd,, uunnlleessss iitt bbootthh ssttaarrttss aanndd ssttooppss aatt tthhee ffiirrsstt cchhaarraacctteerr iinn tthhee lliinnee,, iinn wwhhiicchh ccaassee iitt iiss lliinnee oorriieenntteedd.. IInn aaddddiittiioonn,, wwhheenn uussiinngg tthhee `` ccoommmmaanndd aass aa mmoottiioonn ccoommppoonneenntt,, ccoomm-- mmaannddss wwhhiicchh mmoovvee bbaacckkwwaarrdd aanndd ssttaarrtteedd aatt tthhee ffiirrsstt cchhaarraacctteerr iinn tthhee lliinnee,, oorr mmoovvee ffoorrwwaarrdd aanndd eennddeedd aatt tthhee ffiirrsstt cchhaarraacctteerr iinn tthhee lliinnee,, aarree ccoorrrreecctteedd ttoo tthhee llaasstt cchhaarraacctteerr ooff tthhee lliinnee pprreecceeddiinngg tthhee ssttaarrttiinngg aanndd eennddiinngg lliinneess,, rreessppeeccttiivveellyy.. Line: Set to the line from the context. Column: Set to the first nonblank character in the line, for the '' command, and set to the con- text's column for the `` command. Options: None. [[ccoouunntt]] (( Back up count sseenntteenncceess.. TThhee (( ccoommmmaanndd iiss aann aabbssoolluuttee mmoovveemmeenntt.. TThhee (( ccoommmmaanndd mmaayy bbee uusseedd aass tthhee mmoottiioonn ccoommppoonneenntt ooff ootthheerr vvii ccoomm-- mmaannddss,, iinn wwhhiicchh ccaassee aannyy tteexxtt ccooppiieedd iinnttoo aa bbuuffffeerr iiss cchhaarraacctteerr oorriieenntteedd,, uunnlleessss tthhee ssttaarrttiinngg aanndd ssttooppppiinngg ppooiinnttss ooff tthhee rreeggiioonn aarree tthhee ffiirrsstt cchhaarraacctteerr iinn tthhee lliinnee,, iinn wwhhiicchh ccaassee iitt iiss lliinnee oorriieenntteedd.. IIff iitt iiss lliinnee oorriieenntteedd,, tthhee ssttaarrttiinngg ppooiinntt ooff tthhee rreeggiioonn iiss aaddjjuusstteedd ttoo bbee tthhee eenndd ooff tthhee lliinnee iimmmmeeddiiaatteellyy bbeeffoorree tthhee ssttaarrtt-- iinngg ccuurrssoorr ppoossiittiioonn.. UUSSDD::1133--3344 VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) Line: Set to the line containing the beginning of the sentence. Column: Set to the first nonblank character of the sentence. Options: Affected by the lliisspp option. [[ccoouunntt]] )) Move forward count sseenntteenncceess.. TThhee )) ccoommmmaanndd iiss aann aabbssoolluuttee mmoovveemmeenntt.. TThhee )) ccoommmmaanndd mmaayy bbee uusseedd aass tthhee mmoottiioonn ccoommppoonneenntt ooff ootthheerr vvii ccoomm-- mmaannddss,, iinn wwhhiicchh ccaassee aannyy tteexxtt ccooppiieedd iinnttoo aa bbuuffffeerr iiss cchhaarraacctteerr oorriieenntteedd,, uunnlleessss tthhee ssttaarrttiinngg ppooiinntt ooff tthhee rreeggiioonn iiss tthhee ffiirrsstt cchhaarraacctteerr iinn tthhee lliinnee,, iinn wwhhiicchh ccaassee iitt iiss lliinnee oorriieenntteedd.. IInn tthhee llaatttteerr ccaassee,, iiff tthhee ssttooppppiinngg ppooiinntt ooff tthhee rreeggiioonn iiss aallssoo tthhee ffiirrsstt cchhaarraacc-- tteerr iinn tthhee lliinnee,, iitt iiss aaddjjuusstteedd ttoo bbee tthhee eenndd ooff tthhee lliinnee iimmmmeeddiiaatteellyy bbeeffoorree iitt.. Line: Set to the line containing the beginning of the sentence. Column: Set to the first nonblank character of the sentence. Options: Affected by the lliisspp option. [[ccoouunntt]] ,, Reverse find character count ttiimmeess.. RReevveerrssee tthhee llaasstt FF,, ff,, TT oorr tt ccoommmmaanndd,, sseeaarrcchhiinngg tthhee ootthheerr wwaayy iinn tthhee lliinnee,, ccoouunntt ttiimmeess.. IItt iiss aann eerrrroorr iiff aa FF,, ff,, TT oorr tt ccoommmmaanndd hhaass nnoott bbeeeenn ppeerrffoorrmmeedd yyeett.. TThhee ,, ccoommmmaanndd mmaayy bbee uusseedd aass tthhee mmoottiioonn ccoommppoonneenntt ooff ootthheerr vvii ccoommmmaannddss,, iinn wwhhiicchh ccaassee aannyy tteexxtt ccooppiieedd iinnttoo aa bbuuffffeerr iiss cchhaarraacctteerr oorriieenntteedd.. Line: Unchanged. Column: Set to the searched-for character for the FF and ff commands, before the character for the tt command and after the character for the TT com- mand. Options: None. [[ccoouunntt]] -- Move to the first nonblank of the previous line, count ttiimmeess.. IItt iiss aann eerrrroorr iiff tthhee mmoovveemmeenntt iiss ppaasstt tthhee bbeeggiinnnniinngg ooff tthhee ffiillee.. TThhee -- ccoommmmaanndd mmaayy bbee uusseedd aass tthhee mmoottiioonn ccoommppoonneenntt ooff ootthheerr vvii ccoommmmaannddss,, iinn wwhhiicchh ccaassee aannyy tteexxtt ccooppiieedd iinnttoo aa bbuuffffeerr iiss lliinnee oorriieenntteedd.. VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--3355 Line: Set to the current line minus count.. Column: Set to the first nonblank character in the line. Options: None. [[ccoouunntt]] .. Repeat the last vvii command that modified text. The repeated command may be a command and motion component combination. If count iiss ssppeecciiffiieedd,, iitt rreeppllaacceess _b_o_t_h tthhee ccoouunntt ssppeecciiffiieedd ffoorr tthhee rreeppeeaatteedd ccoommmmaanndd,, aanndd,, iiff aapppplliiccaabbllee,, ffoorr tthhee rreeppeeaatteedd mmoottiioonn ccoommppoonneenntt.. IIff ccoouunntt _i_s _n_o_t _s_p_e_c_i_f_i_e_d_, _t_h_e _c_o_u_n_t_s _o_r_i_g_i_n_a_l_l_y _s_p_e_c_i_f_i_e_d _t_o _t_h_e _c_o_m_m_a_n_d _b_e_i_n_g _r_e_p_e_a_t_e_d _a_r_e _u_s_e_d _a_g_a_i_n_. _A_s _a _s_p_e_c_i_a_l _c_a_s_e_, _i_f _t_h_e .. _c_o_m_m_a_n_d _i_s _e_x_e_c_u_t_e_d _i_m_m_e_- _d_i_a_t_e_l_y _a_f_t_e_r _t_h_e uu _c_o_m_m_a_n_d_, _t_h_e _c_h_a_n_g_e _l_o_g _i_s _r_o_l_l_e_d _f_o_r_w_a_r_d _o_r _b_a_c_k_w_a_r_d_, _d_e_p_e_n_d_i_n_g _o_n _t_h_e _a_c_t_i_o_n _o_f _t_h_e uu _c_o_m_m_a_n_d_. Line: Set as described for the repeated command. Column: Set as described for the repeated command. Options: None. //RREE<> //RREE// [[ooffffsseett]]<> ??RREE<> ??RREE?? [[ooffffsseett]]<> NN nn Search forward or backward for a regular expression. The commands beginning with a slash ("/"")) cchhaarraacctteerr aarree ffoorrwwaarrdd sseeaarrcchheess,, tthhee ccoommmmaannddss bbeeggiinnnniinngg wwiitthh aa qquueess-- ttiioonn mmaarrkk ((""??") are backward searches. VVii prompts with the leading character on the last line of the screen for a string. It then searches forward or back- ward in the file for the next occurrence of the string, which is interpreted as a Basic Regular Expression. The // and ?? commands are absolute movements. They may be used as the motion components of other vvii commands, in which case any text copied into a buffer is charac- ter oriented, unless the search started and ended on the first column of a line, in which case it is line oriented. In addition, forward searches ending at the first character of a line, and backward searches begin- ning at the first character in the line, are corrected to begin or end at the last character of the previous line. (Note, forward and backward searches can occur for both // and ?? commands, if the wwrraappssccaann option is set.) If an offset from the matched line is specified (i.e. a trailing "/"" oorr ""??" character is followed by a signed UUSSDD::1133--3366 VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) offset), the buffer will always be line oriented (e.g. "/string/+0"" wwiillll aallwwaayyss gguuaarraanntteeee aa lliinnee oorriieennttaattiioonn)).. TThhee NN ccoommmmaanndd rreeppeeaattss tthhee pprreevviioouuss sseeaarrcchh,, bbuutt iinn tthhee rreevveerrssee ddiirreeccttiioonn.. TThhee nn ccoommmmaanndd rreeppeeaattss tthhee pprreevviioouuss sseeaarrcchh.. IIff eeiitthheerr tthhee NN oorr nn ccoommmmaannddss aarree uusseedd aass mmoottiioonn ccoommppoonneennttss ffoorr tthhee !! ccoommmmaanndd,, yyoouu wwiillll nnoott bbee pprroommpptteedd ffoorr tthhee tteexxtt ooff tthhee bbaanngg ccoommmmaanndd,, iinnsstteeaadd tthhee pprreevviioouuss bbaanngg ccoommmmaanndd wwiillll bbee eexxeeccuutteedd.. MMiissssiinngg RREE''ss ((ee..gg.. ""////<>"",, ""//<>"",, ""????<>"",, oorr ""??<>"" sseeaarrcchh ffoorr tthhee llaasstt sseeaarrcchh RREE,, iinn tthhee iinnddii-- ccaatteedd ddiirreeccttiioonn.. SSeeaarrcchheess mmaayy bbee iinntteerrrruupptteedd uussiinngg tthhee <> cchhaarr-- aacctteerr.. MMuullttiippllee sseeaarrcchh ppaatttteerrnnss mmaayy bbee ggrroouuppeedd ttooggeetthheerr bbyy ddeelliimmiittiinngg tthheemm wwiitthh sseemmiiccoolloonnss aanndd zzeerroo oorr mmoorree wwhhiitteessppaaccee cchhaarraacctteerrss,, ee..gg.. //ffoooo// ;; ??bbaarr?? sseeaarrcchheess ffoorrwwaarrdd ffoorr ffoooo aanndd tthheenn,, ffrroomm tthhaatt llooccaattiioonn,, bbaacckkwwaarrddss ffoorr bbaarr.. WWhheenn sseeaarrcchh ppaatttteerrnnss aarree ggrroouuppeedd ttooggeetthheerr iinn tthhiiss mmaannnneerr,, tthhee sseeaarrcchh ppaatttteerrnnss aarree eevvaalluuaatteedd lleefftt ttoo rriigghhtt wwiitthh tthhee ffiinnaall ccuurrssoorr ppoossiittiioonn ddeetteerrmmiinneedd bbyy tthhee llaasstt sseeaarrcchh ppaatttteerrnn.. IItt iiss aallssoo ppeerrmmiissssiibbllee ttoo aappppeenndd aa zz ccoommmmaanndd ttoo tthhee sseeaarrcchh ssttrriinnggss,, ee..gg.. //ffoooo// zz.. sseeaarrcchheess ffoorrwwaarrdd ffoorr tthhee nneexxtt ooccccuurrrreennccee ooff ffoooo,, aanndd tthheenn ppoossiittiioonnss tthhaatt lliinnee iinn tthhee mmiiddddllee ooff ssccrreeeenn.. Line: Set to the line in which the match occurred. Column: Set to the first character of the matched string. Options: Affected by the eeddccoommppaattiibbllee, eexxtteennddeedd, iiggnnoorreeccaassee, mmaaggiicc, and wwrraappssccaann options. 00 Move to the first character in the current line. It is not an error to use the 00 command when the cursor is on the first character in the line, The 00 command may be used as the motion component of other vvii commands, in which case it is an error if the cursor is on the first character in the line, and any text copied into a buffer is character oriented. Line: Unchanged. Column: Set to the first character in the line. Options: None. VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--3377 :: Execute an eexx command. VVii prompts for an eexx command on the last line of the screen, using a colon (":"")) cchhaarr-- aacctteerr.. TThhee ccoommmmaanndd iiss tteerrmmiinnaatteedd bbyy aa <>, oorr <> character; all of these characters may be escaped by using a cchhaarraacctteerr.. TThhee ccoommmmaanndd iiss tthheenn eexxeeccuutteedd.. IIff tthhee eexx ccoommmmaanndd wwrriitteess ttoo tthhee ssccrreeeenn,, vvii wwiillll pprroommpptt tthhee uusseerr ffoorr aa <> bbeeffoorree ccoonnttiinnuuiinngg wwhheenn tthhee eexx ccoommmmaanndd ffiinniisshheess.. LLaarrggee aammoouunnttss ooff oouuttppuutt ffrroomm tthhee eexx ccoommmmaanndd wwiillll bbee ppaaggeedd ffoorr tthhee uusseerr,, aanndd tthhee uusseerr pprroommpptteedd ffoorr aa <> oorr <> kkeeyy ttoo ccoonn-- ttiinnuuee.. IInn ssoommee ccaasseess,, aa qquuiitt ((nnoorrmmaallllyy aa ""qq"" cchhaarraacc-- tteerr)) oorr <> mmaayy bbee eenntteerreedd ttoo iinntteerrrruupptt tthhee eexx ccoommmmaanndd.. WWhheenn tthhee eexx ccoommmmaanndd ffiinniisshheess,, aanndd tthhee uusseerr iiss pprroommpptteedd ttoo rreessuummee vviissuuaall mmooddee,, iitt iiss aallssoo ppoossssiibbllee ttoo eenntteerr aannootthheerr ""::"" cchhaarraacctteerr ffoolllloowweedd bbyy aannootthheerr eexx ccoommmmaanndd.. Line: The current line is set as described for the eexx command. Column: The current column is set as described for the eexx command. Options: Affected as described for the eexx command. [[ccoouunntt]] ;; Repeat the last character find count ttiimmeess.. TThhee llaasstt cchhaarraacctteerr ffiinndd iiss oonnee ooff tthhee FF,, ff,, TT oorr tt ccoommmmaannddss.. IItt iiss aann eerrrroorr iiff aa FF,, ff,, TT oorr tt ccoommmmaanndd hhaass nnoott bbeeeenn ppeerr-- ffoorrmmeedd yyeett.. TThhee ;; ccoommmmaanndd mmaayy bbee uusseedd aass tthhee mmoottiioonn ccoommppoonneenntt ooff ootthheerr vvii ccoommmmaannddss,, iinn wwhhiicchh ccaassee aannyy tteexxtt ccooppiieedd iinnttoo aa bbuuffffeerr iiss cchhaarraacctteerr oorriieenntteedd.. Line: Unchanged. Column: Set to the searched-for character for the FF and ff commands, before the character for the tt command and after the character for the TT com- mand. Options: None. [[ccoouunntt]] << mmoottiioonn [[ccoouunntt]] >> mmoottiioonn Shift lines left or right. Shift the number of lines in the region specified by the count aanndd mmoottiioonn left (for the << command) or right (for the >> command) by the number of columns specified by the sshhiiffttwwiiddtthh option. Only whitespace characters are deleted when shifting left. Once the first character in the line no longer contains a whitespace character, the command will UUSSDD::1133--3388 VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) succeed, but the line will not be modified. Line: Unchanged. Column: Set to the first nonblank character in the line. Options: Affected by the sshhiiffttwwiiddtthh option. @@ bbuuffffeerr Execute a named buffer. Execute the named buffer as vvii commands. The buffer may include eexx commands, too, but they must be expressed as a :: command. If the buffer is line oriented, cchhaarraacctteerrss aarree llooggiiccaallllyy aappppeennddeedd ttoo eeaacchh lliinnee ooff tthhee bbuuffffeerr.. IIff tthhee bbuuffffeerr iiss cchhaarraacctteerr oorriieenntteedd,, <> characters are logically appended to all but the last line in the buffer. If the buffer name is "@"",, oorr ""**", then the last buffer executed shall be used. It is an error to specify "@@"" oorr ""@@**" if there were no previous buffer executions. The text of a buffer may contain a @@ command, and it is possible to create infinite loops in this manner. (The cchhaarraacctteerr mmaayy bbee uusseedd ttoo iinntteerrrruupptt tthhee lloooopp..)) Line: The current line is set as described for the command(s). Column: The current column is set as described for the command(s). Options: None. [[ccoouunntt]] AA Enter input mode, appending the text after the end of the line. If count iiss ssppeecciiffiieedd,, tthhee tteexxtt iiss rreeppeeaatt-- eeddllyy iinnppuutt ccoouunntt -- 11 more times after input mode is exited. Line: Set to the last line upon which characters were entered. Column: Set to the last character entered. Options: Affected by the aallttwweerraassee, aauuttooiinnddeenntt, bbeeaauu-- ttiiffyy, sshhoowwmmaattcchh, ttttyywweerraassee and wwrraappmmaarrggiinn options. [[ccoouunntt]] BB Move backward count bbiiggwwoorrddss.. MMoovvee tthhee ccuurrssoorr bbaacckkwwaarrdd ttoo tthhee bbeeggiinnnniinngg ooff aa bbiiggwwoorrdd bbyy rreeppeeaattiinngg tthhee ffoollllooww-- iinngg aallggoorriitthhmm:: iiff tthhee ccuurrrreenntt ppoossiittiioonn iiss aatt tthhee bbeeggiinn-- nniinngg ooff aa bbiiggwwoorrdd oorr tthhee cchhaarraacctteerr aatt tthhee ccuurrrreenntt ppoossii-- ttiioonn ccaannnnoott bbee ppaarrtt ooff aa bbiiggwwoorrdd,, mmoovvee ttoo tthhee ffiirrsstt cchhaarraacctteerr ooff tthhee pprreecceeddiinngg bbiiggwwoorrdd.. OOtthheerrwwiissee,, mmoovvee ttoo tthhee ffiirrsstt cchhaarraacctteerr ooff tthhee bbiiggwwoorrdd aatt tthhee ccuurrrreenntt ppoossii-- ttiioonn.. IIff nnoo pprreecceeddiinngg bbiiggwwoorrdd eexxiissttss oonn tthhee ccuurrrreenntt lliinnee,, mmoovvee ttoo tthhee ffiirrsstt cchhaarraacctteerr ooff tthhee llaasstt bbiiggwwoorrdd VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--3399 oonn tthhee ffiirrsstt pprreecceeddiinngg lliinnee tthhaatt ccoonnttaaiinnss aa bbiiggwwoorrdd.. TThhee BB ccoommmmaanndd mmaayy bbee uusseedd aass tthhee mmoottiioonn ccoommppoonneenntt ooff ootthheerr vvii ccoommmmaannddss,, iinn wwhhiicchh ccaassee aannyy tteexxtt ccooppiieedd iinnttoo aa bbuuffffeerr iiss cchhaarraacctteerr oorriieenntteedd.. Line: Set to the line containing the word selected. Column: Set to the first character of the word selected. Options: None. [[bbuuffffeerr]] [[ccoouunntt]] CC Change text from the current position to the end-of- line. If count iiss ssppeecciiffiieedd,, tthhee iinnppuutt tteexxtt rreeppllaacceess ffrroomm tthhee ccuurrrreenntt ppoossiittiioonn ttoo tthhee eenndd--ooff--lliinnee,, pplluuss ccoouunntt -- 11 subsequent lines. Line: Set to the last line upon which characters were entered. Column: Set to the last character entered. Options: Affected by the aallttwweerraassee, aauuttooiinnddeenntt, bbeeaauu-- ttiiffyy, sshhoowwmmaattcchh, ttttyywweerraassee and wwrraappmmaarrggiinn options. [[bbuuffffeerr]] DD Delete text from the current position to the end-of- line. It is not an error to execute the DD command on an empty line. Line: Unchanged. Column: Set to the character before the current char- acter, or, column 1 if the cursor was on col- umn 1. Options: None. [[ccoouunntt]] EE Move forward count eenndd--ooff--bbiiggwwoorrddss.. MMoovvee tthhee ccuurrssoorr ffoorrwwaarrdd ttoo tthhee eenndd ooff aa bbiiggwwoorrdd bbyy rreeppeeaattiinngg tthhee ffooll-- lloowwiinngg aallggoorriitthhmm:: iiff tthhee ccuurrrreenntt ppoossiittiioonn iiss tthhee eenndd ooff aa bbiiggwwoorrdd oorr tthhee cchhaarraacctteerr aatt tthhaatt ppoossiittiioonn ccaannnnoott bbee ppaarrtt ooff aa bbiiggwwoorrdd,, mmoovvee ttoo tthhee llaasstt cchhaarraacctteerr ooff tthhee ffoolllloowwiinngg bbiiggwwoorrdd.. OOtthheerrwwiissee,, mmoovvee ttoo tthhee llaasstt cchhaarraacc-- tteerr ooff tthhee bbiiggwwoorrdd aatt tthhee ccuurrrreenntt ppoossiittiioonn.. IIff nnoo ssuucc-- cceeeeddiinngg bbiiggwwoorrdd eexxiissttss oonn tthhee ccuurrrreenntt lliinnee,, mmoovvee ttoo tthhee llaasstt cchhaarraacctteerr ooff tthhee ffiirrsstt bbiiggwwoorrdd oonn tthhee nneexxtt ffoollllooww-- iinngg lliinnee tthhaatt ccoonnttaaiinnss aa bbiiggwwoorrdd.. TThhee EE ccoommmmaanndd mmaayy bbee uusseedd aass tthhee mmoottiioonn ccoommppoonneenntt ooff ootthheerr vvii ccoommmmaannddss,, iinn wwhhiicchh ccaassee aannyy tteexxtt ccooppiieedd iinnttoo aa bbuuffffeerr iiss cchhaarraacctteerr oorriieenntteedd.. UUSSDD::1133--4400 VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) Line: Set to the line containing the word selected. Column: Set to the last character of the word selected. Options: None. [[ccoouunntt]] FF <> Search count ttiimmeess bbaacckkwwaarrdd tthhrroouugghh tthhee ccuurrrreenntt lliinnee ffoorr <>. The FF command may be used as the motion component of other vvii commands, in which case any text copied into a buffer is character oriented. Line: Unchanged. Column: Set to the searched-for character. Options: None. [[ccoouunntt]] GG Move to line count,, oorr tthhee llaasstt lliinnee ooff tthhee ffiillee iiff ccoouunntt not specified. The GG command is an absolute movement. The GG command may be used as the motion component of other vvii com- mands, in which case any text copied into a buffer is line oriented. Line: Set to count, if specified, otherwise, the last line. Column: Set to the first nonblank character in the line. Options: None. [[ccoouunntt]] HH Move to the screen line count - 1 lliinneess bbeellooww tthhee ttoopp ooff tthhee ssccrreeeenn.. TThhee HH ccoommmmaanndd iiss aann aabbssoolluuttee mmoovveemmeenntt.. TThhee HH ccoommmmaanndd mmaayy bbee uusseedd aass tthhee mmoottiioonn ccoommppoonneenntt ooff ootthheerr vvii ccoomm-- mmaannddss,, iinn wwhhiicchh ccaassee aannyy tteexxtt ccooppiieedd iinnttoo aa bbuuffffeerr iiss lliinnee oorriieenntteedd.. Line: Set to the line count - 1 lliinneess bbeellooww tthhee ttoopp ooff tthhee ssccrreeeenn.. Column: Set to the first nonblank character of the _s_c_r_e_e_n line. Options: None. [[ccoouunntt]] II Enter input mode, inserting the text at the beginning of the line. If count iiss ssppeecciiffiieedd,, tthhee tteexxtt iinnppuutt iiss rreeppeeaatteeddllyy iinnppuutt ccoouunntt -- 11 more times. VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--4411 Line: Set to the last line upon which characters were entered. Column: Set to the last character entered. Options: None. [[ccoouunntt]] JJ Join lines. If count iiss ssppeecciiffiieedd,, ccoouunntt lines are joined; a minimum of two lines are always joined, regardless of the value of count.. IIff tthhee ccuurrrreenntt lliinnee eennddss wwiitthh aa wwhhiitteessppaaccee cchhaarraacctteerr,, aallll wwhhiitteessppaaccee iiss ssttrriippppeedd ffrroomm tthhee nneexxtt lliinnee.. OOtthheerr-- wwiissee,, iiff tthhee nneexxtt lliinnee ssttaarrttss wwiitthh aa ooppeenn ppaarreenntthheessiiss ((""((") do nothing. Otherwise, if the current line ends with a question mark ("?"")),, ppeerriioodd ((""..") or exclama- tion point ("!"")),, iinnsseerrtt ttwwoo ssppaacceess.. OOtthheerrwwiissee,, iinnsseerrtt aa ssiinnggllee ssppaaccee.. IItt iiss nnoott aann eerrrroorr ttoo jjooiinn lliinneess ppaasstt tthhee eenndd ooff tthhee ffiillee,, ii..ee.. lliinneess tthhaatt ddoo nnoott eexxiisstt.. Line: Unchanged. Column: Set to the character after the last character of the next-to-last joined line. Options: None. [[ccoouunntt]] LL Move to the screen line count - 1 lliinneess aabboovvee tthhee bboott-- ttoomm ooff tthhee ssccrreeeenn.. TThhee LL ccoommmmaanndd iiss aann aabbssoolluuttee mmoovveemmeenntt.. TThhee LL ccoommmmaanndd mmaayy bbee uusseedd aass tthhee mmoottiioonn ccoommppoonneenntt ooff ootthheerr vvii ccoomm-- mmaannddss,, iinn wwhhiicchh ccaassee aannyy tteexxtt ccooppiieedd iinnttoo aa bbuuffffeerr iiss lliinnee oorriieenntteedd.. Line: Set to the line count - 1 lliinneess aabboovvee tthhee bboott-- ttoomm ooff tthhee ssccrreeeenn.. Column: Set to the first nonblank character of the _s_c_r_e_e_n line. Options: None. MM Move to the screen line in the middle of the screen. The MM command is an absolute movement. The MM command may be used as the motion component of other vvii com- mands, in which case any text copied into a buffer is line oriented. Historically, any count ssppeecciiffiieedd ttoo tthhee MM ccoommmmaanndd wwaass iiggnnoorreedd.. UUSSDD::1133--4422 VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) Line: Set to the line in the middle of the screen. Column: Set to the first nonblank character of the _s_c_r_e_e_n line. Options: None. [[ccoouunntt]] OO Enter input mode, appending text in a new line above the current line. If count iiss ssppeecciiffiieedd,, tthhee tteexxtt iinnppuutt iiss rreeppeeaatteeddllyy iinnppuutt ccoouunntt -- 11 more times. Historically, any count ssppeecciiffiieedd ttoo tthhee OO ccoommmmaanndd wwaass iiggnnoorreedd.. Line: Set to the last line upon which characters were entered. Column: Set to the last character entered. Options: Affected by the aallttwweerraassee, aauuttooiinnddeenntt, bbeeaauu-- ttiiffyy, sshhoowwmmaattcchh, ttttyywweerraassee and wwrraappmmaarrggiinn options. [[bbuuffffeerr]] PP Insert text from a buffer. Text from the buffer (the unnamed buffer by default) is inserted before the cur- rent column or, if the buffer is line oriented, before the current line. Line: Set to the lowest numbered line insert, if the buffer is line oriented, otherwise unchanged. Column: Set to the first nonblank character of the appended text, if the buffer is line oriented, otherwise, the last character of the appended text. Options: None. QQ Exit vvii (or visual) mode and switch to eexx mode. Line: Unchanged. Column: No longer relevant. Options: None. [[ccoouunntt]] RR Enter input mode, replacing the characters in the cur- rent line. If count iiss ssppeecciiffiieedd,, tthhee tteexxtt iinnppuutt iiss rreeppeeaatteeddllyy iinnppuutt ccoouunntt -- 11 more times. If the end of the current line is reached, no more characters are replaced and any further characters input are appended to the line. Line: Set to the last line upon which characters were entered. VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--4433 Column: Set to the last character entered. Options: Affected by the aallttwweerraassee, aauuttooiinnddeenntt, bbeeaauu-- ttiiffyy, sshhoowwmmaattcchh, ttttyywweerraassee and wwrraappmmaarrggiinn options. [[bbuuffffeerr]] [[ccoouunntt]] SS Substitute count lliinneess.. Line: Set to the last line upon which characters were entered. Column: Set to the last character entered. Options: Affected by the aallttwweerraassee, aauuttooiinnddeenntt, bbeeaauu-- ttiiffyy, sshhoowwmmaattcchh, ttttyywweerraassee and wwrraappmmaarrggiinn options. [[ccoouunntt]] TT <> Search backward, count ttiimmeess,, tthhrroouugghh tthhee ccuurrrreenntt lliinnee ffoorr tthhee cchhaarraacctteerr _a_f_t_e_r tthhee ssppeecciiffiieedd <>_. _T_h_e TT _c_o_m_m_a_n_d _m_a_y _b_e _u_s_e_d _a_s _t_h_e _m_o_t_i_o_n _c_o_m_p_o_n_e_n_t _o_f _o_t_h_e_r vvii _c_o_m_m_a_n_d_s_, _i_n _w_h_i_c_h _c_a_s_e _a_n_y _t_e_x_t _c_o_p_i_e_d _i_n_t_o _a _b_u_f_f_e_r _i_s _c_h_a_r_a_c_t_e_r _o_r_i_e_n_t_e_d_. Line: Unchanged. Column: Set to the character _a_f_t_e_r the searched-for character. Options: None. UU Restore the current line to its state before the cursor last moved to it. Line: Unchanged. Column: The first character in the line. Options: None. [[ccoouunntt]] WW Move forward count bbiiggwwoorrddss.. MMoovvee tthhee ccuurrssoorr ffoorrwwaarrdd ttoo tthhee bbeeggiinnnniinngg ooff aa bbiiggwwoorrdd bbyy rreeppeeaattiinngg tthhee ffoollllooww-- iinngg aallggoorriitthhmm:: iiff tthhee ccuurrrreenntt ppoossiittiioonn iiss wwiitthhiinn aa bbiigg-- wwoorrdd oorr tthhee cchhaarraacctteerr aatt tthhaatt ppoossiittiioonn ccaannnnoott bbee ppaarrtt ooff aa bbiiggwwoorrdd,, mmoovvee ttoo tthhee ffiirrsstt cchhaarraacctteerr ooff tthhee nneexxtt bbiiggwwoorrdd.. IIff nnoo ssuubbsseeqquueenntt bbiiggwwoorrdd eexxiissttss oonn tthhee ccuurr-- rreenntt lliinnee,, mmoovvee ttoo tthhee ffiirrsstt cchhaarraacctteerr ooff tthhee ffiirrsstt bbiiggwwoorrdd oonn tthhee ffiirrsstt ffoolllloowwiinngg lliinnee tthhaatt ccoonnttaaiinnss aa bbiiggwwoorrdd.. TThhee WW ccoommmmaanndd mmaayy bbee uusseedd aass tthhee mmoottiioonn ccoommppoonneenntt ooff ootthheerr vvii ccoommmmaannddss,, iinn wwhhiicchh ccaassee aannyy tteexxtt ccooppiieedd iinnttoo aa bbuuffffeerr iiss cchhaarraacctteerr oorriieenntteedd.. Line: The line containing the word selected. UUSSDD::1133--4444 VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) Column: The first character of the word selected. Options: None. [[bbuuffffeerr]] [[ccoouunntt]] XX Delete count cchhaarraacctteerrss bbeeffoorree tthhee ccuurrssoorr.. IIff tthhee nnuumm-- bbeerr ooff cchhaarraacctteerrss ttoo bbee ddeelleetteedd iiss ggrreeaatteerr tthhaann oorr eeqquuaall ttoo tthhee nnuummbbeerr ooff cchhaarraacctteerrss ttoo tthhee bbeeggiinnnniinngg ooff tthhee lliinnee,, aallll ooff tthhee cchhaarraacctteerrss bbeeffoorree tthhee ccuurrrreenntt ccuurr-- ssoorr ppoossiittiioonn,, ttoo tthhee bbeeggiinnnniinngg ooff tthhee lliinnee,, aarree ddeelleetteedd.. Line: Unchanged. Column: Set to the current character minus count, or the first character if count is greater than the number of characters in the line before the cursor. Options: None. [[bbuuffffeerr]] [[ccoouunntt]] YY Copy (or "yank") count lliinneess iinnttoo tthhee ssppeecciiffiieedd bbuuffffeerr.. Line: Unchanged. Column: Unchanged. Options: None. ZZZZ Write the file and exit vvii. The file is only written if it has been modified since the last complete write of the file to any file. The ZZZZ command will exit the editor after writing the file, if there are no further files to edit. Entering two "quit" commands (i.e. wwqq, qquuiitt, xxiitt or ZZZZ) in a row will override this check and the editor will exit, ignoring any files that have not yet been edited. Line: Unchanged. Column: Unchanged. Options: None. [[ccoouunntt]] [[[[ Back up count sseeccttiioonn bboouunnddaarriieess.. TThhee [[[[ ccoommmmaanndd iiss aann aabbssoolluuttee mmoovveemmeenntt.. TThhee [[[[ ccoommmmaanndd mmaayy bbee uusseedd aass tthhee mmoottiioonn ccoommppoonneenntt ooff ootthheerr vvii ccoomm-- mmaannddss,, iinn wwhhiicchh ccaassee aannyy tteexxtt ccooppiieedd iinnttoo aa bbuuffffeerr iiss cchhaarraacctteerr oorriieenntteedd,, uunnlleessss tthhee ssttaarrttiinngg ppoossiittiioonn iiss ccoolluummnn 00,, iinn wwhhiicchh ccaassee iitt iiss lliinnee oorriieenntteedd.. IItt iiss aann eerrrroorr iiff tthhee mmoovveemmeenntt iiss ppaasstt tthhee bbeeggiinnnniinngg ooff tthhee ffiillee.. VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--4455 Line: Set to the previous line that is count sseeccttiioonn bboouunnddaarriieess bbaacckk,, oorr tthhee ffiirrsstt lliinnee ooff tthhee ffiillee iiff nnoo mmoorree sseeccttiioonn bboouunnddaarriieess eexxiisstt pprreecceeddiinngg tthhee ccuurrrreenntt lliinnee.. Column: Set to the first nonblank character in the line. Options: Affected by the sseeccttiioonnss option. [[ccoouunntt]] ]]]] Move forward count sseeccttiioonn bboouunnddaarriieess.. TThhee ]]]] ccoommmmaanndd iiss aann aabbssoolluuttee mmoovveemmeenntt.. TThhee ]]]] ccoommmmaanndd mmaayy bbee uusseedd aass tthhee mmoottiioonn ccoommppoonneenntt ooff ootthheerr vvii ccoomm-- mmaannddss,, iinn wwhhiicchh ccaassee aannyy tteexxtt ccooppiieedd iinnttoo aa bbuuffffeerr iiss cchhaarraacctteerr oorriieenntteedd,, uunnlleessss tthhee ssttaarrttiinngg ppoossiittiioonn iiss ccoolluummnn 00,, iinn wwhhiicchh ccaassee iitt iiss lliinnee oorriieenntteedd.. IItt iiss aann eerrrroorr iiff tthhee mmoovveemmeenntt iiss ppaasstt tthhee eenndd ooff tthhee ffiillee.. Line: Set to the line that is count sseeccttiioonn bboouunndd-- aarriieess ffoorrwwaarrdd,, oorr ttoo tthhee llaasstt lliinnee ooff tthhee ffiillee iiff nnoo mmoorree sseeccttiioonn bboouunnddaarriieess eexxiisstt ffoolllloowwiinngg tthhee ccuurrrreenntt lliinnee.. Column: Set to the first nonblank character in the line. Options: Affected by the sseeccttiioonnss option. ^^ Move to first nonblank character on the current line. The ^^ command may be used as the motion component of other vvii commands, in which case any text copied into a buffer is character oriented. Line: Unchanged. Column: Set to the first nonblank character of the current line. Options: None. [[ccoouunntt]] __ Move down count - 1 lliinneess,, ttoo tthhee ffiirrsstt nnoonnbbllaannkk cchhaarr-- aacctteerr.. TThhee __ ccoommmmaanndd mmaayy bbee uusseedd aass tthhee mmoottiioonn ccoommppoo-- nneenntt ooff ootthheerr vvii ccoommmmaannddss,, iinn wwhhiicchh ccaassee aannyy tteexxtt ccooppiieedd iinnttoo aa bbuuffffeerr iiss lliinnee oorriieenntteedd.. IItt iiss nnoott aann eerrrroorr ttoo eexxeeccuuttee tthhee __ ccoommmmaanndd wwhheenn tthhee ccuurrssoorr iiss oonn tthhee ffiirrsstt cchhaarraacctteerr iinn tthhee lliinnee.. Line: The current line plus count - 1.. Column: The first nonblank character in the line. Options: None. UUSSDD::1133--4466 VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) [[ccoouunntt]] aa Enter input mode, appending the text after the cursor. If count iiss ssppeecciiffiieedd,, tthhee tteexxtt iinnppuutt iiss rreeppeeaatteeddllyy iinnppuutt ccoouunntt -- 11 more times. Line: Set to the last line upon which characters were entered. Column: Set to the last character entered. Options: Affected by the aallttwweerraassee, aauuttooiinnddeenntt, bbeeaauu-- ttiiffyy, sshhoowwmmaattcchh, ttttyywweerraassee and wwrraappmmaarrggiinn options. [[ccoouunntt]] bb Move backward count wwoorrddss.. MMoovvee tthhee ccuurrssoorr bbaacckkwwaarrdd ttoo tthhee bbeeggiinnnniinngg ooff aa wwoorrdd bbyy rreeppeeaattiinngg tthhee ffoolllloowwiinngg aallggoorriitthhmm:: iiff tthhee ccuurrrreenntt ppoossiittiioonn iiss aatt tthhee bbeeggiinnnniinngg ooff aa wwoorrdd,, mmoovvee ttoo tthhee ffiirrsstt cchhaarraacctteerr ooff tthhee pprreecceeddiinngg wwoorrdd.. OOtthheerrwwiissee,, tthhee ccuurrrreenntt ppoossiittiioonn mmoovveess ttoo tthhee ffiirrsstt cchhaarraacctteerr ooff tthhee wwoorrdd aatt tthhee ccuurrrreenntt ppoossiittiioonn.. IIff nnoo pprreecceeddiinngg wwoorrdd eexxiissttss oonn tthhee ccuurrrreenntt lliinnee,, mmoovvee ttoo tthhee ffiirrsstt cchhaarraacctteerr ooff tthhee llaasstt wwoorrdd oonn tthhee ffiirrsstt pprreecceeddiinngg lliinnee tthhaatt ccoonnttaaiinnss aa wwoorrdd.. TThhee bb ccoommmmaanndd mmaayy bbee uusseedd aass tthhee mmoottiioonn ccoommppoonneenntt ooff ootthheerr vvii ccoommmmaannddss,, iinn wwhhiicchh ccaassee aannyy tteexxtt ccooppiieedd iinnttoo aa bbuuffffeerr iiss cchhaarraacctteerr oorriieenntteedd.. Line: Set to the line containing the word selected. Column: Set to the first character of the word selected. Options: None. [[bbuuffffeerr]] [[ccoouunntt]] cc mmoottiioonn Change the region of text specified by the count aanndd mmoottiioonn. If only part of a single line is affected, then the last character being changed is marked with a "$"".. OOtthheerrwwiissee,, tthhee rreeggiioonn ooff tteexxtt iiss ddeelleetteedd,, aanndd iinnppuutt mmooddee iiss eenntteerreedd.. Line: Set to the last line upon which characters were entered. Column: Set to the last character entered. Options: Affected by the aallttwweerraassee, aauuttooiinnddeenntt, bbeeaauu-- ttiiffyy, sshhoowwmmaattcchh, ttttyywweerraassee and wwrraappmmaarrggiinn options. [[bbuuffffeerr]] [[ccoouunntt]] dd mmoottiioonn Delete the region of text specified by the count aanndd mmoottiioonn. Line: Set to the line where the region starts. Column: Set to the first character in the line after the last character in the region. If no such VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--4477 character exists, set to the last character before the region. Options: None. [[ccoouunntt]] ee Move forward count eenndd--ooff--wwoorrddss.. MMoovvee tthhee ccuurrssoorr ffoorr-- wwaarrdd ttoo tthhee eenndd ooff aa wwoorrdd bbyy rreeppeeaattiinngg tthhee ffoolllloowwiinngg aallggoorriitthhmm:: iiff tthhee ccuurrrreenntt ppoossiittiioonn iiss tthhee eenndd ooff aa wwoorrdd,, mmoovvee ttoo tthhee llaasstt cchhaarraacctteerr ooff tthhee ffoolllloowwiinngg wwoorrdd.. OOtthheerrwwiissee,, mmoovvee ttoo tthhee llaasstt cchhaarraacctteerr ooff tthhee wwoorrdd aatt tthhee ccuurrrreenntt ppoossiittiioonn.. IIff nnoo ssuucccceeeeddiinngg wwoorrdd eexxiissttss oonn tthhee ccuurrrreenntt lliinnee,, mmoovvee ttoo tthhee llaasstt cchhaarraacctteerr ooff tthhee ffiirrsstt wwoorrdd oonn tthhee nneexxtt ffoolllloowwiinngg lliinnee tthhaatt ccoonnttaaiinnss aa wwoorrdd.. TThhee ee ccoommmmaanndd mmaayy bbee uusseedd aass tthhee mmoottiioonn ccoommppoonneenntt ooff ootthheerr vvii ccoommmmaannddss,, iinn wwhhiicchh ccaassee aannyy tteexxtt ccooppiieedd iinnttoo aa bbuuffffeerr iiss cchhaarraacctteerr oorriieenntteedd.. Line: Set to the line containing the word selected. Column: Set to the last character of the word selected. Options: None. [[ccoouunntt]] ff <> Search forward, count ttiimmeess,, tthhrroouugghh tthhee rreesstt ooff tthhee ccuurrrreenntt lliinnee ffoorr <>. The ff command may be used as the motion component of other vvii commands, in which case any text copied into a buffer is character oriented. Line: Unchanged. Column: Set to the searched-for character. Options: None. [[ccoouunntt]] ii Enter input mode, inserting the text before the cursor. If count iiss ssppeecciiffiieedd,, tthhee tteexxtt iinnppuutt iiss rreeppeeaatteeddllyy iinnppuutt ccoouunntt -- 11 more times. Line: Set to the last line upon which characters were entered. Column: Set to the last character entered. Options: Affected by the aallttwweerraassee, aauuttooiinnddeenntt, bbeeaauu-- ttiiffyy, sshhoowwmmaattcchh, ttttyywweerraassee and wwrraappmmaarrggiinn options. mm <> Save the current context (line and column) as .. TThhee eexxaacctt ppoossiittiioonn iiss rreeffeerrrreedd ttoo bbyy ""``<>". The line is referred to by "'"".. UUSSDD::1133--4488 VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) HHiissttoorriiccaallllyy,, <> was restricted to lower-case letters. NNvvii permits the use of any character. Line: Unchanged. Column: Unchanged. Options: None. [[ccoouunntt]] oo Enter input mode, appending text in a new line under the current line. If count iiss ssppeecciiffiieedd,, tthhee tteexxtt iinnppuutt iiss rreeppeeaatteeddllyy iinnppuutt ccoouunntt -- 11 more times. Historically, any count ssppeecciiffiieedd ttoo tthhee oo ccoommmmaanndd wwaass iiggnnoorreedd.. Line: Set to the last line upon which characters were entered. Column: Set to the last character entered. Options: Affected by the aallttwweerraassee, aauuttooiinnddeenntt, bbeeaauu-- ttiiffyy, sshhoowwmmaattcchh, ttttyywweerraassee and wwrraappmmaarrggiinn options. [[bbuuffffeerr]] pp Append text from a buffer. Text from the buffer (the unnamed buffer by default) is appended after the cur- rent column or, if the buffer is line oriented, after the current line. Line: Set to the first line appended, if the buffer is line oriented, otherwise unchanged. Column: Set to the first nonblank character of the appended text if the buffer is line oriented, otherwise, the last character of the appended text. Options: None. [[ccoouunntt]] rr <> Replace characters. The next count cchhaarraacctteerrss iinn tthhee lliinnee aarree rreeppllaacceedd wwiitthh <>. Replacing charac- ters with cchhaarraacctteerrss rreessuullttss iinn ccrreeaattiinngg nneeww,, eemmppttyy lliinneess iinnttoo tthhee ffiillee.. IIff <> is ,, tthhee ccoommmmaanndd iiss ccaanncceelllleedd.. Line: Unchanged unless the replacement character is a ,, iinn wwhhiicchh ccaassee iitt iiss sseett ttoo tthhee ccuurrrreenntt lliinnee pplluuss ccoouunntt -- 11. Column: Set to the last character replaced, unless the replacement character is a , in which case the cursor is in column 1 of the last line inserted. Options: None. VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--4499 [[bbuuffffeerr]] [[ccoouunntt]] ss Substitute count cchhaarraacctteerrss iinn tthhee ccuurrrreenntt lliinnee ssttaarrtt-- iinngg wwiitthh tthhee ccuurrrreenntt cchhaarraacctteerr.. Line: Set to the last line upon which characters were entered. Column: Set to the last character entered. Options: Affected by the aallttwweerraassee, aauuttooiinnddeenntt, bbeeaauu-- ttiiffyy, sshhoowwmmaattcchh, ttttyywweerraassee and wwrraappmmaarrggiinn options. [[ccoouunntt]] tt <> Search forward, count ttiimmeess,, tthhrroouugghh tthhee ccuurrrreenntt lliinnee ffoorr tthhee cchhaarraacctteerr iimmmmeeddiiaatteellyy _b_e_f_o_r_e <>_. _T_h_e tt _c_o_m_m_a_n_d _m_a_y _b_e _u_s_e_d _a_s _t_h_e _m_o_t_i_o_n _c_o_m_p_o_n_e_n_t _o_f _o_t_h_e_r vvii _c_o_m_m_a_n_d_s_, _i_n _w_h_i_c_h _c_a_s_e _a_n_y _t_e_x_t _c_o_p_i_e_d _i_n_t_o _a _b_u_f_f_e_r _i_s _c_h_a_r_a_c_t_e_r _o_r_i_e_n_t_e_d_. Line: Unchanged. Column: Set to the character _b_e_f_o_r_e the searched-for character. Options: None. uu Undo the last change made to the file. If repeated, the uu command alternates between these two states, and is its own inverse. When used after an insert that inserted text on more than one line, the lines are saved in the numeric buffers. The .. command, when used immediately after the uu com- mand, causes the change log to be rolled forward or backward, depending on the action of the uu command. Line: Set to the position of the first line changed, if the reversal affects only one line or rep- resents an addition or change; otherwise, the line preceding the deleted text. Column: Set to the cursor position before the change was made. Options: None. [[ccoouunntt]] ww Move forward count wwoorrddss.. MMoovvee tthhee ccuurrssoorr ffoorrwwaarrdd ttoo tthhee bbeeggiinnnniinngg ooff aa wwoorrdd bbyy rreeppeeaattiinngg tthhee ffoolllloowwiinngg aallggoorriitthhmm:: iiff tthhee ccuurrrreenntt ppoossiittiioonn iiss aatt tthhee bbeeggiinnnniinngg ooff aa wwoorrdd,, mmoovvee ttoo tthhee ffiirrsstt cchhaarraacctteerr ooff tthhee nneexxtt wwoorrdd.. IIff nnoo ssuubbsseeqquueenntt wwoorrdd eexxiissttss oonn tthhee ccuurrrreenntt lliinnee,, mmoovvee ttoo tthhee ffiirrsstt cchhaarraacctteerr ooff tthhee ffiirrsstt wwoorrdd oonn tthhee ffiirrsstt ffoolllloowwiinngg lliinnee tthhaatt ccoonnttaaiinnss aa wwoorrdd.. TThhee ww ccoommmmaanndd mmaayy bbee uusseedd aass tthhee mmoottiioonn ccoommppoonneenntt ooff UUSSDD::1133--5500 VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) ootthheerr vvii ccoommmmaannddss,, iinn wwhhiicchh ccaassee aannyy tteexxtt ccooppiieedd iinnttoo aa bbuuffffeerr iiss cchhaarraacctteerr oorriieenntteedd.. Line: Set to the line containing the word selected. Column: Set to the first character of the word selected. Options: None. [[bbuuffffeerr]] [[ccoouunntt]] xx Delete count cchhaarraacctteerrss.. TThhee ddeelleettiioonn iiss aatt tthhee ccuurr-- rreenntt cchhaarraacctteerr ppoossiittiioonn.. IIff tthhee nnuummbbeerr ooff cchhaarraacctteerrss ttoo bbee ddeelleetteedd iiss ggrreeaatteerr tthhaann oorr eeqquuaall ttoo tthhee nnuummbbeerr ooff cchhaarraacctteerrss ttoo tthhee eenndd ooff tthhee lliinnee,, aallll ooff tthhee cchhaarraacc-- tteerrss ffrroomm tthhee ccuurrrreenntt ccuurrssoorr ppoossiittiioonn ttoo tthhee eenndd ooff tthhee lliinnee aarree ddeelleetteedd.. Line: Unchanged. Column: Unchanged unless the last character in the line is deleted and the cursor is not already on the first character in the line, in which case it is set to the previous character. Options: None. [[bbuuffffeerr]] [[ccoouunntt]] yy mmoottiioonn Copy (or "yank") the text region specified by the count aanndd mmoottiioonn, into a buffer. Line: Unchanged, unless the region covers more than a single line, in which case it is set to the line where the region starts. Column: Unchanged, unless the region covers more than a single line, in which case it is set to the character were the region starts. Options: None. [[ccoouunntt11]] zz [[ccoouunntt22]] ttyyppee Redraw the screen with a window count2 lliinneess lloonngg,, wwiitthh lliinnee ccoouunntt11 placed as specified by the type cchhaarraacctteerr.. IIff ccoouunntt11 is not specified, it defaults to the current line. If count2 iiss nnoott ssppeecciiffiieedd,, iitt ddeeffaauullttss ttoo tthhee ccuurrrreenntt wwiinnddooww ssiizzee.. TThhee ffoolllloowwiinngg ttyyppee characters may be used: + If count1 is specified, place the line count1 at the top of the screen. Otherwise, display the screen after the current screen, similarly to the <> command. Place the line count1 at the top of the screen. . Place the line count1 in the center of the screen. VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--5511 - Place the line count1 at the bottom of the screen. ^ If count1 is specified, place the line that is at the top of the screen when count1 is at the bottom of the screen, at the bottom of the screen, i.e. display the screen before the screen before count1. Otherwise, display the screen before the current screen, similarly to the <> command. Line: Set to count1 unless count1 is not specified and the type character was either "^" or "+", in which case it is set to the line before the first line on the previous screen or the line after the last line on the previous screen, respectively. Column: Set to the first nonblank character in the line. Options: None. [[ccoouunntt]] {{ Move backward count ppaarraaggrraapphhss.. TThhee {{ ccoommmmaanndd iiss aann aabbssoolluuttee mmoovveemmeenntt.. TThhee {{ ccoommmmaanndd mmaayy bbee uusseedd aass tthhee mmoottiioonn ccoommppoonneenntt ooff ootthheerr vvii ccoomm-- mmaannddss,, iinn wwhhiicchh ccaassee aannyy tteexxtt ccooppiieedd iinnttoo aa bbuuffffeerr iiss cchhaarraacctteerr oorriieenntteedd,, uunnlleessss tthhee ssttaarrttiinngg cchhaarraacctteerr iiss tthhee ffiirrsstt cchhaarraacctteerr oonn iittss lliinnee,, iinn wwhhiicchh ccaassee iitt iiss lliinnee oorriieenntteedd.. Line: Set to the line containing the beginning of the previous paragraph. Column: Set to the first nonblank character in the line. Options: Affected by the ppaarraaggrraapphh option. [[ccoouunntt]] || Move to a specific _c_o_l_u_m_n position on the current line. The || command may be used as the motion component of other vvii commands, in which case any text copied into a buffer is character oriented. It is an error to use the || command as a motion component and for the cursor not to move. Line: Unchanged. Column: Set to the character occupying the column position identified by count, if the position exists in the line. If the column length of the current line is less than count, the cur- sor is moved to the last character in the line. UUSSDD::1133--5522 VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) Options: None. [[ccoouunntt]] }} Move forward count ppaarraaggrraapphhss.. TThhee }} ccoommmmaanndd iiss aann aabbssoolluuttee mmoovveemmeenntt.. TThhee }} ccoommmmaanndd mmaayy bbee uusseedd aass tthhee mmoottiioonn ccoommppoonneenntt ooff ootthheerr vvii ccoomm-- mmaannddss,, iinn wwhhiicchh ccaassee aannyy tteexxtt ccooppiieedd iinnttoo aa bbuuffffeerr iiss cchhaarraacctteerr oorriieenntteedd,, uunnlleessss tthhee ssttaarrttiinngg cchhaarraacctteerr iiss aatt oorr bbeeffoorree aannyy nnoonnbbllaannkk cchhaarraacctteerrss iinn iittss lliinnee,, iinn wwhhiicchh ccaassee iitt iiss lliinnee oorriieenntteedd.. Line: Set to the line containing the beginning of the next paragraph. Column: Set to the first nonblank character in the line. Options: Affected by the ppaarraaggrraapphh option. [[ccoouunntt]] ~~ Reverse the case of the next count cchhaarraacctteerr((ss)).. TThhiiss iiss tthhee hhiissttoorriicc sseemmaannttiicc ffoorr tthhee ~~ ccoommmmaanndd aanndd iitt iiss oonnllyy iinn eeffffeecctt iiff tthhee ttiillddeeoopp ooppttiioonn iiss nnoott sseett.. LLoowweerrccaassee aallpphhaabbeettiicc cchhaarraacctteerrss aarree cchhaannggeedd ttoo uuppppeerr-- ccaassee,, aanndd uuppppeerrccaassee cchhaarraacctteerrss aarree cchhaannggeedd ttoo lloowweerr-- ccaassee.. NNoo ootthheerr cchhaarraacctteerrss aarree aaffffeecctteedd.. HHiissttoorriiccaallllyy,, tthhee ~~ ccoommmmaanndd ddiidd nnoott ttaakkee aann aassssoocciiaatteedd ccoouunntt,, nnoorr ddiidd iitt mmoovvee ppaasstt tthhee eenndd ooff tthhee ccuurrrreenntt lliinnee.. AAss iitt hhaadd nnoo aassssoocciiaatteedd mmoottiioonn iitt wwaass ddiiffffiiccuulltt ttoo cchhaannggee tthhee ccaassee ooff llaarrggee bblloocckkss ooff tteexxtt.. IInn nnvvii,, iiff tthhee ccuurrssoorr iiss oonn tthhee llaasstt cchhaarraacctteerr ooff aa lliinnee,, aanndd tthheerree aarree mmoorree lliinneess iinn tthhee ffiillee,, tthhee ccuurrssoorr mmoovveess ttoo tthhee nneexxtt lliinnee.. IItt iiss nnoott aann eerrrroorr ttoo ssppeecciiffyy aa ccoouunntt llaarrggeerr tthhaann tthhee nnuummbbeerr ooff cchhaarraacctteerrss bbeettwweeeenn tthhee ccuurrssoorr aanndd tthhee eenndd ooff tthhee ffiillee.. Line: Set to the line of the character after count cchhaarraacctteerrss,, oorr,, eenndd ooff ffiillee.. Column: Set to the character after count cchhaarraacctteerrss,, oorr,, eenndd--ooff--ffiillee.. Options: Affected by the ttiillddeeoopp option. [[ccoouunntt]] ~~ mmoottiioonn Reverse the case of the characters in a text region specified by the count aanndd mmoottiioonn. Only in effect if the ttiillddeeoopp option is set. Lowercase characters are changed to uppercase, and uppercase characters are changed to lowercase. No other characters are affected. VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--5533 Line: Set to the line of the character after the last character in the region. Column: Set to the character after the last character in the region. Options: Affected by the ttiillddeeoopp option. <> Interrupt the current operation. Many of the poten- tially long-running vvii commands may be interrupted using the terminal interrupt character. These opera- tions include searches, file reading and writing, fil- ter operations and map character expansion. Interrupts are also enabled when running commands outside of vvii. If the cchhaarraacctteerr iiss uusseedd ttoo iinntteerrrruupptt wwhhiillee eenntteerriinngg aann eexx ccoommmmaanndd,, tthhee ccoommmmaanndd iiss aabboorrtteedd,, tthhee ccuurrssoorr rreettuurrnnss ttoo iittss pprreevviioouuss ppoossiittiioonn,, aanndd vvii rreemmaaiinnss iinn ccoommmmaanndd mmooddee.. GGeenneerraallllyy,, iiff tthhee <> cchhaarraacctteerr iiss uusseedd ttoo iinntteerrrruupptt aannyy ooppeerraattiioonn,, aannyy cchhaannggeess mmaaddee bbeeffoorree tthhee iinntteerrrruupptt aarree lleefftt iinn ppllaaccee.. Line: Dependent on the operation being interrupted. Column: Dependent on the operation being interrupted. Options: None. 1144.. VVii TTeexxtt IInnppuutt CCoommmmaannddss The following section describes the commands available in the text input mode of the vvii editor. Historically, vvii implementations only permitted the characters inserted on the current line to be erased. In addition, only the eerraassee cchhaarr-- aacctteerr aanndd tthhee ""00<>" and "^"" eerraassee ssttrriinnggss ccoouulldd eerraassee aauuttooiinnddeenntt cchhaarraacctteerrss.. ((AAuuttooiinnddeenntt cchhaarraacctteerrss iinncclluuddee bbootthh tthhee cchhaarraacctteerrss iinnsseerrtteedd aauuttoo-- mmaattiiccaallllyy aatt tthhee bbeeggiinnnniinngg ooff aann iinnppuutt lliinnee aass wweellll aass cchhaarraacctteerrss iinnsseerrtteedd uussiinngg tthhee <> command.) This implementation permits erasure to continue past the beginning of the current line, and back to where text input mode was entered. In addition, autoindent characters may be erased using the standard erase char- acters. For the line and word erase characters, reach- ing the autoindent characters forms a "soft" boundary, denoting the end of the current word or line erase. Repeating the word or line erase key will erase the autoindent characters. Historically, vvii always used aanndd <> as character and word erase characters, respec- tively, regardless of the current terminal settings. UUSSDD::1133--5544 VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) This implementation accepts, in addition to these two characters, the current terminal characters for those operations. <> If the first character of the input is a ,, tthhee pprreevviioouuss iinnppuutt iiss rreeppllaayyeedd,, aass iiff jjuusstt eenntteerreedd.. <> If the previous character on the line was an autoindent character, erase characters to move the cursor back to the column immediately after the previous (1-based) column which is a multiple of the sshhiiffttwwiiddtthh edit option. This may result in any number of aanndd <> characters preced- ing the cursor being changed. Otherwise, if the aauuttooiinnddeenntt option is set and the user is entering the first character in the line, iiss iiggnnoorreedd.. OOtthheerrwwiissee,, aa lliitteerraall <> character is entered. ^^<> If the previous character on the line was an autoindent character, erase all of the autoindent characters on the line. In addition, the autoin- dent level is reset to 0. 00<> If the previous character on the line was an autoindent character, erase all of the autoindent characters on the line. The autoindent level is not altered. <> Insert sufficient aanndd <> characters to move the cursor forward to the column immediately after the next (1-based) column which is a multi- ple of the sshhiiffttwwiiddtthh edit option. This may result in any number of aanndd <> charac- ters preceding the cursor being changed. Historically, vvii did not permit the ccoommmmaanndd ttoo bbee uusseedd uunnlleessss tthhee ccuurrssoorr wwaass aatt tthhee ffiirrsstt ccoolluummnn ooff aa nneeww lliinnee oorr iitt wwaass pprreecceeddeedd oonnllyy bbyy aauuttooiinnddeenntt cchhaarraacctteerrss.. NNvvii ppeerrmmiittss iitt ttoo bbee uusseedd aatt aannyy ttiimmee dduurriinngg iinnsseerrtt mmooddee.. <> <> Erase the last character. VVii//EExx RReeffeerreennccee ((VVii CCoommmmaannddss)) UUSSDD::1133--5555 <> Quote the next character. The next character will not be mapped (see the mmaapp command for more infor- mation) or interpreted specially. A carat ("^"")) cchhaarraacctteerr wwiillll bbee ddiissppllaayyeedd iimmmmeeddiiaatteellyy aass aa ppllaacceehhoollddeerr,, bbuutt wwiillll bbee rreeppllaacceedd bbyy tthhee nneexxtt cchhaarraacctteerr.. <> If on the colon command line, and the ffiilleecc edit option is set, behave as described for that option. Otherwise, if on the colon command line, execute the command. Otherwise, if not on the colon command line, 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. The value is delimited by any non-hexadecimal character or the input of the maximum number of characters that can be trans- lated into a single character value. <> Interrupt text input mode, returning to command mode. If the cchhaarraacctteerr iiss uusseedd ttoo iinntteerrrruupptt iinnsseerrttiinngg tteexxtt iinnttoo tthhee ffiillee,, iitt iiss aass iiff tthhee <> character was used; all text input up to the interruption is resolved into the file. 1155.. EExx AAddddrreessssiinngg Addressing in eexx (and when eexx commands are exe- cuted from vvii) relates to the current line. In gen- eral, the current line is the last line affected by a command. The exact effect on the current line is dis- cussed under the description of each command. When the file contains no lines, the current line is zero. Addresses are constructed by one or more of the following methods: (1) The address "." refers to the current line. UUSSDD::1133--5566 VVii//EExx RReeffeerreennccee (2) The address "$" refers to the last line of the file. (3) The address "N", where N is a positive number, refers to the N-th line of the file. (4) The address "'" or "`" refers to the line marked with the name . (See the kk or mm commands for more infor- mation on how to mark lines.) (5) A regular expression (RE) enclosed by slashes ("/") is an address, and it refers to the first line found by searching forward from the line _a_f_t_e_r the current line toward the end of the file, and stopping at the first line containing a string matching the RE. (The trailing slash can be omitted at the end of the command line.) If no RE is specified, i.e. the pattern is "//_"_, _t_h_e _l_a_s_t _R_E _u_s_e_d _i_n _a_n_y _c_o_m_m_a_n_d _i_s _u_s_e_d _i_n _t_h_e _s_e_a_r_c_h_. _I_f _t_h_e eexxtteennddeedd _o_p_t_i_o_n _i_s _s_e_t_, _t_h_e _R_E _i_s _h_a_n_d_l_e_d _a_s _a_n _e_x_t_e_n_d_e_d _R_E_, _n_o_t _a _b_a_s_i_c _R_E_. _I_f _t_h_e wwrraapp-- ssccaann _o_p_t_i_o_n _i_s _s_e_t_, _t_h_e _s_e_a_r_c_h _w_r_a_p_s _a_r_o_u_n_d _t_o _t_h_e _b_e_g_i_n_n_i_n_g _o_f _t_h_e _f_i_l_e _a_n_d _c_o_n_t_i_n_u_e_s _u_p _t_o _a_n_d _i_n_c_l_u_d_i_n_g _t_h_e _c_u_r_r_e_n_t _l_i_n_e_, _s_o _t_h_a_t _t_h_e _e_n_t_i_r_e _f_i_l_e _i_s _s_e_a_r_c_h_e_d_. _T_h_e _f_o_r_m _"_\_/"" iiss aacccceepptteedd ffoorr hhiissttoorriicc rreeaassoonnss,, aanndd iiss iiddeennttiiccaall ttoo ""////_"_. (6) An RE enclosed in question marks ("?_"_) _a_d_d_r_e_s_s_e_s _t_h_e _f_i_r_s_t _l_i_n_e _f_o_u_n_d _b_y _s_e_a_r_c_h_i_n_g _b_a_c_k_w_a_r_d _f_r_o_m _t_h_e _l_i_n_e _p_r_e_c_e_d_i_n_g _t_h_e _c_u_r_r_e_n_t _l_i_n_e_, _t_o_w_a_r_d _t_h_e _b_e_g_i_n_n_i_n_g _o_f _t_h_e _f_i_l_e _a_n_d _s_t_o_p_- _p_i_n_g _a_t _t_h_e _f_i_r_s_t _l_i_n_e _c_o_n_t_a_i_n_i_n_g _a _s_t_r_i_n_g _m_a_t_c_h_i_n_g _t_h_e _R_E_. _(_T_h_e _t_r_a_i_l_i_n_g _q_u_e_s_t_i_o_n _m_a_r_k _c_a_n _b_e _o_m_i_t_t_e_d _a_t _t_h_e _e_n_d _o_f _a _c_o_m_m_a_n_d _l_i_n_e_._) _I_f _n_o _R_E _i_s _s_p_e_c_i_f_i_e_d_, _i_._e_. _t_h_e _p_a_t_t_e_r_n _i_s _"_?_?_"_, _t_h_e _l_a_s_t _R_E _u_s_e_d _i_n _a_n_y _c_o_m_m_a_n_d _i_s _u_s_e_d _i_n _t_h_e _s_e_a_r_c_h_. _I_f _t_h_e eexxtteennddeedd _o_p_t_i_o_n _i_s _s_e_t_, _t_h_e _R_E _i_s _h_a_n_d_l_e_d _a_s _a_n _e_x_t_e_n_d_e_d _R_E_, _n_o_t _a _b_a_s_i_c _R_E_. _I_f _t_h_e wwrraapp-- ssccaann _o_p_t_i_o_n _i_s _s_e_t_, _t_h_e _s_e_a_r_c_h _w_r_a_p_s _a_r_o_u_n_d _f_r_o_m _t_h_e _b_e_g_i_n_n_i_n_g _o_f _t_h_e _f_i_l_e _t_o _t_h_e _e_n_d _o_f _t_h_e _f_i_l_e _a_n_d _c_o_n_t_i_n_u_e_s _u_p _t_o _a_n_d _i_n_c_l_u_d_i_n_g _t_h_e _c_u_r_- _r_e_n_t _l_i_n_e_, _s_o _t_h_a_t _t_h_e _e_n_t_i_r_e _f_i_l_e _i_s _s_e_a_r_c_h_e_d_. _T_h_e _f_o_r_m _"_\_?"" iiss aacccceepptteedd ffoorr hhiissttoorriicc rreeaassoonnss,, VVii//EExx RReeffeerreennccee UUSSDD::1133--5577 aanndd iiss iiddeennttiiccaall ttoo ""????_"_. (7) An address followed by a plus sign ("+_"_) _o_r _a _m_i_n_u_s _s_i_g_n _(_"_-") followed by a number is an off- set address and refers to the address plus (or minus) the indicated number of lines. If the address is omitted, the addition or subtraction is done with respect to the current line. (8) An address of "+" or "-" followed by a number is an offset from the current line. For example, "-5" is the same as ".-5". (9) An address ending with "+" or "-" has 1 added to or subtracted from the address, respectively. As a consequence of this rule and of the previ- ous rule, the address "-" refers to the line preceding the current line. Moreover, trailing "+" and "-" characters have a cumulative effect. For example, "++-++" refers to the current line plus 3. (10) A percent sign ("%") is equivalent to the address range "1,$". EExx commands require zero, one, or two addresses. It is an error to specify an address to a command which requires zero addresses. If the user provides more than the expected number of addresses to any eexx command, the first addresses specified are discarded. For example, "1,2,3,5""pprriinntt pprriinnttss lliinneess 33 tthhrroouugghh 55,, bbeeccaauussee tthhee pprriinntt ccoommmmaanndd oonnllyy ttaakkeess ttwwoo aaddddrreesssseess.. The addresses in a range are separated from each other by a comma (","")) oorr aa sseemmiiccoolloonn (("";;"). In the latter case, the current line ("."")) iiss sseett ttoo tthhee ffiirrsstt aaddddrreessss,, aanndd oonnllyy tthheenn iiss tthhee sseeccoonndd aaddddrreessss ccaall-- ccuullaatteedd.. TThhiiss ffeeaattuurree ccaann bbee uusseedd ttoo ddeetteerrmmiinnee tthhee ssttaarrttiinngg lliinnee ffoorr ffoorrwwaarrdd aanndd bbaacckkwwaarrdd sseeaarrcchheess ((sseeee rruulleess ((55)) aanndd ((66)) aabboovvee)).. TThhee sseeccoonndd aaddddrreessss ooff aannyy ttwwoo--aaddddrreessss sseeqquueennccee ccoorrrreessppoonnddss ttoo aa lliinnee tthhaatt ffooll-- lloowwss,, iinn tthhee ffiillee,, tthhee lliinnee ccoorrrreessppoonnddiinngg ttoo tthhee ffiirrsstt aaddddrreessss.. TThhee ffiirrsstt aaddddrreessss mmuusstt bbee lleessss tthhaann oorr eeqquuaall ttoo tthhee sseeccoonndd aaddddrreessss.. TThhee ffiirrsstt aaddddrreessss mmuusstt bbee ggrreeaatteerr tthhaann oorr eeqquuaall ttoo tthhee ffiirrsstt lliinnee ooff tthhee ffiillee,, aanndd tthhee llaasstt aaddddrreessss mmuusstt bbee lleessss tthhaann oorr eeqquuaall ttoo tthhee llaasstt lliinnee ooff tthhee ffiillee.. UUSSDD::1133--5588 VVii//EExx RReeffeerreennccee ((EExx CCoommmmaannddss)) 1166.. EExx DDeessccrriippttiioonn The following words have special meanings for eexx commands. <> The end-of-file character is used to scroll the screen in the eexx editor. This character is nor- mally .. HHoowweevveerr,, wwhhaatteevveerr cchhaarraacctteerr iiss sseett ffoorr tthhee ccuurrrreenntt tteerrmmiinnaall iiss ssuuppppoorrtteedd aass wweellll aass <>. lliinnee A single-line address, given in any of the forms described in the section entitled "EExx AAddddrreessssiinngg". The default for line iiss tthhee ccuurrrreenntt lliinnee.. rraannggee A line, or a pair of line addresses, separated by a comma or semicolon. (See the section entitled "EExx AAddddrreessssiinngg" for more information.) The default for range is the current line _o_n_l_y, i.e. ".,._"_. _A _p_e_r_c_e_n_t _s_i_g_n _(_"_%") stands for the range "1,$_"_. _T_h_e _s_t_a_r_t_i_n_g _a_d_d_r_e_s_s _m_u_s_t _b_e _l_e_s_s _t_h_a_n_, _o_r _e_q_u_a_l _t_o_, _t_h_e _e_n_d_i_n_g _a_d_d_r_e_s_s_. ccoouunntt A positive integer, specifying the number of lines to be affected by the command; the default is 1. Generally, a count past the end-of-file may be specified, e.g. the command "p 3000"" iinn aa 1100 lliinnee ffiillee iiss aacccceeppttaabbllee,, aanndd wwiillll pprriinntt ffrroomm tthhee ccuurr-- rreenntt lliinnee tthhrroouugghh tthhee llaasstt lliinnee iinn tthhee ffiillee.. ffllaaggss One or more of the characters "#", "p", and "l". When a command that accepts these flags completes, the addressed line(s) are written out as if by the corresponding ##, ll or pp commands. In addition, any number of "+"" oorr ""--" characters can be speci- fied before, after, or during the flags, in which case the line written is not necessarily the one affected by the command, but rather the line addressed by the offset address specified. The default for flags iiss nnoonnee.. ffiillee A pattern used to derive a pathname; the default is the current file. File names are subjected to normal _s_h(1) word expansions. Anywhere a file name is specified, it is also pos- sible to use the special string "/tmp". This will be VVii//EExx RReeffeerreennccee ((EExx CCoommmmaannddss)) UUSSDD::1133--5599 replaced with a temporary file name which can be used for temporary work, e.g. ":e /tmp" creates and edits a new file. If both a count and a range are specified for com- mands that use either, the starting line for the com- mand is the _l_a_s_t line addressed by the range, and count_- _s_u_b_s_e_q_u_e_n_t _l_i_n_e_s _a_r_e _a_f_f_e_c_t_e_d _b_y _t_h_e _c_o_m_m_a_n_d_, _e_._g_. _t_h_e _c_o_m_m_a_n_d _"_2_,_3_p_4" prints out lines 3, 4, 5 and 6. When only a line or range is specified, with no command, the implied command is either a lliisstt, nnuummbbeerr or pprriinntt command. The command used is the most recent of the three commands to have been used (including any use as a flag). If none of these commands have been used before, the pprriinntt command is the implied command. When no range or count is specified and the command line is a blank line, the current line is incremented by 1 and then the current line is displayed. Zero or more whitespace characters may precede or follow the addresses, count, flags, or command name. Any object following a command name (such as buffer, file, etc.), that begins with an alphabetic character, should be separated from the command name by at least one whitespace character. Any character, including , "%" and "#" retain their literal value when preceded by a backslash. 1177.. EExx CCoommmmaannddss The following section describes the commands available in the eexx editor. In each entry below, the tag line is a usage synopsis for the command. Each command can be entered as the abbreviation (those characters in the synopsis command word preced- ing the "[" character), the full command (all charac- ters shown for the command word, omitting the "[" and "]" characters), or any leading subset of the full com- mand down to the abbreviation. For example, the args command (shown as "ar[gs]" in the synopsis) can be entered as "ar", "arg" or "args". Each eexx command described below notes the new cur- rent line after it is executed, as well as any options that affect the command. "" A comment. Command lines beginning with the UUSSDD::1133--6600 VVii//EExx RReeffeerreennccee ((EExx CCoommmmaannddss)) double-quote character ("""")) aarree iiggnnoorreedd.. TThhiiss ppeerrmmiittss ccoommmmeennttss iinn eeddiittoorr ssccrriippttss aanndd ssttaarrttuupp ffiilleess.. <> <> Scroll the screen. Write the next N lines, where N is the value of the ssccrroollll option. The command is the end-of-file terminal character, which may be different on different terminals. Tradition- ally, it is the kkeeyy.. HHiissttoorriiccaallllyy,, tthhee eeooff ccoommmmaanndd iiggnnoorreedd aannyy pprreecceedd-- iinngg ccoouunntt,, aanndd tthhee <> cchhaarraacctteerr wwaass iiggnnoorreedd uunnlleessss iitt wwaass eenntteerreedd aass tthhee ffiirrsstt cchhaarraacc-- tteerr ooff tthhee ccoommmmaanndd.. TThhiiss iimmpplleemmeennttaattiioonn ttrreeaattss iitt aass aa ccoommmmaanndd _o_n_l_y iiff eenntteerreedd aass tthhee ffiirrsstt cchhaarraacc-- tteerr ooff tthhee ccoommmmaanndd lliinnee,, aanndd ootthheerrwwiissee ttrreeaattss iitt aass aannyy ootthheerr cchhaarraacctteerr.. Line: Set to the last line written. Options: Affected by the ssccrroollll option. !! aarrgguummeenntt((ss)) [[rraannggee]]!! aarrgguummeenntt((ss)) Execute a shell command, or filter lines through a shell command. In the first synopsis, the remain- der of the line after the "!"" cchhaarraacctteerr iiss ppaasssseedd ttoo tthhee pprrooggrraamm nnaammeedd bbyy tthhee sshheellll ooppttiioonn,, aass aa ssiinnggllee aarrgguummeenntt.. WWiitthhiinn tthhee rreesstt ooff tthhee lliinnee,, ""%%"" aanndd ""##"" aarree eexxppaannddeedd iinnttoo tthhee ccuurrrreenntt aanndd aalltteerrnnaattee ppaatthhnnaammeess,, rreessppeeccttiivveellyy.. TThhee cchhaarraacctteerr ""!!"" iiss eexxppaannddeedd wwiitthh tthhee ccoommmmaanndd tteexxtt ooff tthhee pprreevviioouuss !! ccoommmmaanndd.. ((TThheerreeffoorree,, tthhee ccoommmmaanndd !!!! rreeppeeaattss tthhee pprreevviioouuss !! ccoommmmaanndd..)) TThhee ssppeecciiaall mmeeaanniinnggss ooff ""%%"",, ""##"",, aanndd ""!!"" ccaann bbee oovveerrrriiddddeenn bbyy eessccaappiinngg tthheemm wwiitthh aa bbaacckkssllaasshh.. IIff nnoo !! oorr ::!! ccoommmmaanndd hhaass yyeett bbeeeenn eexxeeccuutteedd,, iitt iiss aann eerrrroorr ttoo uussee aann uunneessccaappeedd ""!!"" cchhaarraacctteerr.. TThhee !! ccoommmmaanndd ddooeess _n_o_t ddoo sshheellll eexxppaannssiioonn oonn tthhee ssttrriinnggss pprroovviiddeedd aass aarrgguummeennttss.. IIff aannyy ooff tthhee aabboovvee eexxppaannssiioonnss cchhaannggee tthhee ccoommmmaanndd tthhee uusseerr eenntteerreedd,, tthhee ccoommmmaanndd iiss rreeddiissppllaayyeedd aatt tthhee bboottttoomm ooff tthhee ssccrreeeenn.. EExx tthheenn eexxeeccuutteess tthhee pprrooggrraamm nnaammeedd bbyy tthhee sshheellll ooppttiioonn,, wwiitthh aa --cc ffllaagg ffoolllloowweedd bbyy tthhee aarrgguummeennttss ((wwhhiicchh aarree bbuunnddlleedd iinnttoo aa ssiinnggllee aarrgguummeenntt)).. TThhee !! ccoommmmaanndd iiss ppeerrmmiitttteedd iinn aann eemmppttyy ffiillee.. VVii//EExx RReeffeerreennccee ((EExx CCoommmmaannddss)) UUSSDD::1133--6611 IIff tthhee ffiillee hhaass bbeeeenn mmooddiiffiieedd ssiinnccee iitt wwaass llaasstt ccoommpplleetteellyy wwrriitttteenn,, tthhee ccoommmmaanndd wwiillll wwaarrnn yyoouu.. AA ssiinnggllee ""!!"" cchhaarraacctteerr iiss ddiissppllaayyeedd wwhheenn tthhee ccoomm-- mmaanndd ccoommpplleetteess.. IInn tthhee sseeccoonndd ffoorrmm ooff tthhee !! ccoommmmaanndd,, tthhee rreemmaaiinn-- ddeerr ooff tthhee lliinnee aafftteerr tthhee ""!!"" iiss ppaasssseedd ttoo tthhee pprrooggrraamm nnaammeedd bbyy tthhee sshheellll ooppttiioonn,, aass ddeessccrriibbeedd aabboovvee.. TThhee ssppeecciiffiieedd lliinneess aarree ppaasssseedd ttoo tthhee pprroo-- ggrraamm aass ssttaannddaarrdd iinnppuutt,, aanndd tthhee ssttaannddaarrdd aanndd ssttaann-- ddaarrdd eerrrroorr oouuttppuutt ooff tthhee pprrooggrraamm rreeppllaaccee tthhee oorriigg-- iinnaall lliinneess.. Line: Unchanged if no range was specified, oth- erwise set to the first line of the range. Options: Affected by the sshheellll and wwaarrnn options. [[rraannggee]] ## [[ccoouunntt]] [[ffllaaggss]] [[rraannggee]] nnuu[[mmbbeerr]] [[ccoouunntt]] [[ffllaaggss]] Display the selected lines, each preceded with its line number. The line number format is "%6d", followed by two spaces. Line: Set to the last line displayed. Options: Affected by the lliisstt option. @@ bbuuffffeerr ** bbuuffffeerr Execute a buffer. Each line in the named buffer is executed as an eexx command. If no buffer is specified, or if the specified buffer is "@"" oorr ""**", the last buffer executed is used. [[rraannggee]] <<[[<< ......]] [[ccoouunntt]] [[ffllaaggss]] Shift lines left or right. The specified lines are shifted to the left (for the << command) or right (for the >> command), by the number of columns specified by the sshhiiffttwwiiddtthh option. Only leading whitespace characters are deleted when shifting left; once the first column of the line contains a nonblank character, the sshhiifftt command will succeed, but the line will not be modified. If the command character << or >> is repeated more than once, the command is repeated once for each additional command character. Line: If the current line is set to one of the lines that are affected by the command, UUSSDD::1133--6622 VVii//EExx RReeffeerreennccee ((EExx CCoommmmaannddss)) it is unchanged. Otherwise, it is set to the first nonblank character of the low- est numbered line shifted. Options: Affected by the sshhiiffttwwiiddtthh option. [[lliinnee]] == [[ffllaaggss]] Display the line number of line ((wwhhiicchh ddeeffaauullttss ttoo tthhee llaasstt lliinnee iinn tthhee ffiillee)).. Line: Unchanged. Options: None. [[rraannggee]] >>[[>> ......]] [[ccoouunntt]] [[ffllaaggss]] Shift right. The specified lines are shifted to the right by the number of columns specified by the sshhiiffttwwiiddtthh option, by inserting tab and space characters. Empty lines are not changed. If the command character ">"" iiss rreeppeeaatteedd mmoorree tthhaann oonnccee,, tthhee ccoommmmaanndd iiss rreeppeeaatteedd oonnccee ffoorr eeaacchh aaddddii-- ttiioonnaall ccoommmmaanndd cchhaarraacctteerr.. Line: Set to the last line modified by the com- mand. Options: Affected by the sshhiiffttwwiiddtthh option. aabb[[bbrreevv]] llhhss rrhhss Add an abbreviation to the current abbreviation list. When inserting text in vvii, each time a non- word character is entered after a word character, a set of characters ending at the word character are checked for a match with lhs.. IIff aa mmaattcchh iiss ffoouunndd,, tthheeyy aarree rreeppllaacceedd wwiitthh rrhhss. The set of characters that are checked for a match are defined as follows, for inexplicable historical reasons. If only one or two characters were entered before the non-word character that trig- gered the check, and after the beginning of the insertion, or the beginning of the line or the file, or the last cchhaarraacctteerr tthhaatt wwaass eenntteerreedd,, tthheenn tthhee oonnee oorr tthhee bbootthh cchhaarraacctteerrss aarree cchheecckkeedd ffoorr aa mmaattcchh.. OOtthheerrwwiissee,, tthhee sseett iinncclluuddeess bbootthh cchhaarraacctteerrss,, aass wweellll aass tthhee cchhaarraacctteerrss tthhaatt pprreecceeddee tthheemm tthhaatt aarree tthhee ssaammee wwoorrdd ccllaassss ((ii..ee.. wwoorrdd oorr nnoonn--wwoorrdd)) aass tthhee sseeccoonndd ttoo llaasstt cchhaarraacctteerr eenntteerreedd bbeeffoorree tthhee nnoonn--wwoorrdd cchhaarraacctteerr tthhaatt ttrriigg-- ggeerreedd tthhee cchheecckk,, bbaacckk ttoo tthhee ffiirrsstt <>cchhaarraacc-- tteerr,, tthhee bbeeggiinnnniinngg ooff tthhee iinnsseerrttiioonn,, oorr tthhee bbeeggiinn-- nniinngg ooff tthhee lliinnee oorr tthhee ffiillee.. FFoorr eexxaammppllee,, tthhee aabbbbrreevviiaattiioonnss:: VVii//EExx RReeffeerreennccee ((EExx CCoommmmaannddss)) UUSSDD::1133--6633 ::aabbbbrreevviiaattee aabbcc AABBCC ::aabbbbrreevviiaattee ##ii ##iinncclluuddee ::aabbbbrreevviiaattee //**##ii //**##iinncclluuddee will all work, while the abbreviations: :abbreviate a#i A#include :abbreviate /* /******************** will not work, and are not permitted by nnvvii. To keep the abbreviation expansion from happening, the character immediately following the lhs cchhaarr-- aacctteerrss sshhoouulldd bbee qquuootteedd wwiitthh aa <> character. The replacement rhs iiss iittsseellff ssuubbjjeecctt ttoo bbootthh ffuurr-- tthheerr aabbbbrreevviiaattiioonn eexxppaannssiioonn aanndd ffuurrtthheerr mmaapp eexxppaann-- ssiioonn.. Line: Unchanged. Options: None. [[lliinnee]] aa[[ppppeenndd]][[!!]] The input text is appended to the specified line. If line 0 is specified, the text is inserted at the beginning of the file. Set to the last line input. If no lines are input, then set to line,, oorr ttoo tthhee ffiirrsstt lliinnee ooff tthhee ffiillee iiff aa lliinnee of 0 was specified. Following the command name with a "!"" cchhaarraacctteerr ccaauusseess tthhee aauuttooiinnddeenntt ooppttiioonn ttoo bbee ttoogggglleedd ffoorr tthhee dduurraattiioonn ooff tthhee ccoommmmaanndd.. Line: Unchanged. Options: Affected by the aauuttooiinnddeenntt and nnuummbbeerr options. aarr[[ggss]] Display the argument list. The current argument is displayed inside of "["" aanndd ""]]" characters. The argument list is the list of operands speci- fied on startup, which can be replaced using the nneexxtt command. Line: Unchanged. Options: None. bbgg VVii mode only. Background the current screen. The screen is unchanged, but is no longer accessible and disappears from the display. Use the ffgg UUSSDD::1133--6644 VVii//EExx RReeffeerreennccee ((EExx CCoommmmaannddss)) command to bring the screen back to the display foreground. Line: Set to the current line when the screen was last edited. Options: None. [[rraannggee]] cc[[hhaannggee]][[!!]] [[ccoouunntt]] Replace the lines with input text. Following the command name with a "!"" cchhaarraacctteerr ccaauusseess tthhee aauuttooiinnddeenntt ooppttiioonn ttoo bbee ttoogggglleedd ffoorr tthhee dduurraattiioonn ooff tthhee ccoommmmaanndd.. Line: Set to the last line input, or, if no lines were input, set to the line before the target line, or to the first line of the file if there are no lines preceding the target line. Options: Affected by the aauuttooiinnddeenntt and nnuummbbeerr options. cchhdd[[iirr]][[!!]] [[ddiirreeccttoorryy]] ccdd[[!!]] [[ddiirreeccttoorryy]] Change the current working directory. The direc- tory aarrgguummeenntt iiss ssuubbjjeecctteedd ttoo _s_h((11)) wwoorrdd eexxppaann-- ssiioonnss.. WWhheenn iinnvvookkeedd wwiitthh nnoo ddiirreeccttoorryy aarrgguummeenntt aanndd tthhee HHOOMMEE _e_n_v_i_r_o_n_m_e_n_t _v_a_r_i_a_b_l_e _i_s _s_e_t_, _t_h_e _d_i_r_e_c_t_o_r_y _n_a_m_e_d _b_y _t_h_e _H_O_M_E eennvviirroonnmmeenntt vvaarriiaabbllee bbeeccoommeess tthhee nneeww ccuurrrreenntt ddiirreeccttoorryy.. OOtthheerrwwiissee,, tthhee nneeww ccuurrrreenntt ddiirreeccttoorryy bbeeccoommeess tthhee ddiirreeccttoorryy rreettuurrnneedd bbyy tthhee _g_e_t_p_w_e_n_t((33)) rroouuttiinnee.. TThhee cchhddiirr ccoommmmaanndd wwiillll ffaaiill iiff tthhee ffiillee hhaass bbeeeenn mmooddiiffiieedd ssiinnccee tthhee llaasstt ccoommpplleettee wwrriittee ooff tthhee ffiillee.. YYoouu ccaann oovveerrrriiddee tthhiiss cchheecckk bbyy aappppeennddiinngg aa ""!!"" cchhaarraacctteerr ttoo tthhee ccoommmmaanndd.. Line: Unchanged. Options: Affected by the ccddppaatthh option. [[rraannggee]] ccoo[[ppyy]] lliinnee [[ffllaaggss]] [[rraannggee]] tt lliinnee [[ffllaaggss]] Copy the specified lines (range) after the desti- nation line. Line 0 may be specified to insert the lines at the beginning of the file. Line: Unchanged. Options: None. ccss[[ccooppee]] ccoommmmaanndd [[aarrggss]] Execute a ccssccooppee command. For more information, see the section of the reference manual entitled "TTaaggss,, TTaagg SSttaacckkss,, aanndd CCssccooppee". VVii//EExx RReeffeerreennccee ((EExx CCoommmmaannddss)) UUSSDD::1133--6655 [[rraannggee]] dd[[eelleettee]] [[bbuuffffeerr]] [[ccoouunntt]] [[ffllaaggss]] Delete the lines from the file. The deleted text is saved in the specified buffer, or, if no buffer is specified, in the unnamed buffer. If the com- mand name is followed by a letter that could be interpreted as either a buffer name or a flag value (because neither a count oorr ffllaaggss values were given), eexx treats the letter as a flags vvaalluuee iiff tthhee lleetttteerr iimmmmeeddiiaatteellyy ffoolllloowwss tthhee ccoommmmaanndd nnaammee,, wwiitthhoouutt aannyy wwhhiitteessppaaccee sseeppaarraattiioonn.. IIff tthhee lleetttteerr iiss pprreecceeddeedd bbyy wwhhiitteessppaaccee cchhaarraacctteerrss,, iitt ttrreeaattss iitt aass aa bbuuffffeerr nnaammee.. Line: Set to the line following the deleted lines, or to the last line if the deleted lines were at the end. Options: None. ddii[[ssppllaayy]] bb[[uuffffeerrss]] || cc[[oonnnneeccttiioonnss]] || ss[[ccrreeeennss]] || tt[[aaggss]] Display buffers, ccssccooppee connections, screens or tags. The ddiissppllaayy command takes one of three additional arguments, which are as follows: b[uffers] Display all buffers (including named, unnamed, and numeric) that contain text. c[onnections] Display the source directories for all attached ccssccooppee databases. s[creens] Display the file names of all background screens. t[ags] Display the tags stack. Line: Unchanged. Options: None. ee[[ddiitt]][[!!]] [[++ccmmdd]] [[ffiillee]] eexx[[!!]] [[++ccmmdd]] [[ffiillee]] Edit a different file. If the current buffer has been modified since the last complete write, the command will fail. You can override this by appending a "!"" cchhaarraacctteerr ttoo tthhee ccoommmmaanndd nnaammee.. IIff tthhee ""++ccmmdd" option is specified, that eexx command will be executed in the new file. Any eexx command may be used, although the most common use of this feature is to specify a line number or search pat- tern to set the initial location in the new file. Capitalizing the first letter of the command, i.e. EEddiitt or EExx, while in vvii mode, will edit the file UUSSDD::1133--6666 VVii//EExx RReeffeerreennccee ((EExx CCoommmmaannddss)) in a new screen. In this case, any modifications to the current file are ignored. Line: If you have previously edited the file, the current line will be set to your last position in the file. If that position does not exist, or you have not previ- ously edited the file, the current line will be set to the first line of the file if you are in vvii mode, and the last line of the file if you are in eexx. Options: None. eexxuu[[ssaaggee]] [[ccoommmmaanndd]] Display usage for an eexx command. If command iiss ssppeecciiffiieedd,, aa uussaaggee ssttaatteemmeenntt ffoorr tthhaatt ccoommmmaanndd iiss ddiissppllaayyeedd.. OOtthheerrwwiissee,, uussaaggee ssttaatteemmeennttss ffoorr aallll eexx ccoommmmaannddss aarree ddiissppllaayyeedd.. Line: Unchanged. Options: None. ff[[iillee]] [[ffiillee]] Display and optionally change the file name. If a file name is specified, the current pathname is changed to the specified name. The current path- name, the number of lines, and the current posi- tion in the file are displayed. Line: Unchanged. Options: None. ffgg [[nnaammee]] VVii mode only. Foreground the specified screen. If the argument name doesn't exactly match the name of a file displayed by a background screen, it is compared against the last component of each of the file names. If no background screen is specified, the first background screen is fore- grounded. By default, foregrounding causes the current screen to be swapped with the backgrounded screen. Capitalizing the first letter of the command, i.e. FFgg, will foreground the backgrounded screen in a new screen instead of swapping it with the current screen. Line: Set to the current line when the screen was last edited. Options: None. VVii//EExx RReeffeerreennccee ((EExx CCoommmmaannddss)) UUSSDD::1133--6677 [[rraannggee]] gg[[lloobbaall]] //ppaatttteerrnn// [[ccoommmmaannddss]] [[rraannggee]] vv //ppaatttteerrnn// [[ccoommmmaannddss]] Apply commands to lines matching (or not matching) a pattern. The lines within the given range that match ("g[lobal]"")),, oorr ddoo nnoott mmaattcchh ((""vv") the given pattern are selected. Then, the specified eexx command(s) are executed with the current line ("."")) sseett ttoo eeaacchh sseelleecctteedd lliinnee.. IIff nnoo rraannggee iiss ssppeecciiffiieedd,, tthhee eennttiirree ffiillee iiss sseeaarrcchheedd ffoorr mmaattcchh-- iinngg,, oorr nnoott mmaattcchhiinngg,, lliinneess.. MMuullttiippllee ccoommmmaannddss ccaann bbee ssppeecciiffiieedd,, oonnee ppeerr lliinnee,, bbyy eessccaappiinngg eeaacchh <> character with a back- slash, or by separating commands with a "|"" cchhaarr-- aacctteerr.. IIff nnoo ccoommmmaannddss aarree ssppeecciiffiieedd,, tthhee ccoommmmaanndd ddeeffaauullttss ttoo tthhee pprriinntt ccoommmmaanndd.. FFoorr tthhee aappppeenndd,, cchhaannggee aanndd iinnsseerrtt ccoommmmaannddss,, tthhee iinnppuutt tteexxtt mmuusstt bbee ppaarrtt ooff tthhee gglloobbaall ccoommmmaanndd lliinnee.. IInn tthhiiss ccaassee,, tthhee tteerrmmiinnaattiinngg ppeerriioodd ccaann bbee oommiitttteedd iiff iitt eennddss tthhee ccoommmmaannddss.. TThhee vviissuuaall ccoommmmaanndd mmaayy aallssoo bbee ssppeecciiffiieedd aass oonnee ooff tthhee eexx ccoommmmaannddss.. IInn tthhiiss mmooddee,, iinnppuutt iiss ttaakkeenn ffrroomm tthhee tteerrmmiinnaall.. EEnntteerriinngg aa QQ ccoommmmaanndd iinn vvii mmooddee ccaauusseess tthhee nneexxtt lliinnee mmaattcchhiinngg tthhee ppaatttteerrnn ttoo bbee sseelleecctteedd aanndd vvii ttoo bbee rreeeenntteerreedd,, uunnttiill tthhee lliisstt iiss eexxhhaauusstteedd.. TThhee gglloobbaall,, vv aanndd uunnddoo ccoommmmaannddss ccaannnnoott bbee uusseedd aass ppaarrtt ooff tthheessee ccoommmmaannddss.. TThhee eeddiittoorr ooppttiioonnss aauuttooiinnddeenntt,, aauuttoopprriinntt aanndd rreeppoorrtt aarree ttuurrnneedd ooffff ffoorr tthhee dduurraattiioonn ooff tthhee gglloobbaall aanndd vv ccoommmmaannddss.. Line: The last line modified. Options: Affected by the iiggnnoorreeccaassee and mmaaggiicc options. Turns off the aauuttooiinnddeenntt, aauuttoo-- pprriinntt and rreeppoorrtt options. hhee[[llpp]] Display a help message. Line: Unchanged. Options: None. [[lliinnee]] ii[[nnsseerrtt]][[!!]] The input text is inserted before the specified line. Following the command name with a "!"" cchhaarraacctteerr ccaauusseess tthhee aauuttooiinnddeenntt ooppttiioonn sseettttiinngg ttoo bbee ttoogggglleedd ffoorr tthhee dduurraattiioonn ooff tthhiiss ccoommmmaanndd.. UUSSDD::1133--6688 VVii//EExx RReeffeerreennccee ((EExx CCoommmmaannddss)) Line: Set to the last line input; if no lines were input, set to the line before the target line, or to the first line of the file if there are no lines preceding the target line. Affected by the aauuttooiinnddeenntt and nnuummbbeerr options. [[rraannggee]] jj[[ooiinn]][[!!]] [[ccoouunntt]] [[ffllaaggss]] Join lines of text together. A count ssppeecciiffiieedd ttoo tthhee ccoommmmaanndd ssppeecciiffiieess tthhaatt tthhee llaasstt lliinnee ooff tthhee rraannggee plus count ssuubbsseeqquueenntt lliinneess wwiillll bbee jjooiinneedd.. ((NNoottee,, tthhiiss ddiiffffeerrss bbyy oonnee ffrroomm tthhee ggeenneerraall rruullee wwhheerree oonnllyy ccoouunntt- subsequent lines are affected.) If the current line ends with a whitespace charac- ter, all whitespace is stripped from the next line. Otherwise, if the next line starts with a open parenthesis ("("")),, ddoo nnootthhiinngg.. OOtthheerrwwiissee,, iiff tthhee ccuurrrreenntt lliinnee eennddss wwiitthh aa qquueessttiioonn mmaarrkk ((""??"), period ("."")) oorr eexxccllaammaattiioonn ppooiinntt ((""!!"), insert two spaces. Otherwise, insert a single space. Appending a "!"" cchhaarraacctteerr ttoo tthhee ccoommmmaanndd nnaammee ccaauusseess aa ssiimmpplleerr jjooiinn wwiitthh nnoo wwhhiittee--ssppaaccee pprroocceessss-- iinngg.. Line: Unchanged. Options: None. [[rraannggee]] ll[[iisstt]] [[ccoouunntt]] [[ffllaaggss]] Display the lines unambiguously. Tabs are dis- played as "^I"",, aanndd tthhee eenndd ooff tthhee lliinnee iiss mmaarrkkeedd wwiitthh aa ""$$" character. Line: Set to the last line displayed. Options: Affected by the nnuummbbeerr option. mmaapp[[!!]] [[llhhss rrhhss]] Define or display maps (for vvii only). If "lhs"" aanndd ""rrhhss" are not specified, the current set of command mode maps are displayed. If a "!"" cchhaarraacctteerr iiss aappppeennddeedd ttoo ttoo tthhee ccoommmmaanndd,, tthhee tteexxtt iinnppuutt mmooddee mmaappss aarree ddiissppllaayyeedd.. OOtthheerrwwiissee,, wwhheenn tthhee ""llhhss" character sequence is entered in vvii, the action is as if the correspond- ing "rhs"" hhaadd bbeeeenn eenntteerreedd.. IIff aa ""!!" character is appended to the command name, the mapping is effective during text input mode, otherwise, it is effective during command mode. This allows "lhs"" VVii//EExx RReeffeerreennccee ((EExx CCoommmmaannddss)) UUSSDD::1133--6699 ttoo hhaavvee ttwwoo ddiiffffeerreenntt mmaaccrroo ddeeffiinniittiioonnss aatt tthhee ssaammee ttiimmee:: oonnee ffoorr ccoommmmaanndd mmooddee aanndd oonnee ffoorr iinnppuutt mmooddee.. WWhhiitteessppaaccee cchhaarraacctteerrss rreeqquuiirree eessccaappiinngg wwiitthh aa <> character to be entered in the lhs ssttrriinngg iinn vviissuuaall mmooddee.. NNoorrmmaallllyy,, kkeeyyss iinn tthhee rrhhss string are remapped (see the rreemmaapp option), and it is possible to create infinite loops. However, keys which map to them- selves are not further remapped, regardless of the setting of the rreemmaapp option. For example, the command ":map n nz."" mmaappss tthhee ""nn" key to the nn and zz commands. To exit an infinitely looping map, use the termi- nal cchhaarraacctteerr.. Line: Unchanged. Options: Affected by the rreemmaapp option. [[lliinnee]] mmaa[[rrkk]] <> [[lliinnee]] kk <> Mark the line with the mark .. TThhee eexxpprreessssiioonnss ""''<>" and "`"" ccaann tthheenn bbee uusseedd aass aann aaddddrreessss iinn aannyy ccoommmmaanndd tthhaatt uusseess oonnee.. Line: Unchanged. Options: None. [[rraannggee]] mm[[oovvee]] lliinnee Move the specified lines after the target line. A target line of 0 places the lines at the beginning of the file. Line: Set to the first of the moved lines. Options: None. mmkk[[eexxrrcc]][[!!]] ffiillee Write the abbreviations, editor options and maps to the specified file. Information is written in a form which can later be read back in using the eexx ssoouurrccee command. If file aallrreeaaddyy eexxiissttss,, tthhee mmkkeexxrrcc ccoommmmaanndd wwiillll ffaaiill.. TThhiiss cchheecckk ccaann bbee oovveerr-- rriiddddeenn bbyy aappppeennddiinngg aa ""!!"" cchhaarraacctteerr ttoo tthhee ccoomm-- mmaanndd.. Line: Unchanged. Options: None. UUSSDD::1133--7700 VVii//EExx RReeffeerreennccee ((EExx CCoommmmaannddss)) nn[[eexxtt]][[!!]] [[ffiillee ......]] Edit the next file from the argument list. The nneexxtt command will fail if the file has been modi- fied since the last complete write. This check can be overridden by appending the "!"" cchhaarraacctteerr ttoo tthhee ccoommmmaanndd nnaammee.. TThhee aarrgguummeenntt lliisstt ccaann ooppttiioonnaallllyy bbee rreeppllaacceedd bbyy ssppeecciiffyyiinngg aa nneeww oonnee aass aarrgguummeennttss ttoo tthhiiss ccoommmmaanndd.. IInn tthhiiss ccaassee,, eeddiittiinngg ssttaarrttss wwiitthh tthhee ffiirrsstt ffiillee oonn tthhee nneeww lliisstt.. CCaappiittaalliizziinngg tthhee ffiirrsstt lleetttteerr ooff tthhee ccoommmmaanndd,, ii..ee.. NNeexxtt,, wwhhiillee iinn vvii mmooddee,, wwiillll sseett tthhee aarrgguummeenntt lliisstt aanndd eeddiitt tthhee ffiillee iinn aa nneeww ssccrreeeenn.. IInn tthhiiss ccaassee,, aannyy mmooddiiffiiccaattiioonnss ttoo tthhee ccuurrrreenntt ffiillee aarree iiggnnoorreedd.. Line: Set as described for the eeddiitt command. Options: Affected by the options aauuttoowwrriittee and wwrriitteeaannyy. [[lliinnee]] oo[[ppeenn]] //ppaatttteerrnn// [[ffllaaggss]] Enter open mode. Open mode is the same as being in vvii, but with a one-line window. All the stan- dard vvii commands are available. If a match is found for the optional RE argument, the cursor is set to the start of the matching pattern. _T_h_i_s _c_o_m_m_a_n_d _i_s _n_o_t _y_e_t _i_m_p_l_e_m_e_n_t_e_d_. Line: Unchanged, unless the optional RE is specified, in which case it is set to the line where the matching pattern is found. Options: Affected by the ooppeenn option. pprree[[sseerrvvee]] Save the file in a form that can later be recov- ered using the eexx --rr option. When the file is preserved, an email message is sent to the user. Line: Unchanged. Options: None. pprreevv[[iioouuss]][[!!]] Edit the previous file from the argument list. The pprreevviioouuss command will fail if the file has been modified since the last complete write. This check can be overridden by appending the "!"" cchhaarraacctteerr ttoo tthhee ccoommmmaanndd nnaammee.. CCaappiittaalliizziinngg tthhee ffiirrsstt lleetttteerr ooff tthhee ccoommmmaanndd,, ii..ee.. PPrreevviioouuss,, wwhhiillee iinn vvii mmooddee,, wwiillll eeddiitt tthhee ffiillee iinn aa nneeww ssccrreeeenn.. IInn tthhiiss ccaassee,, aannyy mmooddiiffiiccaattiioonnss ttoo tthhee ccuurrrreenntt ffiillee aarree iiggnnoorreedd.. VVii//EExx RReeffeerreennccee ((EExx CCoommmmaannddss)) UUSSDD::1133--7711 Line: Set as described for the eeddiitt command. Options: Affected by the options aauuttoowwrriittee and wwrriitteeaannyy. None. [[rraannggee]] pp[[rriinntt]] [[ccoouunntt]] [[ffllaaggss]] Display the specified lines. Line: Set to the last line displayed. Options: Affected by the lliisstt and nnuummbbeerr option. [[lliinnee]] ppuu[[tt]] [[bbuuffffeerr]] Append buffer contents to the current line. If a buffer is specified, its contents are appended to the line, otherwise, the contents of the unnamed buffer are used. Line: Set to the line after the current line. Options: None. qq[[uuiitt]][[!!]] End the editing session. If the file has been modified since the last complete write, the qquuiitt command will fail. This check may be overridden by appending a "!"" cchhaarraacctteerr ttoo tthhee ccoommmmaanndd.. IIff tthheerree aarree mmoorree ffiilleess ttoo eeddiitt,, tthhee qquuiitt ccoommmmaanndd wwiillll ffaaiill.. AAppppeennddiinngg aa ""!!"" cchhaarraacctteerr ttoo tthhee ccoomm-- mmaanndd nnaammee oorr eenntteerriinngg ttwwoo qquuiitt ccoommmmaannddss ((ii..ee.. wwqq,, qquuiitt,, xxiitt oorr ZZZZ)) iinn aa rrooww)) wwiillll oovveerrrriiddee tthhiiss cchheecckk aanndd tthhee eeddiittoorr wwiillll eexxiitt.. Line: Unchanged. Options: None. [[lliinnee]] rr[[eeaadd]][[!!]] [[ffiillee]] Read a file. A copy of the specified file is appended to the line. If line iiss 00,, tthhee ccooppyy iiss iinnsseerrtteedd aatt tthhee bbeeggiinnnniinngg ooff tthhee ffiillee.. IIff nnoo ffiillee iiss ssppeecciiffiieedd,, tthhee ccuurrrreenntt ffiillee iiss rreeaadd;; iiff tthheerree iiss nnoo ccuurrrreenntt ffiillee,, tthheenn ffiillee becomes the current file. If there is no current file and no file iiss ssppeecciiffiieedd,, tthheenn tthhee rreeaadd ccoommmmaanndd wwiillll ffaaiill.. IIff ffiillee iiss pprreecceeddeedd bbyy aa ""!!"" cchhaarraacctteerr,, ffiillee iiss ttrreeaatteedd aass iiff iitt wweerree aa sshheellll ccoommmmaanndd,, aanndd ppaasssseedd ttoo tthhee pprrooggrraamm nnaammeedd bbyy tthhee sshheellll eeddiitt ooppttiioonn.. TThhee ssttaannddaarrdd aanndd ssttaannddaarrdd eerrrroorr oouuttppuuttss ooff tthhaatt ccoommmmaanndd aarree rreeaadd iinnttoo tthhee ffiillee aafftteerr tthhee ssppeecciiffiieedd lliinnee.. TThhee ssppeecciiaall mmeeaanniinngg ooff tthhee ""!!"" cchhaarraacctteerr ccaann bbee oovveerrrriiddddeenn bbyy eessccaappiinngg iitt wwiitthh aa bbaacckkssllaasshh ((""\\"")) cchhaarraacctteerr.. UUSSDD::1133--7722 VVii//EExx RReeffeerreennccee ((EExx CCoommmmaannddss)) Line: When executed from eexx, the current line is set to the last line read. When exe- cuted from vvii, the current line is set to the first line read. Options: None. rreecc[[oovveerr]] ffiillee Recover file iiff iitt wwaass pprreevviioouussllyy ssaavveedd.. IIff nnoo ssaavveedd ffiillee bbyy tthhaatt nnaammee eexxiissttss,, tthhee rreeccoovveerr ccoomm-- mmaanndd bbeehhaavveess eeqquuiivvaalleennttllyy ttoo tthhee eeddiitt ccoommmmaanndd.. Line: Set as described for the eeddiitt command. Options: None. rreess[[iizzee]] [[++||--]]ssiizzee VVii mode only. Grow or shrink the current screen. If size iiss aa ppoossiittiivvee,, ssiiggnneedd nnuummbbeerr,, tthhee ccuurrrreenntt ssccrreeeenn iiss ggrroowwnn bbyy tthhaatt mmaannyy lliinneess.. IIff ssiizzee is a negative, signed number, the current screen is shrunk by that many lines. If size iiss nnoott ssiiggnneedd,, tthhee ccuurrrreenntt ssccrreeeenn iiss sseett ttoo tthhee ssppeecciiffiieedd ssiizzee. Applicable only to split screens. Line: Unchanged. Options: None. rreeww[[iinndd]][[!!]] Rewind the argument list. If the current file has been modified since the last complete write, the rreewwiinndd command will fail. This check may be over- ridden by appending the "!"" cchhaarraacctteerr ttoo tthhee ccoomm-- mmaanndd.. OOtthheerrwwiissee,, tthhee ccuurrrreenntt ffiillee iiss sseett ttoo tthhee ffiirrsstt ffiillee iinn tthhee aarrgguummeenntt lliisstt.. Line: Set as described for the eeddiitt command. Options: Affected by the aauuttoowwrriittee and wwrriitteeaannyy options. [[aallll]] ssee[[tt]] [[ooppttiioonn[[==[[vvaalluuee]]]] ......]] [[nnooooppttiioonn ......]] [[ooppttiioonn?? ......]] Display or set editor options. When no arguments are specified, the editor option tteerrmm, and any editor options whose values have been changed from the default settings are displayed. If the argu- ment all iiss ssppeecciiffiieedd,, tthhee vvaalluueess ooff aallll ooff eeddiittoorr ooppttiioonnss aarree ddiissppllaayyeedd.. SSppeecciiffyyiinngg aann ooppttiioonn nnaammee ffoolllloowweedd bbyy tthhee cchhaarraacc-- tteerr ""??" causes the current value of that option to be displayed. The "?"" ccaann bbee sseeppaarraatteedd ffrroomm VVii//EExx RReeffeerreennccee ((EExx CCoommmmaannddss)) UUSSDD::1133--7733 tthhee ooppttiioonn nnaammee bbyy wwhhiitteessppaaccee cchhaarraacctteerrss.. TThhee ""??" is necessary only for Boolean valued options. Boolean options can be given values by the form "set option"" ttoo ttuurrnn tthheemm oonn,, oorr ""sseett nnooooppttiioonn" to turn them off. String and numeric options can be assigned by the form "set option=value"".. AAnnyy wwhhiitteessppaaccee cchhaarraacctteerrss iinn ssttrriinnggss ccaann bbee iinncclluuddeedd lliitteerraallllyy bbyy pprreecceeddiinngg eeaacchh wwiitthh aa bbaacckkssllaasshh.. MMoorree tthhaann oonnee ooppttiioonn ccaann bbee sseett oorr lliisstteedd bbyy aa ssiinnggllee sseett ccoommmmaanndd,, bbyy ssppeecciiffyyiinngg mmuullttiippllee aarrgguu-- mmeennttss,, eeaacchh sseeppaarraatteedd ffrroomm tthhee nneexxtt bbyy wwhhiitteessppaaccee cchhaarraacctteerrss.. Line: Unchanged. Options: None. sshh[[eellll]] Run the shell program. The program named by the sshheellll option is run with a --ii (for interactive) flag. Editing is resumed when that program exits. Line: Unchanged. Options: Affected by the sshheellll option. ssoo[[uurrccee]] ffiillee Read and execute eexx commands from a file. SSoouurrccee commands may be nested. Line: Unchanged. Options: None. [[ffllaaggss]] [[rraannggee]] ss[[uubbssttiittuuttee]] [[//ppaatttteerrnn//rreeppllaaccee//]] [[ooppttiioonnss]] [[ccoouunntt]] [[rraannggee]] && [[ooppttiioonnss]] [[ccoouunntt]] [[ffllaaggss]] [[rraannggee]] ~~ [[ooppttiioonnss]] [[ccoouunntt]] [[ffllaaggss]] Make substitutions. Replace the first instance of pattern wwiitthh tthhee ssttrriinngg rreeppllaaccee on the specified line(s). If the "/pattern/repl/"" aarrgguummeenntt iiss nnoott ssppeecciiffiieedd,, tthhee ""//ppaatttteerrnn//rreeppll//" from the previous ssuubbssttiittuuttee command is used. Any character other than an alphabetic, numeric, or backslash character may be used as the delimiter. If options iinncclluuddeess tthhee lleetttteerr ""cc" (confirm), you will be prompted for confirmation before each replacement is done. An affirmative response (in English, a "y"" cchhaarraacctteerr)) ccaauusseess tthhee rreeppllaacceemmeenntt ttoo bbee mmaaddee.. AA qquuiitt rreessppoonnssee ((iinn EEnngglliisshh,, aa ""qq" character) causes the ssuubbssttiittuuttee command to be terminated. Any other response causes the replacement not to be made, and the ssuubbssttiittuuttee command continues. If options iinncclluuddeess tthhee lleetttteerr UUSSDD::1133--7744 VVii//EExx RReeffeerreennccee ((EExx CCoommmmaannddss)) ""gg" (global), all nonoverlapping instances of pat- tern iinn tthhee lliinnee aarree rreeppllaacceedd.. TThhee && vveerrssiioonn ooff tthhee ccoommmmaanndd iiss tthhee ssaammee aass nnoott ssppeecciiffyyiinngg aa ppaatttteerrnn oorr rreeppllaacceemmeenntt ssttrriinngg ttoo tthhee ssuubbssttiittuuttee ccoommmmaanndd,, aanndd tthhee ""&&"" iiss rreeppllaacceedd bbyy tthhee ppaatttteerrnn aanndd rreeppllaacceemmeenntt iinnffoorrmmaattiioonn ffrroomm tthhee pprree-- vviioouuss ssuubbssttiittuuttee ccoommmmaanndd.. TThhee ~~ vveerrssiioonn ooff tthhee ccoommmmaanndd iiss tthhee ssaammee aass && aanndd ss,, eexxcceepptt tthhaatt tthhee sseeaarrcchh ppaatttteerrnn uusseedd iiss tthhee llaasstt RREE uusseedd iinn _a_n_y ccoommmmaanndd,, nnoott nneecceessssaarriillyy tthhee oonnee uusseedd iinn tthhee llaasstt ssuubbssttiittuuttee ccoommmmaanndd.. FFoorr eexxaammppllee,, iinn tthhee sseeqquueennccee ss//rreedd//bblluuee// //ggrreeeenn ~~ the "~"" iiss eeqquuiivvaalleenntt ttoo ""ss//ggrreeeenn//bblluuee//". The ssuubbssttiittuuttee command may be interrupted, using the terminal interrupt character. All substitu- tions completed before the interrupt are retained. Line: Set to the last line upon which a substi- tution was made. Options: Affected by the iiggnnoorreeccaassee and mmaaggiicc option. ssuu[[ssppeenndd]][[!!]] sstt[[oopp]][[!!]] <> Suspend the edit session. Appending a "!"" cchhaarr-- aacctteerr ttoo tthheessee ccoommmmaannddss ttuurrnnss ooffff tthhee aauuttoowwrriittee ooppttiioonn ffoorr tthhee ccoommmmaanndd.. Line: Unchanged. Options: Affected by the aauuttoowwrriittee and wwrriitteeaannyy options. ttaa[[gg]][[!!]] ttaaggssttrriinngg Edit the file containing the specified tag. If the tag is in a different file, then the new file is edited. If the current file has been modified since the last complete write, the ttaagg command will fail. This check can be overridden by appending the "!"" cchhaarraacctteerr ttoo tthhee ccoommmmaanndd nnaammee.. TThhee ttaagg ccoommmmaanndd sseeaarrcchheess ffoorr ttaaggssttrriinngg iinn tthhee ttaaggss ffiillee((ss)) ssppeecciiffiieedd bbyy tthhee ooppttiioonn.. ((SSeeee _c_t_a_g_s((11)) ffoorr mmoorree iinnffoorrmmaattiioonn oonn ttaaggss ffiilleess..)) VVii//EExx RReeffeerreennccee ((EExx CCoommmmaannddss)) UUSSDD::1133--7755 CCaappiittaalliizziinngg tthhee ffiirrsstt lleetttteerr ooff tthhee ccoommmmaanndd,, ii..ee.. TTaagg,, wwhhiillee iinn vvii mmooddee,, wwiillll eeddiitt tthhee ffiillee iinn aa nneeww ssccrreeeenn.. IInn tthhiiss ccaassee,, aannyy mmooddiiffiiccaattiioonnss ttoo tthhee ccuurrrreenntt ffiillee aarree iiggnnoorreedd.. Line: Set to the line indicated by the tag. Options: Affected by the aauuttoowwrriittee, ttaagglleennggtthh, ttaaggss and wwrriitteeaannyy options. ttaaggnn[[eexxtt]][[!!]] Edit the file containing the next context for the current tag. If the context is in a different file, then the new file is edited. If the current file has been modified since the last complete write, the ttaaggnneexxtt command will fail. This check can be overridden by appending the "!"" cchhaarraacctteerr ttoo tthhee ccoommmmaanndd nnaammee.. CCaappiittaalliizziinngg tthhee ffiirrsstt lleetttteerr ooff tthhee ccoommmmaanndd,, ii..ee.. TTaaggnneexxtt,, wwhhiillee iinn vvii mmooddee,, wwiillll eeddiitt tthhee ffiillee iinn aa nneeww ssccrreeeenn.. IInn tthhiiss ccaassee,, aannyy mmooddiiffiiccaattiioonnss ttoo tthhee ccuurrrreenntt ffiillee aarree iiggnnoorreedd.. Line: Set to the line indicated by the tag. Options: Affected by the aauuttoowwrriittee and wwrriitteeaannyy options. ttaaggpp[[oopp]][[!!]] [[ffiillee || nnuummbbeerr]] Pop to the specified tag in the tags stack. If neither file oorr nnuummbbeerr is specified, the ttaaggppoopp command pops to the most recent entry on the tags stack. If file oorr nnuummbbeerr is specified, the ttaaggppoopp command pops to the most recent entry in the tags stack for that file, or numbered entry in the tags stack, respectively. (See the ddiissppllaayy command for information on displaying the tags stack.) If the file has been modified since the last com- plete write, the ttaaggppoopp command will fail. This check may be overridden by appending a "!"" cchhaarr-- aacctteerr ttoo tthhee ccoommmmaanndd nnaammee.. Line: Set to the line indicated by the tag. Options: Affected by the aauuttoowwrriittee and wwrriitteeaannyy options. ttaaggpp[[rreevv]][[!!]] Edit the file containing the previous context for the current tag. If the context is in a different file, then the new file is edited. If the current file has been modified since the last complete write, the ttaaggpprreevv command will fail. This check can be overridden by appending the "!"" cchhaarraacctteerr UUSSDD::1133--7766 VVii//EExx RReeffeerreennccee ((EExx CCoommmmaannddss)) ttoo tthhee ccoommmmaanndd nnaammee.. CCaappiittaalliizziinngg tthhee ffiirrsstt lleetttteerr ooff tthhee ccoommmmaanndd,, ii..ee.. TTaaggpprreevv,, wwhhiillee iinn vvii mmooddee,, wwiillll eeddiitt tthhee ffiillee iinn aa nneeww ssccrreeeenn.. IInn tthhiiss ccaassee,, aannyy mmooddiiffiiccaattiioonnss ttoo tthhee ccuurrrreenntt ffiillee aarree iiggnnoorreedd.. Line: Set to the line indicated by the tag. Options: Affected by the aauuttoowwrriittee and wwrriitteeaannyy options. ttaaggtt[[oopp]][[!!]] Pop to the least recent tag on the tags stack, clearing the tags stack. If the file has been modified since the last com- plete write, the ttaaggttoopp command will fail. This check may be overridden by appending a "!"" cchhaarr-- aacctteerr ttoo tthhee ccoommmmaanndd nnaammee.. Line: Set to the line indicated by the tag. Options: Affected by the aauuttoowwrriittee and wwrriitteeaannyy options. uunnaa[[bbbbrreevv]] llhhss Delete an abbreviation. Delete lhs ffrroomm tthhee ccuurr-- rreenntt lliisstt ooff aabbbbrreevviiaattiioonnss.. Line: Unchanged. Options: None. uu[[nnddoo]] Undo the last change made to the file. Changes made by gglloobbaall, vv, vviissuuaall and map sequences are considered a single command. If repeated, the uu command alternates between these two states, and is its own inverse. Line: Set to the last line modified by the com- mand. Options: None. uunnmm[[aapp]][[!!]] llhhss Unmap a mapped string. Delete the command mode map definition for lhs.. IIff aa ""!!" character is appended to the command name, delete the text input mode map definition instead. Line: Unchanged. Options: None. vvee[[rrssiioonn]] Display the version of the eexx//vvii editor. VVii//EExx RReeffeerreennccee ((EExx CCoommmmaannddss)) UUSSDD::1133--7777 [[lliinnee]] vvii[[ssuuaall]] [[ttyyppee]] [[ccoouunntt]] [[ffllaaggss]] EExx mode only. Enter vvii. The type iiss ooppttiioonnaall,, aanndd ccaann bbee ""--", "+"" oorr ""^^", as in the eexx zz com- mand, to specify the position of the specified line in the screen window. (The default is to place the line at the top of the screen window.) A count ssppeecciiffiieess tthhee nnuummbbeerr ooff lliinneess tthhaatt wwiillll iinniittiiaallllyy bbee ddiissppllaayyeedd.. ((TThhee ddeeffaauulltt iiss tthhee vvaalluuee ooff tthhee wwiinnddooww eeddiittoorr ooppttiioonn..)) Line: Unchanged unless line iiss ssppeecciiffiieedd,, iinn wwhhiicchh ccaassee iitt iiss sseett ttoo tthhaatt lliinnee.. Options: None. vvii[[ssuuaall]][[!!]] [[++ccmmdd]] [[ffiillee]] VVii mode only. Edit a new file. Identical to the "edit[!] [+cmd] [file]"" ccoommmmaanndd.. CCaappiittaalliizziinngg tthhee ffiirrsstt lleetttteerr ooff tthhee ccoommmmaanndd,, ii..ee.. VViissuuaall,, wwiillll eeddiitt tthhee ffiillee iinn aa nneeww ssccrreeeenn.. IInn tthhiiss ccaassee,, aannyy mmooddiiffiiccaattiioonnss ttoo tthhee ccuurrrreenntt ffiillee aarree iiggnnoorreedd.. vviiuu[[ssaaggee]] [[ccoommmmaanndd]] Display usage for a vvii command. If command iiss ssppeecciiffiieedd,, aa uussaaggee ssttaatteemmeenntt ffoorr tthhaatt ccoommmmaanndd iiss ddiissppllaayyeedd.. OOtthheerrwwiissee,, uussaaggee ssttaatteemmeennttss ffoorr aallll vvii ccoommmmaannddss aarree ddiissppllaayyeedd.. Line: Unchanged. Options: None. [[rraannggee]] ww[[rriittee]][[!!]] [[>>>>]] [[ffiillee]] [[rraannggee]] ww[[rriittee]] [[!!]] [[ffiillee]] [[rraannggee]] wwnn[[!!]] [[>>>>]] [[ffiillee]] [[rraannggee]] wwqq[[!!]] [[>>>>]] [[ffiillee]] Write the file. The specified lines (the entire file, if no range is given) is written to file.. IIff ffiillee is not specified, the current pathname is used. If file iiss ssppeecciiffiieedd,, aanndd iitt eexxiissttss,, oorr iiff tthhee ccuurrrreenntt ppaatthhnnaammee wwaass sseett uussiinngg tthhee ffiillee ccoomm-- mmaanndd,, aanndd tthhee ffiillee aallrreeaaddyy eexxiissttss,, tthheessee ccoommmmaannddss wwiillll ffaaiill.. AAppppeennddiinngg aa ""!!"" cchhaarraacctteerr ttoo tthhee ccoomm-- mmaanndd nnaammee wwiillll oovveerrrriiddee tthhiiss cchheecckk aanndd tthhee wwrriittee wwiillll bbee aatttteemmpptteedd,, rreeggaarrddlleessss.. SSppeecciiffyyiinngg tthhee ooppttiioonnaall "">>>>"" ssttrriinngg wwiillll ccaauussee tthhee wwrriittee ttoo bbee aappppeennddeedd ttoo tthhee ffiillee,, iinn wwhhiicchh ccaassee nnoo tteessttss aarree mmaaddee ffoorr tthhee ffiillee aallrreeaaddyy eexxiissttiinngg.. IIff tthhee ffiillee iiss pprreecceeddeedd bbyy aa ""!!"" cchhaarraacctteerr,, tthhee pprrooggrraamm nnaammeedd bbyy tthhee sshheellll eeddiitt ooppttiioonn iiss iinnvvookkeedd wwiitthh ffiillee aass iittss sseeccoonndd aarrgguummeenntt,, aanndd tthhee UUSSDD::1133--7788 VVii//EExx RReeffeerreennccee ((EExx CCoommmmaannddss)) ssppeecciiffiieedd lliinneess aarree ppaasssseedd aass ssttaannddaarrdd iinnppuutt ttoo tthhaatt ccoommmmaanndd.. TThhee ""!!"" iinn tthhiiss uussaaggee mmuusstt bbee sseepp-- aarraatteedd ffrroomm ccoommmmaanndd nnaammee bbyy aatt lleeaasstt oonnee wwhhiitteess-- ppaaccee cchhaarraacctteerr.. TThhee ssppeecciiaall mmeeaanniinngg ooff tthhee ""!!"" mmaayy bbee oovveerrrriiddddeenn bbyy eessccaappiinngg iitt wwiitthh aa bbaacckkssllaasshh ((""\\"")) cchhaarraacctteerr.. TThhee wwqq vveerrssiioonn ooff tthhee wwrriittee ccoommmmaanndd wwiillll eexxiitt tthhee eeddiittoorr aafftteerr wwrriittiinngg tthhee ffiillee,, iiff tthheerree aarree nnoo ffuurrtthheerr ffiilleess ttoo eeddiitt.. AAppppeennddiinngg aa ""!!"" cchhaarraacctteerr ttoo tthhee ccoommmmaanndd nnaammee oorr eenntteerriinngg ttwwoo ""qquuiitt"" ccoomm-- mmaannddss ((ii..ee.. wwqq,, qquuiitt,, xxiitt oorr ZZZZ)) iinn aa rrooww)) wwiillll oovveerrrriiddee tthhiiss cchheecckk aanndd tthhee eeddiittoorr wwiillll eexxiitt,, iiggnnoorriinngg aannyy ffiilleess tthhaatt hhaavvee nnoott yyeett bbeeeenn eeddiitteedd.. TThhee wwnn vveerrssiioonn ooff tthhee wwrriittee ccoommmmaanndd wwiillll mmoovvee ttoo tthhee nneexxtt ffiillee aafftteerr wwrriittiinngg tthhee ffiillee,, uunnlleessss tthhee wwrriittee ffaaiillss.. Line: Unchanged. Options: Affected by the rreeaaddoonnllyy and wwrriitteeaannyy options. [[rraannggee]] xx[[iitt]][[!!]] [[ffiillee]] Write the file if it has been modified. The spec- ified lines are written to file,, iiff tthhee ffiillee hhaass bbeeeenn mmooddiiffiieedd ssiinnccee tthhee llaasstt ccoommpplleettee wwrriittee ttoo aannyy ffiillee.. IIff nnoo rraannggee is specified, the entire file is written. The xxiitt command will exit the editor after writing the file, if there are no further files to edit. Appending a "!"" cchhaarraacctteerr ttoo tthhee ccoommmmaanndd nnaammee oorr eenntteerriinngg ttwwoo ""qquuiitt"" ccoommmmaannddss ((ii..ee.. wwqq,, qquuiitt,, xxiitt oorr ZZZZ)) iinn aa rrooww)) wwiillll oovveerrrriiddee tthhiiss cchheecckk aanndd tthhee eeddiittoorr wwiillll eexxiitt,, iiggnnoorriinngg aannyy ffiilleess tthhaatt hhaavvee nnoott yyeett bbeeeenn eeddiitteedd.. Line: Unchanged. Options: Affected by the rreeaaddoonnllyy and wwrriitteeaannyy options. [[rraannggee]] yyaa[[nnkk]] [[bbuuffffeerr]] [[ccoouunntt]] Copy the specified lines to a buffer. If no buffer is specified, the unnamed buffer is used. Line: Unchanged. Options: None. [[lliinnee]] zz [[ttyyppee]] [[ccoouunntt]] [[ffllaaggss]] Adjust the window. If no type iiss ssppeecciiffiieedd,, tthheenn ccoouunntt lines following the specified line are dis- played. The default count iiss tthhee vvaalluuee ooff tthhee VVii//EExx RReeffeerreennccee ((EExx CCoommmmaannddss)) UUSSDD::1133--7799 wwiinnddooww ooppttiioonn.. TThhee ttyyppee aarrgguummeenntt cchhaannggeess tthhee ppoossiittiioonn aatt wwhhiicchh lliinnee iiss ddiissppllaayyeedd oonn tthhee ssccrreeeenn bbyy cchhaannggiinngg tthhee nnuummbbeerr ooff lliinneess ddiissppllaayyeedd bbeeffoorree aanndd aafftteerr lliinnee.. TThhee ffoolllloowwiinngg ttyyppee cchhaarraacctteerrss mmaayy bbee uusseedd:: - Place the line at the bottom of the screen. + Place the line at the top of the screen. . Place the line in the middle of the screen. ^ Write out count lines starting count * 2 lines before line; the net effect of this is that a "z^" command following a zz com- mand writes the previous page. = Center line on the screen with a line of hyphens displayed immediately before and after it. The number of preceding and following lines of text displayed are reduced to account for those lines. Line: Set to the last line displayed, with the exception of the type, where the current line is set to the line specified by the command. Options: Affected by the ssccrroollll option. 1188.. 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 abbreviations. (Regardless of the abbrevia- tions, it is only necessary to use the minimum number of characters necessary to distinguish an abbreviation from all other commands for it to be accepted, in nneexx/nnvvii. Historically, only the full name and the official abbreviations were accepted by eexx/vvii. Using full names in your startup files and environmental variables will probably make them more portable.) 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 associated value. Options apply to both eexx and vvii modes, unless oth- erwise specified. With a few exceptions, all options are settable per screen, i.e. the ttaaggss option can be set differently UUSSDD::1133--8800 VVii//EExx RReeffeerreennccee ((OOppttiioonnss)) in each screen. The exceptions are the ccoolluummnnss, lliinneess, sseeccuurree and tteerrmm options. Changing these options modi- fies the respective information for all screens. For information on modifying the options or to display the options and their current values, see the "set" command in the section entitled "EExx CCoommmmaannddss". aallttwweerraassee [[ooffff]] VVii only. Change how vvii does word erase during text input. When this option is set, text is bro- ken up into three classes: alphabetic, numeric and underscore characters, other nonblank characters, and blank characters. Changing from one class to another marks the end of a word. In addition, the class of the first character erased is ignored (which is exactly what you want when erasing path- name components). aauuttooiinnddeenntt,, aaii [[ooffff]] If this option is set, whenever you create a new line (using the vvii AA, aa, CC, cc, II, ii, OO, oo, RR, rr, SS, and ss commands, or the eexx aappppeenndd, cchhaannggee, and iinnsseerrtt commands) the new line is automatically indented to align the cursor with the first non- blank character of the line from which you created it. Lines are indented using tab characters to the extent possible (based on the value of the ttaabbssttoopp option) and then using space characters as necessary. For commands inserting text into the middle of a line, any blank characters to the right of the cursor are discarded, and the first nonblank character to the right of the cursor is aligned as described above. The indent characters are themselves somewhat spe- cial. If you do not enter more characters on the new line before moving to another line, or enter- ing ,, tthhee iinnddeenntt cchhaarraacctteerr wwiillll bbee ddeelleetteedd aanndd tthhee lliinnee wwiillll bbee eemmppttyy.. FFoorr eexxaammppllee,, iiff yyoouu eenntteerr <> twice in succession, the line created by the first wwiillll nnoott hhaavvee aannyy cchhaarraacctteerrss iinn iitt,, rreeggaarrddlleessss ooff tthhee iinnddeennttaattiioonn ooff tthhee pprreevviioouuss oorr ssuubbsseeqquueenntt lliinnee.. IInnddeenntt cchhaarraacctteerrss aallssoo rreeqquuiirree tthhaatt yyoouu eenntteerr aaddddiittiioonnaall eerraassee cchhaarraacctteerrss ttoo ddeelleettee tthheemm.. FFoorr eexxaammppllee,, iiff yyoouu hhaavvee aann iinnddeenntteedd lliinnee,, ccoonnttaaiinniinngg oonnllyy bbllaannkkss,, tthhee ffiirrsstt <> character you enter will erase up to end of the indent charac- ters, and the second will erase back to the begin- ning of the line. (Historically, only the kkeeyy wwoouulldd eerraassee tthhee iinnddeenntt cchhaarraacctteerrss.. VVii//EExx RReeffeerreennccee ((OOppttiioonnss)) UUSSDD::1133--8811 BBootthh tthhee <> key and the usual erase keys work in nnvvii.) In addition, if the cursor is posi- tioned at the end of the indent characters, the keys "0"" wwiillll eerraassee aallll ooff tthhee iinnddeenntt cchhaarraacctteerrss ffoorr tthhee ccuurrrreenntt lliinnee,, rreesseettttiinngg tthhee iinnddeennttaattiioonn lleevveell ttoo 00.. SSiimmiillaarrllyy,, tthhee kkeeyyss ""^^<>" will erase all of the indent char- acters for the current line, leaving the indenta- tion level for future created lines unaffected. Finally, if the aauuttooiinnddeenntt option is set, the SS and cccc commands change from the first nonblank of the line to the end of the line, instead of from the beginning of the line to the end of the line. aauuttoopprriinntt,, aapp [[ooffff]] EExx only. Cause the current line to be automati- cally displayed after the eexx commands <<, >>, ccooppyy, ddeelleettee, jjooiinn, mmoovvee, ppuutt, tt, UUnnddoo, and uunnddoo. This automatic display is suppressed during gglloobbaall and vv commands, and for any command where optional flags are used to explicitly display the line. aauuttoowwrriittee,, aaww [[ooffff]] If this option is set, the vvii !!, ^^^^, ^^]] and <> commands, and the eexx eeddiitt, nneexxtt, rreewwiinndd, ssttoopp, ssuussppeenndd, ttaagg, ttaaggppoopp, and ttaaggttoopp commands automatically write the current file back to the current file name if it has been modified since it was last written. If the write fails, the command fails and goes no further. Appending the optional force flag character "!"" ttoo tthhee eexx ccoommmmaannddss nneexxtt,, rreewwiinndd,, ssttoopp,, ssuussppeenndd,, ttaagg,, ttaaggppoopp,, aanndd ttaaggttoopp ssttooppss tthhee aauuttoommaattiicc wwrriittee ffrroomm bbeeiinngg aatttteemmpptteedd.. ((HHiissttoorriiccaallllyy,, tthhee nneexxtt ccoommmmaanndd iiggnnoorreedd tthhee ooppttiioonnaall ffoorrccee ffllaagg..)) NNoottee,, tthhee eexx ccoommmmaannddss eeddiitt,, qquuiitt,, sshheellll,, aanndd xxiitt aarree _n_o_t aaffffeecctteedd bbyy tthhee aauuttoowwrriittee ooppttiioonn.. TThhee aauuttoowwrriittee ooppttiioonn iiss iiggnnoorreedd iiff tthhee ffiillee iiss ccoonnssiiddeerreedd rreeaadd--oonnllyy ffoorr aannyy rreeaassoonn.. bbaacckkuupp [[""""]] If this option is set, it specifies a pathname used as a backup file, and, whenever a file is written, the file's current contents are copied to it. The pathname is "#"",, ""%%" and "!"" eexxppaannddeedd.. IIff tthhee ffiirrsstt cchhaarraacctteerr ooff tthhee ppaatthhnnaammee iiss ""NN", a version number is appended to the pathname (and UUSSDD::1133--8822 VVii//EExx RReeffeerreennccee ((OOppttiioonnss)) the "N"" cchhaarraacctteerr iiss tthheenn ddiissccaarrddeedd)).. VVeerrssiioonn nnuummbbeerrss aarree aallwwaayyss iinnccrreemmeenntteedd,, aanndd eeaacchh bbaacckkuupp ffiillee wwiillll hhaavvee aa vveerrssiioonn nnuummbbeerr oonnee ggrreeaatteerr tthhaann tthhee hhiigghheesstt vveerrssiioonn nnuummbbeerr ccuurrrreennttllyy ffoouunndd iinn tthhee ddiirreeccttoorryy.. BBaacckkuupp ffiilleess mmuusstt bbee rreegguullaarr ffiilleess,, oowwnneedd bbyy tthhee rreeaall uusseerr IIDD ooff tthhee uusseerr rruunnnniinngg tthhee eeddiittoorr,, aanndd nnoott aacccceessssiibbllee bbyy aannyy ootthheerr uusseerr.. bbeeaauuttiiffyy,, bbff [[ooffff]] If this option is set, all control characters that are not currently being specially interpreted, other than ,, <>, and ,, aarree ddiissccaarrddeedd ffrroomm ccoommmmaannddss rreeaadd iinn bbyy eexx ffrroomm ccoommmmaanndd ffiilleess,, aanndd ffrroomm iinnppuutt tteexxtt eenntteerreedd ttoo vvii ((eeiitthheerr iinnttoo tthhee ffiillee oorr ttoo tthhee ccoolloonn ccoommmmaanndd lliinnee)).. TTeexxtt ffiilleess rreeaadd bbyy eexx//vvii aarree _n_o_t aaffffeecctteedd bbyy tthhee bbeeaauu-- ttiiffyy ooppttiioonn.. ccddppaatthh [[eennvviirroonnmmeenntt vvaarriiaabbllee CCDDPPAATTHH,, oorr ccuurrrreenntt ddiirreecc-- ttoorryy]] This option is used to specify a colon separated list of directories which are used as path pre- fixes for any relative path names used as argu- ments for the ccdd command. The value of this option defaults to the value of the environmental variable CDPATH iiff iitt iiss sseett,, ootthheerrwwiissee ttoo tthhee ccuurrrreenntt ddiirreeccttoorryy.. FFoorr ccoommppaattiibbiilliittyy wwiitthh tthhee PPOOSSIIXX 11000033..22 sshheellll,, tthhee ccdd ccoommmmaanndd ddooeess _n_o_t cchheecckk tthhee ccuurrrreenntt ddiirreeccttoorryy aass aa ppaatthh pprreeffiixx ffoorr rreellaa-- ttiivvee ppaatthh nnaammeess uunnlleessss iitt iiss eexxpplliicciittllyy ssppeecciiffiieedd.. IItt mmaayy bbee ssoo ssppeecciiffiieedd bbyy eenntteerriinngg aann eemmppttyy ssttrriinngg oorr aa "".._" _c_h_a_r_a_c_t_e_r _i_n_t_o _t_h_e _C_D_P_A_T_H vvaarriiaabbllee oorr tthhee ooppttiioonn vvaalluuee.. cceeddiitt [[nnoo ddeeffaauulltt]] This option adds the ability to edit the colon command-line history. This option is set to a string. Whenever the first character of that string is entered on the colon command line, you will enter a normal editing window on the col- lected commands that you've entered on the vvii colon command-line. You may then modify and/or execute the commands. All normal text editing is available, except that you cannot use <> to switch to an alternate screen. Entering a <> will execute the current line of the screen window as an ex command in the context of the screen from which you created the colon command-line screen, and you will then return to that screen. VVii//EExx RReeffeerreennccee ((OOppttiioonnss)) UUSSDD::1133--8833 Because of vvii's parsing rules, it can be difficult to set the colon command-line edit character to the cchhaarraacctteerr.. TToo sseett iitt ttoo <>, use "set cedit="".. IIff tthhee cceeddiitt eeddiitt ooppttiioonn iiss sseett ttoo tthhee ssaammee cchhaarr-- aacctteerr aass tthhee ffiilleecc eeddiitt ooppttiioonn,, vvii wwiillll ppeerrffoorrmm ccoolloonn ccoommmmaanndd--lliinnee eeddiittiinngg iiff tthhee cchhaarraacctteerr iiss eenntteerreedd aass tthhee ffiirrsstt cchhaarraacctteerr ooff tthhee lliinnee,, ootthheerr-- wwiissee,, vvii wwiillll ppeerrffoorrmm ffiillee nnaammee eexxppaannssiioonn.. ccoolluummnnss,, ccoo [[8800]] The number of columns in the screen. Setting this option causes eexx/vvii to set (or reset) the environ- mental variable COLUMNS.. SSeeee tthhee sseeccttiioonn eennttiittlleedd ""SSiizziinngg tthhee SSccrreeeenn"" mmoorree iinnffoorrmmaattiioonn.. ccoommmmeenntt [[ooffff]] VVii only. If the first non-empty line of the file begins with the string "#"",, ""//**" or "//"",, tthhiiss ooppttiioonn ccaauusseess vvii ttoo sskkiipp ttoo tthhee eenndd ooff tthhaatt sshheellll,, CC oorr CC++++ ccoommmmeenntt ((pprroobbaabbllyy aa tteerrrriibbllyy bboorriinngg lleeggaall nnoottiiccee)) bbeeffoorree ddiissppllaayyiinngg tthhee ffiillee.. ddiirreeccttoorryy,, ddiirr [[eennvviirroonnmmeenntt vvaarriiaabbllee TTMMPPDDIIRR,, oorr //ttmmpp]] The directory where temporary files are created. The environmental variable TMPDIR iiss uusseedd aass tthhee ddeeffaauulltt vvaalluuee iiff iitt eexxiissttss,, ootthheerrwwiissee //ttmmpp is used. eeddccoommppaattiibbllee,, eedd [[ooffff]] Remember the values of the "c" and "g" suffixes to the ssuubbssttiittuuttee commands, instead of initializing them as unset for each new command. Specifying pattern and replacement strings to the ssuubbssttiittuuttee command unsets the "c" and "g" suffixes as well. eessccaappeettiimmee [[11]] The 10th's of a second eexx/vvii waits for a subse- quent key to complete an kkeeyy mmaappppiinngg.. eerrrroorrbbeellllss,, eebb [[ooffff]] EExx only. EExx error messages are normally presented in inverse video. If that is not possible for the terminal, setting this option causes error mes- sages to be announced by ringing the terminal bell. eexxrrcc,, eexx [[ooffff]] If this option is turned on in the EXINIT environ- ment variables, or the system or $HOME startup files, the local startup files are read, unless they are the same as the system or $HOME startup UUSSDD::1133--8844 VVii//EExx RReeffeerreennccee ((OOppttiioonnss)) files or fail to pass the standard permission checks. See the section entitled "SSttaarrttuupp IInnffoorr-- mmaattiioonn" for more information. eexxtteennddeedd [[ooffff]] This option causes all regular expressions to be treated as POSIX 1003.2 Extended Regular Expres- sions (which are similar to historic _e_g_r_e_p(1) style expressions). ffiilleecc [[nnoo ddeeffaauulltt]] This option adds the ability to do shell expansion when entering input on the colon command line. This option is set to a string. Whenever the first character of that string is entered on the colon command line, the delimited string immediately before the cursor is expanded as if it were followed by a * cchhaarraacctteerr,, aanndd ffiillee nnaammee eexxppaannssiioonn ffoorr tthhee eexx eeddiitt ccoommmmaanndd wwaass ddoonnee.. IIff nnoo mmaattcchh iiss ffoouunndd,, tthhee ssccrreeeenn iiss ffllaasshheedd aanndd tteexxtt iinnppuutt rreessuummeedd.. IIff aa ssiinnggllee mmaattcchh rreessuullttss,, tthhaatt mmaattcchh rreeppllaacceess tthhee eexxppaannddeedd tteexxtt.. IInn aaddddiittiioonn,, iiff tthhee ssiinnggllee mmaattcchh iiss ffoorr aa ddiirreeccttoorryy,, aa // cchhaarraacctteerr iiss aappppeennddeedd aanndd ffiillee ccoommpplleettiioonn iiss rreeppeeaatteedd.. IIff mmoorree tthhaann aa ssiinnggllee mmaattcchh rreessuullttss,, aannyy uunniiqquuee pprree-- ffiixx sshhaarreedd bbyy tthhee mmaattcchheess rreeppllaacceess tthhee eexxppaannddeedd tteexxtt,, tthhee mmaattcchheess aarree ddiissppllaayyeedd,, aanndd tteexxtt iinnppuutt rreessuummeedd.. BBeeccaauussee ooff vvii''ss ppaarrssiinngg rruulleess,, iitt ccaann bbee ddiiffffiiccuulltt ttoo sseett tthhee ppaatthh ccoommpplleettiioonn cchhaarraacctteerr ttoo ttwwoo ccoomm-- mmaanndd vvaalluueess,, <> aanndd <>.. TToo sseett iitt ttoo <>,, uussee ""sseett ffiilleecc==<><>"".. TToo sseett iitt ttoo <>,, uussee ""sseett ffiilleecc==\\<>"".. IIff tthhee cceeddiitt eeddiitt ooppttiioonn iiss sseett ttoo tthhee ssaammee cchhaarr-- aacctteerr aass tthhee ffiilleecc eeddiitt ooppttiioonn,, vvii wwiillll ppeerrffoorrmm ccoolloonn ccoommmmaanndd--lliinnee eeddiittiinngg iiff tthhee cchhaarraacctteerr iiss eenntteerreedd aass tthhee ffiirrsstt cchhaarraacctteerr ooff tthhee lliinnee,, ootthheerr-- wwiissee,, vvii wwiillll ppeerrffoorrmm ffiillee nnaammee eexxppaannssiioonn.. ffllaasshh [[oonn]] This option causes the screen to flash instead of beeping the keyboard, on error, if the terminal has the capability. hhaarrddttaabbss,, hhtt [[88]] This option defines the spacing between hardware tab settings, i.e. the tab expansion done by the operating system and/or the terminal itself. As nneexx/nnvvii never writes cchhaarraacctteerrss ttoo tthhee tteerr-- mmiinnaall,, uunnlliikkee hhiissttoorriicc vveerrssiioonnss ooff eexx//vvii,, tthhiiss ooppttiioonn ddooeess nnoott ccuurrrreennttllyy hhaavvee aannyy aaffffeecctt.. VVii//EExx RReeffeerreennccee ((OOppttiioonnss)) UUSSDD::1133--8855 iicclloowweerr [[ooffff]] The iicclloowweerr edit option makes all Regular Expres- sions case-insensitive, as long as an upper-case letter does not appear in the search string. iiggnnoorreeccaassee,, iicc [[ooffff]] This option causes regular expressions, both in eexx commands and in searches, to be evaluated in a case-insensitive manner. kkeeyyttiimmee [[66]] The 10th's of a second eexx/vvii waits for a subse- quent key to complete a key mapping. lleeffttrriigghhtt [[ooffff]] VVii only. This option causes the screen to be scrolled left-right to view lines longer than the screen, instead of the traditional vvii screen interface which folds long lines at the right-hand margin of the terminal. lliinneess,, llii [[2244]] VVii only. The number of lines in the screen. Set- ting this option causes eexx/vvii to set (or reset) the environmental variable LINES.. SSeeee tthhee sseeccttiioonn eennttiittlleedd ""SSiizziinngg tthhee SSccrreeeenn"" ffoorr mmoorree iinnffoorrmmaattiioonn.. lliisspp [[ooffff]] VVii only. This option changes the behavior of the vvii ((, )), {{, }}, [[[[ and ]]]] commands to match the Lisp language. Also, the aauuttooiinnddeenntt option's behavior is changed to be appropriate for 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]] This option causes lines to be displayed in an unambiguous fashion. Specifically, tabs are dis- played as control characters, i.e. "^I"",, aanndd tthhee eennddss ooff lliinneess aarree mmaarrkkeedd wwiitthh aa ""$$" character. lloocckk [[oonn]] This option causes the editor to attempt to get an exclusive lock on any file being edited, read or written. Reading or writing a file that cannot be locked produces a warning message, but no other effect. Editing a file that cannot be locked results in a read only edit session, as if the rreeaaddoonnllyy edit option were set. mmaaggiicc [[oonn]] This option is on by default. Turning the mmaaggiicc option off causes all regular expression UUSSDD::1133--8866 VVii//EExx RReeffeerreennccee ((OOppttiioonnss)) characters except for "^"" aanndd ""$$", to be treated as ordinary characters. To re-enable characters individually, when the mmaaggiicc option is off, pre- cede them with a backslash "\"" cchhaarraacctteerr.. SSeeee tthhee sseeccttiioonn eennttiittlleedd ""RReegguullaarr EExxpprreessssiioonnss aanndd RReeppllaaccee-- mmeenntt SSttrriinnggss"" ffoorr mmoorree iinnffoorrmmaattiioonn.. mmaattcchhttiimmee [[77]] VVii only. The 10th's of a second vvii pauses on the matching character when the sshhoowwmmaattcchh option is set. mmeessgg [[oonn]] This option allows other users to contact you using the _t_a_l_k(1) and _w_r_i_t_e(1) utilities, while you are editing. EExx/vvii does not turn message on, i.e. if messages were turned off when the editor was invoked, they will stay turned off. This option only permits you to disallow messages for the edit session. See the _m_e_s_g(1) utility for more information. mmssggccaatt [[..//]] This option selects a message catalog to be used to display error and informational messages in a specified language. If the value of this option ends with a '/', it is treated as the name of a directory that contains a message catalog "vi_XXXX"",, wwhheerree ""XXXXXXXX" is the value of the LANG eennvviirroonnmmeennttaall vvaarriiaabbllee,, iiff iitt''ss sseett,, oorr tthhee vvaalluuee ooff tthhee LLCC__MMEESSSSAAGGEESS environmental variable if it's not. If neither of those environmental variables are set, or if the option doesn't end in a '/', the option is treated as the full path name of the message catalog to use. If any messages are missing from the catalog, the backup text (English) is used instead. See the distribution file catalog/README ffoorr aaddddii-- ttiioonnaall iinnffoorrmmaattiioonn oonn bbuuiillddiinngg aanndd iinnssttaalllliinngg mmeess-- ssaaggee ccaattaallooggss.. mmooddeelliinneess,, mmooddeelliinnee [[ooffff]] If the mmooddeelliinneess option is set, eexx/vvii has histori- cally scanned the first and last five lines of each file as it is read for editing, looking for any eexx commands that have been placed in those lines. After the startup information has been processed, and before the user starts editing the file, any commands embedded in the file are exe- cuted. VVii//EExx RReeffeerreennccee ((OOppttiioonnss)) UUSSDD::1133--8877 Commands were recognized by the letters "e" or "v" followed by "x" or "i", at the beginning of a line or following a tab or space character, and fol- lowed by a ":", an eexx command, and another ":". This option is a security problem of immense pro- portions, and should not be used under any circum- stances. _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. By default, the C library function _i_s_p_r_i_n_t(3) is used to determine if a character is printable or not. This edit option overrides that decision. nnuummbbeerr,, nnuu [[ooffff]] Precede each line displayed with its current line number. ooccttaall [[ooffff]] Display unknown characters as octal numbers ("\###"")),, iinnsstteeaadd ooff tthhee ddeeffaauulltt hheexxaaddeecciimmaall ((""\\xx####"). ooppeenn [[oonn]] EExx only. If this option is not set, the ooppeenn and vviissuuaall commands are disallowed. ooppttiimmiizzee,, oopptt [[oonn]] VVii only. Throughput of text is expedited by set- ting the terminal not to do automatic carriage returns when printing more than one (logical) line of output, greatly speeding output on terminals without addressable cursors when text with leading white space is printed. _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]] VVii only. Define additional paragraph boundaries for the {{ and }} commands. The value of this option must be a character string consisting of zero or more character pairs. In the text to be edited, the character string .,, ((wwhheerree <> is one of the character pairs in the option's value) defines a paragraph boundary. For example, if the option were set to LaA##,, tthheenn aallll ooff tthhee ffoolllloowwiinngg aaddddiittiioonnaall ppaarraaggrraapphh bboouunnddaarriieess wwoouulldd bbee UUSSDD::1133--8888 VVii//EExx RReeffeerreennccee ((OOppttiioonnss)) rreeccooggnniizzeedd:: <>..LLaa <>..AA<> <>..#### ppaatthh [[]] The path option can be used to specify a -separated list of paths, similar to the PATH eennvviirroonnmmeenntt vvaarriiaabbllee iinn tthhee sshheellllss.. IIff tthhiiss ooppttiioonn iiss sseett,, tthhee nnaammee ooff tthhee ffiillee ttoo bbee eeddiitteedd iiss nnoott aann aabbssoolluuttee ppaatthhnnaammee,, tthhee ffiirrsstt ccoommppoonneenntt ooff tthhee ffiilleennaammee iiss nnoott "".." or ".."",, aanndd tthhee ffiillee ttoo bbee eeddiitteedd ddooeessnn''tt eexxiisstt iinn tthhee ccuurrrreenntt ddiirreecc-- ttoorryy,, tthhee eelleemmeennttss ooff tthhee ppaatthh ooppttiioonn aarree sseeqquueenn-- ttiiaallllyy sseeaarrcchheedd ffoorr aa ffiillee ooff tthhee ssppeecciiffiieedd nnaammee.. IIff ssuucchh aa ffiillee iiss ffoouunndd,, iitt iiss eeddiitteedd.. pprriinntt [[""""]] Characters that are always handled as printable characters. By default, the C library function _i_s_p_r_i_n_t(3) is used to determine if a character is printable or not. This edit option overrides that decision. pprroommpptt [[oonn]] EExx only. This option causes eexx to prompt for com- mand input with a ":"" cchhaarraacctteerr;; wwhheenn iitt iiss nnoott sseett,, nnoo pprroommpptt iiss ddiissppllaayyeedd.. rreeaaddoonnllyy,, rroo [[ooffff]] This option causes a force flag to be required to attempt to write the file. Setting this option is equivalent to using the --RR command line option, or executing the vvii program using the name vviieeww. The rreeaaddoonnllyy edit option is not usually persis- tent, like other edit options. If the --RR command line option is set, vvii is executed as vviieeww, or the rreeaaddoonnllyy edit option is explicitly set, all files edited in the screen will be marked readonly, and the force flag will be required to write them. However, if none of these conditions are true, or the rreeaaddoonnllyy edit option is explicitly unset, then the rreeaaddoonnllyy edit option will toggle based on the write permissions of the file currently being edited as of when it is loaded into the edit buffer. In other words, the rreeaaddoonnllyy edit option will be set if the current file lacks write per- missions, and will not be set if the user has write permissions for the file. VVii//EExx RReeffeerreennccee ((OOppttiioonnss)) UUSSDD::1133--8899 rreeccddiirr [[//vvaarr//ttmmpp//vvii..rreeccoovveerr]] The directory where recovery files are stored. If you change the value of rreeccddiirr, be careful to choose a directory whose contents are not regu- larly deleted. Bad choices include directories in memory based filesystems, or /tmp,, oonn mmoosstt ssyyss-- tteemmss,, aass tthheeiirr ccoonntteennttss aarree rreemmoovveedd wwhheenn tthhee mmaacchhiinnee iiss rreebbooootteedd.. PPuubblliicc ddiirreeccttoorriieess lliikkee //uussrr//ttmmpp and /var/tmp aarree uussuuaallllyy ssaaffee,, aalltthhoouugghh ssoommee ssiitteess ppeerriiooddiiccaallllyy pprruunnee oolldd ffiilleess ffrroomm tthheemm.. TThheerree iiss nnoo rreeqquuiirree-- mmeenntt tthhaatt yyoouu uussee aa ppuubblliicc ddiirreeccttoorryy,, ee..gg.. aa ssuubb-- ddiirreeccttoorryy ooff yyoouurr hhoommee ddiirreeccttoorryy wwiillll wwoorrkk ffiinnee.. FFiinnaallllyy,, iiff yyoouu cchhaannggee tthhee vvaalluuee ooff rreeccddiirr,, yyoouu mmuusstt mmooddiiffyy tthhee rreeccoovveerryy ssccrriipptt ttoo ooppeerraattee iinn yyoouurr cchhoosseenn rreeccoovveerryy aarreeaa.. SSeeee tthhee sseeccttiioonn eennttiittlleedd ""RReeccoovveerryy"" ffoorr ffuurrtthheerr iinnffoorrmmaattiioonn.. rreeddrraaww,, rree [[ooffff]] VVii only. The editor simulates (using great amounts of output), an intelligent terminal on a dumb terminal (e.g. during insertions in vvii the characters to the right of the cursor are refreshed as each input character is typed). _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]] If this option is set, it is possible to define macros in terms of other macros. Otherwise, each key is only remapped up to one time. For example, if "A"" iiss mmaappppeedd ttoo ""BB", and "B"" iiss mmaappppeedd ttoo ""CC", The keystroke "A"" wwiillll bbee mmaappppeedd ttoo ""CC" if the rreemmaapp option is set, and to "B"" iiff iitt iiss nnoott sseett.. rreeppoorrtt [[55]] Set the threshold of the number of lines that need to be changed or yanked before a message will be displayed to the user. For everything but the yank command, the value is the largest value about which the editor is silent, i.e. by default, 6 lines must be deleted before the user is notified. However, if the number of lines yanked is greater than _o_r _e_q_u_a_l _t_o the set value, it is reported to the user. rruulleerr [[ooffff]] VVii only. Display a row/column ruler on the colon UUSSDD::1133--9900 VVii//EExx RReeffeerreennccee ((OOppttiioonnss)) command line. ssccrroollll,, ssccrr [[((eennvviirroonnmmeenntt vvaarriiaabbllee LLIINNEESS -- 11)) // 22]] Set the number of lines scrolled by the eexx <> and <> commands. Historically, the eexx zz command, when specified without a count, used two times the size of the scroll value; the POSIX 1003.2 standard specified the window size, which is a better choice. sseeaarrcchhiinnccrr [[ooffff]] The sseeaarrcchhiinnccrr edit option makes the search com- mands // and ?? incremental, i.e. the screen is updated and the cursor moves to the matching text as the search pattern is entered. If the search pattern is not found, the screen is beeped and the cursor remains on the colon-command line. Erasing characters from the search pattern backs the cur- sor up to the previous matching text. sseeccttiioonnss,, sseecctt [[NNHHSSHHHH HHUUnnhhsshh]] VVii only. Define additional section boundaries for the [[[[ and ]]]] commands. The sseeccttiioonnss option should be set to a character string consisting of zero or more character pairs. In the text to be edited, the character string .,, ((wwhheerree <> is one of the character pairs in the option's value), defines a section boundary in the same manner that ppaarraaggrraapphhss option boundaries are defined. sseeccuurree [[ooffff]] The sseeccuurree edit option turns off all access to external programs. This means that the versions of the rreeaadd and wwrriittee commands that filter text through other programs, the vvii !! and <> commands, the eexx !!, ssccrriipptt, sshheellll, ssttoopp and ssuuss-- ppeenndd commands and file name expansion will not be permitted. Once set, the sseeccuurree edit option may not be unset. sshheellll,, sshh [[eennvviirroonnmmeenntt vvaarriiaabbllee SSHHEELLLL,, oorr //bbiinn//sshh]] Select the shell used by the editor. The speci- fied path is the pathname of the shell invoked by the vvii !! shell escape command and by the eexx sshheellll command. This program is also used to resolve any shell meta-characters in eexx commands. sshheellllmmeettaa [[~~{{[[**??$$``''""\\]] The set of characters that eexx checks for when doing file name expansion. If any of the speci- fied characters are found in the file name VVii//EExx RReeffeerreennccee ((OOppttiioonnss)) UUSSDD::1133--9911 arguments to the eexx commands, the arguments are expanded using the program defined by the sshheellll option. The default set of characters is a union of meta characters from the Version 7 and the Berkeley C shell. sshhiiffttwwiiddtthh,, ssww [[88]] Set the autoindent and shift command indentation width. This width is used by the aauuttooiinnddeenntt option and by the <<, >>, and sshhiifftt commands. sshhoowwmmaattcchh,, ssmm [[ooffff]] VVii only. This option causes vvii, when a "}"" oorr ""))" is entered, to briefly move the cursor the match- ing "{"" oorr ""((". See the mmaattcchhttiimmee option for more information. sshhoowwmmooddee,, ssmmdd [[ooffff]] VVii only. This option causes vvii to display a string identifying the current editor mode on the colon command line. The string is preceded by an asterisk (``*'') if the file has been modified since it was last completely written, ssiiddeessccrroollll [[1166]] VVii only. Sets the number of columns that are shifted to the left or right, when vvii is doing left-right scrolling and the left or right margin is crossed. See the lleeffttrriigghhtt option for more information. sslloowwooppeenn,, ssllooww [[ooffff]] This option affects the display algorithm used by vvii, holding off display updating during input of new text to improve throughput when the terminal in use is slow and unintelligent. _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]] If this option is turned on, vvii historically read startup files that were owned by someone other than the editor user. See the section entitled "SSttaarrttuupp IInnffoorrmmaattiioonn" for more information. This option is a security problem of immense propor- tions, and should not be used under any circum- stances. _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 dis- play. UUSSDD::1133--9922 VVii//EExx RReeffeerreennccee ((OOppttiioonnss)) ttaagglleennggtthh,, ttll [[00]] This option sets the maximum number of characters that are considered significant in a tag name. Setting the value to 0 makes all of the characters in the tag name significant. ttaaggss,, ttaagg [[ttaaggss //vvaarr//ddbb//lliibbcc..ttaaggss //ssyyss//kkeerrnn//ttaaggss]] Sets the list of tags files, in search order, which are used when the editor searches for a tag. tteerrmm,, ttttyyttyyppee,, ttttyy [[eennvviirroonnmmeenntt vvaarriiaabbllee TTEERRMM]] Set the terminal type. Setting this option causes eexx/vvii to set (or reset) the environmental variable TERM.. tteerrssee [[ooffff]] This option has historically made editor messages less verbose. It has no effect in this implemen- tation. See the vveerrbboossee option for more informa- tion. ttiillddeeoopp [[ooffff]] Modify the ~~ command to take an associated motion. ttiimmeeoouutt,, ttoo [[oonn]] If this option is set, eexx/vvii waits for a specific period for a subsequent key to complete a key map- ping (see the kkeeyyttiimmee option). If the option is not set, the editor waits until enough keys are entered to resolve the ambiguity, regardless of how long it takes. ttttyywweerraassee [[ooffff]] VVii only. This option changes how vvii does word erase during text input. If this option is set, text is broken up into two classes, blank charac- ters and nonblank characters. Changing from one class to another marks the end of a word. vveerrbboossee [[ooffff]] VVii only. VVii historically bells the terminal for many obvious mistakes, e.g. trying to move past the left-hand margin, or past the end of the file. If this option is set, an error message is dis- played for all errors. ww330000 [[nnoo ddeeffaauulltt]] VVii only. Set the window size if the baud rate is less than 1200 baud. See the wwiinnddooww option for more information. ww11220000 [[nnoo ddeeffaauulltt]] VVii only. Set the window size if the baud rate is VVii//EExx RReeffeerreennccee ((OOppttiioonnss)) UUSSDD::1133--9933 equal to 1200 baud. See the wwiinnddooww option for more information. ww99660000 [[nnoo ddeeffaauulltt]] VVii only. Set the window size if the baud rate is greater than 1200 baud. See the wwiinnddooww option for more information. wwaarrnn [[oonn]] EExx 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 -- 11]] This option determines the default number of lines in a screenful, as displayed by the zz command. It also determines the number of lines scrolled by the vvii commands <> and <>, and the default number of lines scrolled by the vvii commands <> and <>. The value of window can be unrelated to the real screen size, although it starts out as the number of lines on the screen. See the section entitled "SSiizziinngg tthhee SSccrreeeenn" for more information. Setting the value of the wwiinnddooww option is the same as using the --ww command line option. If the value of the wwiinnddooww option (as set by the wwiinnddooww, ww330000, ww11220000 or ww99660000 options) is smaller than the actual size of the screen, large screen movements will result in displaying only that smaller number of lines on the screen. (Further movements in that same area will result in the screen being filled.) This can provide a perfor- mance improvement when viewing different places in one or more files over a slow link. Resetting the window size does not reset the default number of lines scrolled by the <> and <> commands. wwiinnddoowwnnaammee [[ooffff]] VVii changes the name of the editor's icon/window to the current file name when it's possible and not destructive, i.e., when the editor can restore it to its original value on exit or when the icon/window will be discarded as the editor exits. If the wwiinnddoowwnnaammee edit option is set, vvii will change the icon/window name even when it's destructive and the icon/window name will remain after the editor exits. (This is the case for _x_t_e_r_m(1)). UUSSDD::1133--9944 VVii//EExx RReeffeerreennccee ((OOppttiioonnss)) wwrraapplleenn,, wwll [[00]] This option is identical to the wwrraappmmaarrggiinn option, with the exception that it specifies the number of columns from the _l_e_f_t margin before the line splits, not the right margin. If both wwrraapplleenn and wwrraappmmaarrggiinn are set, the wwrraapp-- mmaarrggiinn value is used. wwrraappmmaarrggiinn,, wwmm [[00]] VVii only. If the value of the wwrraappmmaarrggiinn option is non-zero, vvii will split lines so that they end at least that number of columns before the right-hand margin of the screen. (Note, the value of wwrraapp-- mmaarrggiinn is _n_o_t a text length. In a screen that is 80 columns wide, the command ":set wrapmargin=8_" _a_t_t_e_m_p_t_s _t_o _k_e_e_p _t_h_e _l_i_n_e_s _l_e_s_s _t_h_a_n _o_r _e_q_u_a_l _t_o _7_2 _c_o_l_u_m_n_s _w_i_d_e_._) _L_i_n_e_s _a_r_e _s_p_l_i_t _a_t _t_h_e _p_r_e_v_i_o_u_s _w_h_i_t_e_s_p_a_c_e _c_h_a_r_a_c_- _t_e_r _c_l_o_s_e_s_t _t_o _t_h_e _n_u_m_b_e_r_. _A_n_y _t_r_a_i_l_i_n_g _w_h_i_t_e_s_- _p_a_c_e _c_h_a_r_a_c_t_e_r_s _b_e_f_o_r_e _t_h_a_t _c_h_a_r_a_c_t_e_r _a_r_e _d_e_l_e_t_e_d_. _I_f _t_h_e _l_i_n_e _i_s _s_p_l_i_t _b_e_c_a_u_s_e _o_f _a_n _i_n_s_e_r_t_e_d _<_s_p_a_c_e_> or _c_h_a_r_a_c_t_e_r_, _a_n_d _y_o_u _t_h_e_n _e_n_t_e_r _a_n_o_t_h_e_r _<_s_p_a_c_e_> character, it is discarded. If wrapmargin is set to 0, or if there is no blank character upon which to split the line, the line is not broken. If both wwrraapplleenn and wwrraappmmaarrggiinn are set, the wwrraapp-- mmaarrggiinn value is used. wwrraappssccaann,, wwss [[oonn]] This option causes searches to wrap around the end or the beginning of the file, and back to the starting point. Otherwise, the end or beginning of the file terminates the search. wwrriitteeaannyy,, wwaa [[ooffff]] If this option is set, file-overwriting checks that would usually be made before the wwrriittee and xxiitt commands, or before an automatic write (see the aauuttoowwrriittee option), are not made. This allows a write to any file, provided the file permissions allow it. VVii//EExx RReeffeerreennccee UUSSDD::1133--9955 1199.. IInnddeexx ! 30, 60 ?RE? 35 cedit 82 "" 59 @ 38, 61 change 64 # 31, 61 A 38 chdir 64 $ 31 B 38 columns 83 % 32 C 39 comment 83 & 32, 73 D 39 copy 64 ( 33 E 39 count 23, 58 ) 34 F 40 cscope 64 * 61 G 40 current pathname 18 + 27 H 40 d 46 , 34 I 40 delete 64 /RE/ 35 J 41 directory 83 0 36 L 41 display 65 054 M 41 e 47 : 36 N 35 edcompatible83 ; 37 O 42 edit 65 < 37, 61 P 42 errorbells 83 20 Q 42 escapetime 83 25 R 42 exrc 83 25 S 43 extended 84 , 60 T 43 exusage 66 26 U 43 f 47 26 W 43 fg 66 26 X 44 file 58, 66 , 54 Y 44 filec 84 27 ZZ 44 flags 58 27 [[ 44 flash 84 27 - 34 global 66 27 ]] 45 hardtabs 84 27 ^ 45 help 67 27 ^54 i 47 , 54 _ 45 iclower 84 28 `33 ignorecase 85 , 55 a 45 insert 67 55 abbrev 62 j 27 28 alternate pathname 18 join 68 , 74 altwerase 80 k 27, 69 29 append 63 keytime 85 29 args 63 l 30 58, 60 autoindent 80 leftright 85 54 autoprint 81 line 58 29, 55 autowrite 81 lines 85 , 55 b 46 lisp 85 55 backup 81 list 68, 85 17, 54 beautify 82 lock 85 20 bg 63 m 47 54 bigword 24 magic 85 30 buffer 18 map 68 55 c 46 mark 69 = 62 cd 64 matchtime 86 > 37, 62 cdpath 82 mesg 86 UUSSDD::1133--9966 VVii//EExx RReeffeerreennccee mkexrc 69 stop 74 modelines 86 substitute 73 motion 22 suspend 74 move 69 t 49, 64 msgcat 86 tabstop 91 n 35 tag 74 next 69 taglength 91 noprint 87 tagnext 75 number 61, 87 tagpop 75 o 48 tagprev 75 octal 87 tags 92 open 70, 87 tagtop 76 optimize 87 term 92 p 48 terse 92 paragraph 24 tildeop 92 paragraphs 87 timeout 92 path 88 ttywerase 92 preserve 70 u 49 previous 70 unabbrev 76 previous context 22 undo 76 print 71, 88 unmap 76 prompt 88 unnamed buffer 19 put 71 v 67 quit 71 verbose 92 r 48 version 76 range 58 visual 76, 77 read 71 viusage 77 readonly 88 w 49 recdir 88 w1200 92 recover 72 w300 92 redraw 89 w9600 93 remap 89 warn 93 report 89 whitespace 20 resize 72 window 93 rewind 72 windowname 93 ruler 89 wn 77 s 48 word 23 scroll 90 wq 77 searchincr 90 wraplen 93 section 24 wrapmargin 94 sections 90 wrapscan 94 secure 90 write 77 sentence 24 writeany 94 set 72 x 50 shell 73, 90 xit 78 shellmeta 90 y 50 shiftwidth 91 yank 78 showmatch 91 z 50, 78 showmode 91 { 51 sidescroll 91 | 51 slowopen 91 } 52 source 73 ~ 52, 73 sourceany 91 VVii//EExx RReeffeerreennccee UUSSDD::1133--33 TTaabbllee ooff CCoonntteennttss Description ...................................... 4 Additional Features in Nex/Nvi ................... 4 Startup Information .............................. 6 Recovery ......................................... 7 Sizing the Screen ................................ 9 Character Display ................................ 9 Multiple Screens ................................. 10 Tags, Tag Stacks, and Cscope ..................... 11 Regular Expressions and Replacement Strings ...... 13 Scripting Languages .............................. 15 General Editor Description ....................... 16 Vi Description ................................... 20 Vi Commands ...................................... 24 Vi Text Input Commands ........................... 53 Ex Addressing ........................................ 55 Ex Description ................................... 57 Ex Commands ...................................... 59 Set Options ...................................... 79 Index ............................................ 95