Ex Description
**************

The following words have special meanings for ex commands.

     <end-of-file>

     The end-of-file character is used to scroll the screen in the ex editor. This character is normally <control-D>. However, whatever character is set for the current terminal is supported as well as <control-D>. line

     A single-line address, given in any of the forms described in the section entitled Ex Addressing . The default for lineis the current line. range

     A line, or a pair of line addresses, separated by a comma or semicolon. (See the section entitled Ex Addressing for more information.) The default for range is the current line only, i.e. .,.. A percent sign % stands for the range 1,$. The starting address must be less than, or equal to, the ending address. count

     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 in a 10 line file is acceptable, and will print from the current line through the last line in the file. flags

     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 #, l or p commands. In addition, any number of + or - characters can be specified 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 flagsis none. file

     A pattern used to derive a pathname; the default is the current file. File names are subjected to normal sh,1 word expansions.

Anywhere a file name is specified, it is also possible to use the special string /tmp. This will be 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 commands that use either, the starting line for the command is the last line addressed by the range, and count- 1 subsequent lines are affected by the command, e.g. the command 2,3p4 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 list, number or print 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 print 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 <carriage-return>, % and # retain their literal value when preceded by a backslash.

Ex Commands
***********

The following section describes the commands available in the ex 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 preceding the [ character), the full command (all characters shown for the command word, omitting the [ and ] characters), or any leading subset of the full command 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 ex command described below notes the new current line after it is executed, as well as any options that affect the command.
 -- Command: "

     A comment. Command lines beginning with the double-quote character " are ignored. This permits comments in editor scripts and startup files.

 -- Command: <control-D>

 -- Command: <end-of-file>

     Scroll the screen. Write the next N lines, where N is the value of the scroll option. The command is the end-of-file terminal character, which may be different on different terminals. Traditionally, it is the <control-D>key.

     Historically, the eof command ignored any preceding count, and the <end-of-file>character was ignored unless it was entered as the first character of the command. This implementation treats it as a command only if entered as the first character of the command line, and otherwise treats it as any other character.

     Line:
          Set to the last line written.

     Options:
          Affected by the scroll option.

 -- Command: ! argument(s)

 -- Command: [range]! argument(s)
     Execute a shell command, or filter lines through a shell command. In the first synopsis, the remainder of the line after the ! character is passed to the program named by the shell option, as a single argument.

     Within the rest of the line, % and # are expanded into the current and alternate pathnames, respectively. The character ! is expanded with the command text of the previous ! command. (Therefore, the command !! repeats the previous ! command.) The special meanings of %, #, and ! can be overridden by escaping them with a backslash. If no ! or :! command has yet been executed, it is an error to use an unescaped ! character. The ! command does not do shell expansion on the strings provided as arguments. If any of the above expansions change the command the user entered, the command is redisplayed at the bottom of the screen.

     Ex then executes the program named by the shell option, with a -c flag followed by the arguments (which are bundled into a single argument).

     The ! command is permitted in an empty file.

     If the file has been modified since it was last completely written, the ! command will warn you.

     A single ! character is displayed when the command completes.

     In the second form of the ! command, the remainder of the line after the ! is passed to the program named by the shell option, as described above. The specified lines are passed to the program as standard input, and the standard and standard error output of the program replace the original lines.

     Line:
          Unchanged if no range was specified, otherwise set to the first line of the range.

     Options:
          Affected by the shell and warn options.

 -- Command: [range] # [count] [flags]

 -- Command: [range] nu[mber] [count] [flags]
     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 list option.

 -- Command: @ buffer

 -- Command: * buffer
     Execute a buffer. Each line in the named buffer is executed as an ex command. If no buffer is specified, or if the specified buffer is @ or *, the last buffer executed is used.

 -- Command: [range] <[< ...] [count] [flags]

     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 shiftwidth option. Only leading whitespace characters are deleted when shifting left; once the first column of the line contains a nonblank character, the shift 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, it is unchanged. Otherwise, it is set to the first nonblank character of the lowest numbered line shifted.

     Options:
          Affected by the shiftwidth option.

 -- Command: [line] = [flags]

     Display the line number of line(which defaults to the last line in the file).

     Line:
          Unchanged.

     Options:
          None.

 -- Command: [range] >[> ...] [count] [flags]

     Shift right. The specified lines are shifted to the right by the number of columns specified by the shiftwidth option, by inserting tab and space characters. Empty lines are not changed.

     If the command character > is repeated more than once, the command is repeated once for each additional command character.

     Line:
          Set to the last line modified by the command.

     Options:
          Affected by the shiftwidth option.

 -- Command: ab[brev] lhs rhs

     Add an abbreviation to the current abbreviation list. When inserting text in vi, 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. If a match is found, they are replaced with rhs. 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 triggered the check, and after the beginning of the insertion, or the beginning of the line or the file, or the last <blank>character that was entered, then the one or the both characters are checked for a match. Otherwise, the set includes both characters, as well as the characters that precede them that are the same word class (i.e. word or non-word) as the second to last character entered before the non-word character that triggered the check, back to the first <blank>character, the beginning of the insertion, or the beginning of the line or the file.

     For example, the abbreviations:

     :abbreviate   abc   ABC
     :abbreviate   #i   #include
     :abbreviate   /*#i   /*#include

     will all work, while the abbreviations:

     :abbreviate   a#i   A#include
     :abbreviate   /*   /********************

     will not work, and are not permitted by nvi.

     To keep the abbreviation expansion from happening, the character immediately following the lhscharacters should be quoted with a <literal-next>character.

     The replacement rhsis itself subject to both further abbreviation expansion and further map expansion.

     Line:
          Unchanged.

     Options:
          None.

 -- Command: [line] a[ppend][!]

     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, or to the first line of the file if a lineof 0 was specified. Following the command name with a ! character causes the autoindent option to be toggled for the duration of the command.

     Line:
          Unchanged.

     Options:
          Affected by the autoindent and number options.

 -- Command: ar[gs]

     Display the argument list. The current argument is displayed inside of [ and ] characters. The argument list is the list of operands specified on startup, which can be replaced using the next command.

     Line:
          Unchanged.

     Options:
          None.

 -- Command: bg

     Vi mode only. Background the current screen. The screen is unchanged, but is no longer accessible and disappears from the display. Use the fg command to bring the screen back to the display foreground.

     Line:
          Set to the current line when the screen was last edited.

     Options:
          None.

 -- Command: [range] c[hange][!] [count]

     Replace the lines with input text. Following the command name with a ! character causes the autoindent option to be toggled for the duration of the command.

     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 autoindent and number options.

 -- Command: chd[ir][!] [directory]

 -- Command: cd[!] [directory]
     Change the current working directory. The directoryargument is subjected to sh,1 word expansions. When invoked with no directory argument and the HOMEenvironment variable is set, the directory named by the HOMEenvironment variable becomes the new current directory. Otherwise, the new current directory becomes the directory returned by the getpwent,3 routine.

     The chdir command will fail if the file has been modified since the last complete write of the file. You can override this check by appending a ! character to the command.

     Line:
          Unchanged.

     Options:
          Affected by the cdpath option.

 -- Command: [range] co[py] line [flags]

 -- Command: [range] t line [flags]
     Copy the specified lines (range) after the destination line. Line 0 may be specified to insert the lines at the beginning of the file.

     Line:
          Unchanged.

     Options:
          None.

 -- Command: cs[cope] command [args]

     Execute a cscope command. For more information, see the section of the reference manual entitled Tags, Tag Stacks, and Cscope .

 -- Command: [range] d[elete] [buffer] [count] [flags]

     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 command name is followed by a letter that could be interpreted as either a buffer name or a flag value (because neither a countor flagsvalues were given), ex treats the letter as a flagsvalue if the letter immediately follows the command name, without any whitespace separation. If the letter is preceded by whitespace characters, it treats it as a buffer name.

     Line:
          Set to the line following the deleted lines, or to the last line if the deleted lines were at the end.

     Options:
          None.

 -- Command: di[splay] b[uffers] | c[onnections] | s[creens] | t[ags]

     Display buffers, cscope connections, screens or tags. The display 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 cscope databases.

     s[creens]
          Display the file names of all background screens.

     t[ags]
          Display the tags stack.

     Line:
          Unchanged.

     Options:
          None.

 -- Command: e[dit][!] [+cmd] [file]
 -- Command: ex[!] [+cmd] [file]
 -- Command: vs[plit][!] [+cmd] [file]
     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 ! character to the command name.

     If the +cmd option is specified, that ex command will be executed in the new file. Any ex command may be used, although the most common use of this feature is to specify a line number or search pattern to set the initial location in the new file.

     Capitalizing the first letter of the command, i.e., Edit or Ex, while in vi mode, will edit the file in a new screen. In this case, any modifications to the current file are ignored. vsplit is similar, but the screen will be split vertically to produce the new screen, rather than horizontally.

     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 previously edited the file, the current line will be set to the first line of the file if you are in vi mode, and the last line of the file if you are in ex.

     Options:
          None.

 -- Command: exu[sage] [command]

     Display usage for an ex command. If commandis specified, a usage statement for that command is displayed. Otherwise, usage statements for all ex commands are displayed.

     Line:
          Unchanged.

     Options:
          None.

 -- Command: f[ile] [file]

     Display and optionally change the file name. If a file name is specified, the current pathname is changed to the specified name. The current pathname, the number of lines, and the current position in the file are displayed.

     Line:
          Unchanged.

     Options:
          None.

 -- Command: fg [name]

     Vi 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 foregrounded.

     By default, foregrounding causes the current screen to be swapped with the backgrounded screen. Capitalizing the first letter of the command, i.e. Fg, 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.

 -- Command: [range] g[lobal] /pattern/ [commands]

 -- Command: [range] v /pattern/ [commands]
     Apply commands to lines matching (or not matching) a pattern. The lines within the given range that match g[lobal], or do not match v the given pattern are selected. Then, the specified ex command(s) are executed with the current line . set to each selected line. If no range is specified, the entire file is searched for matching, or not matching, lines.

     Multiple commands can be specified, one per line, by escaping each <newline>character with a backslash, or by separating commands with a | character. If no commands are specified, the command defaults to the print command.

     For the append, change and insert commands, the input text must be part of the global command line. In this case, the terminating period can be omitted if it ends the commands.

     The visual command may also be specified as one of the ex commands. In this mode, input is taken from the terminal. Entering a Q command in vi mode causes the next line matching the pattern to be selected and vi to be reentered, until the list is exhausted.

     The global, v and undo commands cannot be used as part of these commands.

     The editor options autoindent, autoprint and report are turned off for the duration of the global and v commands.

     Line:
          The last line modified.

     Options:
          Affected by the ignorecase and magic options. Turns off the autoindent, autoprint and report options.

 -- Command: he[lp]

     Display a help message.

     Line:
          Unchanged.

     Options:
          None.

 -- Command: [line] i[nsert][!]

     The input text is inserted before the specified line. Following the command name with a ! character causes the autoindent option setting to be toggled for the duration of this command.

     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 autoindent and number options.

 -- Command: [range] j[oin][!] [count] [flags]

     Join lines of text together.

     A countspecified to the join command specifies that the last line of the rangeplus countsubsequent lines will be joined. (Note, this differs by one from the general rule where only count- 1 subsequent lines are affected.)

     If the current line ends with a whitespace character, all whitespace is stripped from the next line. Otherwise, if the next line starts with a open parenthesis (, do nothing. Otherwise, if the current line ends with a question mark ?, period . or exclamation point !, insert two spaces. Otherwise, insert a single space.

     Appending a ! character to the command name causes a simpler join with no white-space processing.

     Line:
          Unchanged.

     Options:
          None.

 -- Command: [range] l[ist] [count] [flags]

     Display the lines unambiguously. Tabs are displayed as ^I, and the end of the line is marked with a $ character.

     Line:
          Set to the last line displayed.

     Options:
          Affected by the number option.

 -- Command: map[!] [lhs rhs]

     Define or display maps (for vi only).

     If lhs and rhs are not specified, the current set of command mode maps are displayed. If a ! character is appended to to the command, the text input mode maps are displayed.

     Otherwise, when the lhs character sequence is entered in vi, the action is as if the corresponding rhs had been entered. If a ! 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 to have two different macro definitions at the same time: one for command mode and one for input mode.

     Whitespace characters require escaping with a <literal-next>character to be entered in the lhsstring in visual mode.

     Normally, keys in the rhsstring are remapped (see the remap option), and it is possible to create infinite loops. However, keys which map to themselves are not further remapped, regardless of the setting of the remap option. For example, the command :map n nz. maps the n key to the n and z commands.

     To exit an infinitely looping map, use the terminal <interrupt>character.

     Line:
          Unchanged.

     Options:
          Affected by the remap option.

 -- Command: [line] ma[rk] <character>

 -- Command: [line] k <character>
     Mark the line with the mark <character>. The expressions '<character> and `<character> can then be used as an address in any command that uses one.

     Line:
          Unchanged.

     Options:
          None.

 -- Command: [range] m[ove] line

     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.

 -- Command: mk[exrc][!] file

     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 ex source command. If filealready exists, the mkexrc command will fail. This check can be overridden by appending a ! character to the command.

     Line:
          Unchanged.

     Options:
          None.

 -- Command: n[ext][!] [file ...]

     Edit the next file from the argument list. The next command will fail if the file has been modified since the last complete write. This check can be overridden by appending the ! character to the command name. The argument list can optionally be replaced by specifying a new one as arguments to this command. In this case, editing starts with the first file on the new list.

     Capitalizing the first letter of the command, i.e. Next, while in vi mode, will set the argument list and edit the file in a new screen. In this case, any modifications to the current file are ignored.

     Line:
          Set as described for the edit command.

     Options:
          Affected by the options autowrite and writeany.

 -- Command: [line] o[pen] /pattern/ [flags]

     Enter open mode. Open mode is the same as being in vi, but with a one-line window. All the standard vi commands are available. If a match is found for the optional RE argument, the cursor is set to the start of the matching pattern.

     This command is not yet implemented.

     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 open option.

 -- Command: pre[serve]

     Save the file in a form that can later be recovered using the ex -r option. When the file is preserved, an email message is sent to the user.

     Line:
          Unchanged.

     Options:
          None.

 -- Command: prev[ious][!]

     Edit the previous file from the argument list. The previous command will fail if the file has been modified since the last complete write. This check can be overridden by appending the ! character to the command name.

     Capitalizing the first letter of the command, i.e. Previous, while in vi mode, will edit the file in a new screen. In this case, any modifications to the current file are ignored.

     Line:
          Set as described for the edit command.

     Options:
          Affected by the options autowrite and writeany. None.

 -- Command: [range] p[rint] [count] [flags]

     Display the specified lines.

     Line:
          Set to the last line displayed.

     Options:
          Affected by the list and number option.

 -- Command: [line] pu[t] [buffer]

     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.

 -- Command: q[uit][!]

     End the editing session. If the file has been modified since the last complete write, the quit command will fail. This check may be overridden by appending a ! character to the command.

     If there are more files to edit, the quit command will fail. Appending a ! character to the command name or entering two quit commands (i.e. wq, quit, xit or ZZ) in a row) will override this check and the editor will exit.

     Line:
          Unchanged.

     Options:
          None.

 -- Command: [line] r[ead][!] [file]

     Read a file. A copy of the specified file is appended to the line. If lineis 0, the copy is inserted at the beginning of the file. If no file is specified, the current file is read; if there is no current file, then filebecomes the current file. If there is no current file and no fileis specified, then the read command will fail.

     If fileis preceded by a ! character, fileis treated as if it were a shell command, and passed to the program named by the shell edit option. The standard and standard error outputs of that command are read into the file after the specified line. The special meaning of the ! character can be overridden by escaping it with a backslash \e character.

     Line:
          When executed from ex, the current line is set to the last line read. When executed from vi, the current line is set to the first line read.

     Options:
          None.

 -- Command: rec[over] file

     Recover fileif it was previously saved. If no saved file by that name exists, the recover command behaves equivalently to the edit command.

     Line:
          Set as described for the edit command.

     Options:
          None.

 -- Command: res[ize] [+|-]size

     Vi mode only. Grow or shrink the current screen. If sizeis a positive, signed number, the current screen is grown by that many lines. If sizeis a negative, signed number, the current screen is shrunk by that many lines. If sizeis not signed, the current screen is set to the specified size. Applicable only to split screens.

     Line:
          Unchanged.

     Options:
          None.

 -- Command: rew[ind][!]

     Rewind the argument list. If the current file has been modified since the last complete write, the rewind command will fail. This check may be overridden by appending the ! character to the command.

     Otherwise, the current file is set to the first file in the argument list.

     Line:
          Set as described for the edit command.

     Options:
          Affected by the autowrite and writeany options.

 -- Command: se[t] [option[=[value]] ...] [nooption ...] [option? ...] [all]

     Display or set editor options. When no arguments are specified, the editor option term, and any editor options whose values have been changed from the default settings are displayed. If the argument allis specified, the values of all of editor options are displayed.

     Specifying an option name followed by the character ? causes the current value of that option to be displayed. The ? can be separated from the option name by whitespace characters. The ? is necessary only for Boolean valued options. Boolean options can be given values by the form set option to turn them on, or set nooption to turn them off. String and numeric options can be assigned by the form set option=value. Any whitespace characters in strings can be included literally by preceding each with a backslash. More than one option can be set or listed by a single set command, by specifying multiple arguments, each separated from the next by whitespace characters.

     Line:
          Unchanged.

     Options:
          None.

 -- Command: sh[ell]

     Run the shell program. The program named by the shell option is run with a -i (for interactive) flag. Editing is resumed when that program exits.

     Line:
          Unchanged.

     Options:
          Affected by the shell option.

 -- Command: so[urce] file

     Read and execute ex commands from a file. Source commands may be nested.

     Line:
          Unchanged.

     Options:
          None.

 -- Command: [range] s[ubstitute] [/pattern/replace/] [options] [count] [flags]

 -- Command: [range] & [options] [count] [flags]
 -- Command: [range] ~ [options] [count] [flags]
     Make substitutions. Replace the first instance of patternwith the string replaceon the specified line(s). If the /pattern/repl/ argument is not specified, the /pattern/repl/ from the previous substitute command is used. Any character other than an alphabetic, numeric, <blank> or backslash character may be used as the delimiter.

     If optionsincludes the letter c (confirm), you will be prompted for confirmation before each replacement is done. An affirmative response (in English, a y character) causes the replacement to be made. A quit response (in English, a q character) causes the substitute command to be terminated. Any other response causes the replacement not to be made, and the substitute command continues. If optionsincludes the letter g (global), all nonoverlapping instances of patternin the line are replaced.

     The & version of the command is the same as not specifying a pattern or replacement string to the substitute command, and the & is replaced by the pattern and replacement information from the previous substitute command.

     The ~ version of the command is the same as & and s, except that the search pattern used is the last RE used in any command, not necessarily the one used in the last substitute command.

     For example, in the sequence

          s/red/blue/
          /green
          ~

     the ~ is equivalent to s/green/blue/.

     The substitute command may be interrupted, using the terminal interrupt character. All substitutions completed before the interrupt are retained.

     Line:
          Set to the last line upon which a substitution was made.

     Options:
          Affected by the ignorecase and magic option.

 -- Command: su[spend][!]

 -- Command: st[op][!]
 -- Comamnd: <control-Z>
     Suspend the edit session. Appending a ! character to these commands turns off the autowrite option for the command.

     Line:
          Unchanged.

     Options:
          Affected by the autowrite and writeany options.

 -- Command: ta[g][!] tagstring

     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 tag command will fail. This check can be overridden by appending the ! character to the command name.

     The tag command searches for tagstringin the tags file(s) specified by the tags option. (See ctags,1 for more information on tags files.)

     Capitalizing the first letter of the command, i.e. Tag, while in vi mode, will edit the file in a new screen. In this case, any modifications to the current file are ignored.

     Line:
          Set to the line indicated by the tag.

     Options:
          Affected by the autowrite, taglength, tags and writeany options.

 -- Command: tagn[ext][!]

     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 tagnext command will fail. This check can be overridden by appending the ! character to the command name.

     Capitalizing the first letter of the command, i.e. Tagnext, while in vi mode, will edit the file in a new screen. In this case, any modifications to the current file are ignored.

     Line:
          Set to the line indicated by the tag.

     Options:
          Affected by the autowrite and writeany options.

 -- Command: tagp[op][!] [file | number]

     Pop to the specified tag in the tags stack. If neither fileor numberis specified, the tagpop command pops to the most recent entry on the tags stack. If fileor numberis specified, the tagpop command pops to the most recent entry in the tags stack for that file, or numbered entry in the tags stack, respectively. (See the display command for information on displaying the tags stack.)

     If the file has been modified since the last complete write, the tagpop command will fail. This check may be overridden by appending a ! character to the command name.

     Line:
          Set to the line indicated by the tag.

     Options:
          Affected by the autowrite and writeany options.

 -- Command: tagp[rev][!]

     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 tagprev command will fail. This check can be overridden by appending the ! character to the command name.

     Capitalizing the first letter of the command, i.e. Tagprev, while in vi mode, will edit the file in a new screen. In this case, any modifications to the current file are ignored.

     Line:
          Set to the line indicated by the tag.

     Options:
          Affected by the autowrite and writeany options.

 -- Command: tagt[op][!]

     Pop to the least recent tag on the tags stack, clearing the tags stack.

     If the file has been modified since the last complete write, the tagtop command will fail. This check may be overridden by appending a ! character to the command name.

     Line:
          Set to the line indicated by the tag.

     Options:
          Affected by the autowrite and writeany options.

 -- Command: una[bbrev] lhs

     Delete an abbreviation. Delete lhsfrom the current list of abbreviations.

     Line:
          Unchanged.

     Options:
          None.

 -- Command: u[ndo]

     Undo the last change made to the file. Changes made by global, v, visual and map sequences are considered a single command. If repeated, the u command alternates between these two states, and is its own inverse.

     Line:
          Set to the last line modified by the command.

     Options:
          None.

 -- Command: unm[ap][!] lhs

     Unmap a mapped string. Delete the command mode map definition for lhs. If a ! character is appended to the command name, delete the text input mode map definition instead.

     Line:
          Unchanged.

     Options:
          None.

 -- Command: ve[rsion]

     Display the version of the ex/vi editor.

 -- Command: [line] vi[sual] [type] [count] [flags]

     Ex mode only. Enter vi. The typeis optional, and can be -, + or ^, as in the ex z command, 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 countspecifies the number of lines that will initially be displayed. (The default is the value of the window editor option.)

     Line:
          Unchanged unless lineis specified, in which case it is set to that line.

     Options:
          None.

 -- Command: vi[sual][!] [+cmd] [file]

     Vi mode only. Edit a new file. Identical to the edit[!] [+cmd] [file] command.

     Capitalizing the first letter of the command, i.e. Visual, will edit the file in a new screen. In this case, any modifications to the current file are ignored.

 -- Command: viu[sage] [command]

     Display usage for a vi command. If commandis specified, a usage statement for that command is displayed. Otherwise, usage statements for all vi commands are displayed.

     Line:
          Unchanged.

     Options:
          None.

 -- Command: [range] w[rite][!] [>>] [file]

 -- Command: [range] w[rite] [!] [file]
 -- Command: [range] wn[!] [>>] [file]
 -- Command: [range] wq[!] [>>] [file]
     Write the file. The specified lines (the entire file, if no range is given) is written to file. If fileis not specified, the current pathname is used. If fileis specified, and it exists, or if the current pathname was set using the file command, and the file already exists, these commands will fail. Appending a ! character to the command name will override this check and the write will be attempted, regardless.

     Specifying the optional >> string will cause the write to be appended to the file, in which case no tests are made for the file already existing.

     If the file is preceded by a ! character, the program named by the shell edit option is invoked with file as its second argument, and the specified lines are passed as standard input to that command. The ! in this usage must be separated from command name by at least one whitespace character. The special meaning of the ! may be overridden by escaping it with a backslash \e character.

     The wq version of the write command will exit the editor after writing the file, if there are no further files to edit. Appending a ! character to the command name or entering two quit commands (i.e. wq, quit, xit or ZZ) in a row) will override this check and the editor will exit, ignoring any files that have not yet been edited.

     The wn version of the write command will move to the next file after writing the file, unless the write fails.

     Line:
          Unchanged.

     Options:
          Affected by the readonly and writeany options.

 -- Command: [range] x[it][!] [file]

     Write the file if it has been modified. The specified lines are written to file, if the file has been modified since the last complete write to any file. If no rangeis specified, the entire file is written.

     The xit command will exit the editor after writing the file, if there are no further files to edit. Appending a ! character to the command name or entering two quit commands (i.e. wq, quit, xit or ZZ) in a row) will override this check and the editor will exit, ignoring any files that have not yet been edited.

     Line:
          Unchanged.

     Options:
          Affected by the readonly and writeany options.

 -- Command: [range] ya[nk] [buffer] [count]

     Copy the specified lines to a buffer. If no buffer is specified, the unnamed buffer is used.

     Line:
          Unchanged.

     Options:
          None.

 -- Command: [line] z [type] [count] [flags]

     Adjust the window. If no typeis specified, then countlines following the specified line are displayed. The default countis the value of the window option. The typeargument changes the position at which lineis displayed on the screen by changing the number of lines displayed before and after line. The following typecharacters may be used:

     -
          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 * 2lines before line; the net effect of this is that a z^ command following a z command writes the previous page.

     =
          Center lineon 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 scroll option.