vi man page on Xenix

Man page or keyword search:  
man Server   1130 pages
apropos Keyword Search (all sections)
Output format
Xenix logo
[printable version]



     VI(C)		      XENIX System V			 VI(C)

     Name
	  vi, view, vedit - Invokes a screen-oriented display editor.

     Syntax
	  vi [ -option ... ] [ command ... ] [ filename ... ]

	  view [ -option ... ] [ command ... ] [ filename ... ]

	  vedit [ -option ... ] [ command ... ] [ filename ... ]

     Description
	  vi offers a powerful set of text editing operations based on
	  a set of mnemonic commands.  Most commands are single
	  keystrokes that perform simple editing functions.  vi
	  displays a full screen ``window'' into the file you are
	  editing.  The contents of this window can be changed quickly
	  and easily within vi.	 While editing, visual feedback is
	  provided (the name vi itself is short for ``visual'' ).

	  The view command is the same as vi except that the read-only
	  option (-R) is set automatically.  The file cannot be
	  changed with view.

	  The vedit command is the same as vi except for differences
	  in the option settings.  vedit uses novice mode, turns off
	  the magic option, sets the option report=1 and turns on the
	  options showmode and redraw.

	  The showmode option informs the vedit user, in a message in
	  the lower right hand corner of the screen, which mode is
	  being used. For instance after the ESC-i command is used,
	  the message reads ``INSERT MODE''.

	  Note that you can not set the novice option from within vi
	  or ex.  If you want to use the novice option you must use
	  the vedit utility.  (It is possible to set the nonovice
	  option from within vedit.)

	  vi and the line editor ex are one and the same editor:  the
	  names vi and ex identify a particular user interface rather
	  than any underlying functional difference.  The differences
	  in user interface, however, are quite striking. ex is a
	  powerful line-oriented editor, similar to the editor ed.
	  However, in both ex and ed, visual updating of the terminal
	  screen is limited, and commands are entered on a command
	  line.	 vi, on the other hand, is a screen-oriented editor
	  designed so that what you see on the screen corresponds
	  exactly and immediately to the contents of the file you are
	  editing.  In the following discussion, vi commands and
	  options are printed in boldface type.

	  Options available on the vi command line include:

     Page 1					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

	  -x   Encryption option; when used, the file will be
	       encrypted as it is being written and will require an
	       encryption key to be read.  vi makes an educated guess
	       to determine if a file is encrypted or not.  See
	       crypt(C).  Also, see the Notes section at the end of
	       this manual page.

	  -C   Encryption option; the same as -x except that vi
	       assumes files are encrypted.

	  -c command
		    Begin editing by executing the specified editor
		    command (usually a search or positioning command).

	  -t tag    Equivalent to an initial tag command; edits the
		    file containing tag and positions the editor at
		    its definition.

	  -r file   Used in recovering after an editor or system
		    crash, retrieves the last saved version of the
		    named file.

	  -l	    Specific to editing LISP, this option sets the
		    showmatch and lisp options.

	  -L	    List the names of all files saved as a result of
		    an editor or system crash.	Files may be recovered
		    with the -r option.

	  -wn	    Sets the default window size to n.	Useful on
		    dialups to start in small windows.

	  -R	    Sets a read-only option so that files can be
		    viewed but not edited.

	The Editing Buffer
	  vi performs no editing operations on the file that you name
	  during invocation.  Instead, it works on a copy of the file
	  in an ``editing buffer.''

	  When you invoke vi with a single filename argument, the
	  named file is copied to a temporary editing buffer.  The
	  editor remembers the name of the file specified at
	  invocation, so that it can later copy the editing buffer
	  back to the named file.  The contents of the named file are
	  not affected until the changes are copied back to the
	  original file.

	Modes of Operation
	  Within vi there are three distinct modes of operation:

	  Command Mode		  Within command mode, signals from

     Page 2					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

				  the keyboard are interpreted as
				  editing commands.

	  Insert Mode		  Insert mode can be entered by typing
				  any of the vi insert, append, open,
				  substitute, change, or replace
				  commands.  Once in insert mode,
				  letters typed at the keyboard are
				  inserted into the editing buffer.

	  ex Escape Mode	  The vi and ex editors are one and
				  the same editor differing mainly in
				  their user interface.	 In vi ,
				  commands are usually single
				  keystrokes.  In ex, commands are
				  lines of text terminated by a
				  RETURN.  vi has a special ``escape''
				  command that gives access to many of
				  these line-oriented ex commands.  To
				  use the ex escape mode, type a colon
				  (:).	The colon is echoed on the
				  status line as a prompt for the ex
				  command.  An executing command can
				  be aborted by pressing INTERRUPT.
				  Most file manipulation commands are
				  executed in ex escape mode (for
				  example, the commands to read in a
				  file and to write out the editing
				  buffer to a file).

	Special Keys
	  There are several special keys in vi.	 The following keys
	  are used to edit, delimit, or abort commands and command
	  lines.

	  ESC	      Used to return to vi command mode or to cancel
		      partially formed commands.

	  RETURN      Terminates ex commands when in ex escape mode.
		      Also used to start a newline when in insert
		      mode.

	  INTERRUPT   Often the same as the DEL or RUBOUT key on many
		      terminals. Generates an interrupt, telling the
		      editor to stop what it is doing.	Used to abort
		      any command that is executing.

	  /	      Used to specify a string to be searched for. The
		      slash appears on the status line as a prompt for
		      a search string.	The question mark (?) works
		      exactly like the slash key, except that it is
		      used to search backward in a file instead of

     Page 3					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

		      forward.

	  :	      The colon is a prompt for an ex command.	You
		      can then type in any ex command, followed by an
		      ESC or RETURN, and the given ex command is
		      executed.

	  The following characters are special in insert mode:

	  BKSP	    Backs up the cursor one character on the current
		    line.  The last character typed before the BKSP is
		    removed from the input buffer, but remains
		    displayed on the screen.

	  Ctrl-U    Moves the cursor back to the first character of
		    the insertion and restarts insertion.

	  Ctrl-V    Removes the special significance of the next typed
		    character.	Use Ctrl-V to insert control
		    characters.	 Linefeed and  Ctrl-J cannot be
		    inserted in the text except as newline characters.
		    Ctrl-Q and Ctrl-S are trapped by the operating
		    system before they are interpreted by vi, so they
		    too cannot be inserted as text.

	  Ctrl-W    Moves the cursor back to the first character of
		    the last inserted word.

	  Ctrl-T    During an insertion, with the autoindent option
		    set and at the beginning of the current line,
		    entering this character will insert shiftwidth
		    whitespace.

	  Ctrl-@    If entered as the first character of an insertion,
		    it is replaced with the last text inserted, and
		    the insertion terminates.  Only 128 characters are
		    saved from the last insertion.  If more than 128
		    characters were inserted, then this command
		    inserts no characters.  A Ctrl-@ cannot be part of
		    a file, even if quoted.

	Starting and Exiting vi
	  To enter vi, enter:

	  vi		      Edits empty editing buffer

	  vi file	      Edits named file

	  vi +123 file	      Goes to line 123

	  vi +45 file	      Goes to line 45

     Page 4					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

	  vi +/word file      Finds first occurrence of ``word''

	  vi +/tty file	      Finds first occurrence of ``tty''

	  There are several ways to exit the editor:

	  ZZ   The editing buffer is written to the file only if any
	       changes were made.

	  :x   The editing buffer is written to the file only if any
	       changes were made.

	  :q!  Cancels an editing session.  The exclamation mark (!)
	       tells vi to quit unconditionally.  In this case, the
	       editing buffer is not written out.

     vi Commands
	  vi is a visual editor with a window on the file. What you
	  see on the screen is vi's notion of what the file contains.
	  Commands do not cause any change to the screen until the
	  complete command is entered. Most commands may take a
	  preceding count that specifies repetition of the command.
	  This count parameter is not given in the following command
	  descriptions, but is implied unless overridden by some other
	  prefix argument.  When vi gets an improperly formatted
	  command, it rings a bell.

	Cursor Movement
	  The cursor movement keys allow you to move your cursor
	  around in a file.  Note in particular the direction keys (if
	  available on your terminal), the h, j, k, and l cursor keys,
	  and SPACEBAR, BKSP, Ctrl-N, and Ctrl-P.  These three sets of
	  keys perform identical functions.

	  Forward Space - l, SPACEBAR, or right direction key

	  Syntax:   l
		    SPACEBAR
		    right direction key

	  Function: Moves the cursor forward one character. If a count
		    is given, move forward count characters.  You
		    cannot move past the end of the line.

	  Backspace - h, BKSP, or left direction key

	  Syntax:   h
		    BKSP
		    left direction key

	  Function: Moves cursor backward one character.  If a count
		    is given, moves backward count characters.	Note

     Page 5					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

		    that you cannot move past the beginning of the
		    current line.

	  Next Line - +, RETURN, j, . Ctrl-N, LF and Down Arrow Key"

	  Syntax:   +
		    RETURN

	  Function: Moves the cursor down to the beginning of the next
		    line.

	  Syntax:   j
		    Ctrl-N
		    LF
		    down direction key

	  Function: Moves the cursor down one line, remaining in the
		    same column.  Note the difference between these
		    commands and the preceding set of next line
		    commands which move to the beginning of the next
		    line.

	  Previous Line - k, Ctrl-P, and up direction key

	  Syntax:   k
		    Ctrl-P
		    up direction key

	  Function: Moves the cursor up one line, remaining in the
		    same column.  If a count is given, the cursor is
		    moved count lines.

	  Syntax:   -

	  Function: Moves the cursor up to the beginning of the
		    previous line.  If a count is given, the cursor is
		    moved up count lines.

	  Beginning of Line - 0 and ^

	  Syntax:   ^
		    0

	  Function: Moves the cursor to the beginning of the current
		    line.  Note that 0 always moves the cursor to the
		    first character of the current line. The caret (^)
		    works somewhat differently: it moves to the first
		    character on a line that is not a tab or a space.
		    This is useful when editing files that have a
		    great deal of indentation, such as program texts.

     Page 6					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

	  End of Line - $

	  Syntax:   $

	  Function: Moves the cursor to the end of the current line.
		    Note that the cursor resides on top of the last
		    character on the line.  If a count is given, the
		    cursor is moved forward count-1 lines to the end
		    of the line.

	  Goto Line - G

	  Syntax:   [linenumber]G

	  Function: Moves the cursor to the beginning of the line
		    specified by linenumber.  If no linenumber is
		    given, the cursor moves to the beginning of the
		    last line in the file.  To find the line number of
		    the current line, use Ctrl-G.

	  Column - |

	  Syntax:   [column]|

	  Function: Moves the cursor to the column in the current line
		    given by column.  If no column is given, the
		    cursor is moved to the first column in the current
		    line.

	  Word Forward - w and W

	  Syntax:   w
		    W

	  Function: Moves the cursor forward to the beginning of the
		    next word.	The lowercase w command searches for a
		    word defined as a string of alphanumeric
		    characters separated by punctuation or whitespace
		    (i.e., tab, newline, or space characters).	The
		    uppercase W command searches for a word defined as
		    a string of nonwhitespace characters.

	  Back Word - b and B

	  Syntax:   b
		    B

	  Function: Moves the cursor backward to the beginning of a
		    word.  The lowercase b command searches backward
		    for a word defined as a string of alphanumeric
		    characters separated by punctuation or whitespace
		    (i.e., tab, newline, or space characters).	The

     Page 7					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

		    uppercase B command searches for a word defined as
		    a string of non-whitespace characters.  If the
		    cursor is already within a word, it moves backward
		    to the beginning of that word.

	  End - e and E

	  Syntax:   e
		    E

	  Function: Moves the cursor to the end of a word.  The
		    lowercase e command moves the cursor to the last
		    character of a word, where a word is defined as a
		    string of alphanumeric characters separated by
		    punctuation or whitespace (i.e., tab, newline, or
		    space characters).	The uppercase E moves the
		    cursor to the last character of a word where a
		    word is defined as a string of nonwhitespace
		    characters.	 If the cursor is already within a
		    word, it moves to the end of that word.

	  Sentence - ( and )

	  Syntax:   (
		    )

	  Function: Moves the cursor to the beginning (left
		    parenthesis) or end of a sentence (right
		    parenthesis).  A sentence is defined as a sequence
		    of characters ending with a period (.), question
		    mark (?), or exclamation mark (!), followed by
		    either two spaces or a newline.  A sentence begins
		    on the first nonwhitespace character following a
		    preceding sentence.	 Sentences are also delimited
		    by paragraph and section delimiters. See below.

	  Paragraph - { and }

	  Syntax:   }
		    {

	  Function: Moves the cursor to the beginning ({) or end (})
		    of a paragraph.  A paragraph is  defined with the
		    paragraphs option.	By default, paragraphs are
		    delimited by the nroff macros ``.IP'', ``.LP'',
		    ``.P'', ``.QP'', and ``.bp''.  Paragraphs also
		    begin after empty lines.

	  Section - [[ and ]]

	  Syntax:   ]]
		    [[

     Page 8					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

	  Function: Moves the cursor to the beginning ([[) or end (]])
		    of a section.  A section is	 defined with the
		    sections option.  By default, sections are
		    delimited by the nroff macros ``.NH'' and ``.SH''.
		    Sections also start at formfeeds (Ctrl-L) and at
		    lines beginning with a brace ({).

	  Match Delimiter - %

	  Syntax:   %

	  Function: Moves the  cursor to a matching delimiter, where a
		    delimiter is a parenthesis, a bracket, or a brace.
		    This is useful when matching pairs of nested
		    parentheses, brackets, and braces.

	  Home - H

	  Syntax:   [offset]H

	  Function: Moves the  cursor to the upper left corner of the
		    screen.  Use this command to quickly move to the
		    top of the screen.	If an offset is given, the
		    cursor is homed offset-1 number of lines from the
		    top of the screen.	Note that the command ``dH''
		    deletes all lines from the current line to the top
		    line shown on the screen.

	  Middle Screen - M

	  Syntax:   M

	  Function: Moves the cursor to the beginning of the screen's
		    middle line. Use this command to quickly move to
		    the middle of the screen from either the top or
		    the bottom.	 Note that the command ``dM'' deletes
		    from the current line to the line specified by the
		    M command.

	  Lower Screen - L

	  Syntax:   [offset]L

	  Function: Moves the  cursor to the lowest line on the
		    screen.  Use this command to quickly move to the
		    bottom of the screen.  If an offset is given, the
		    cursor is homed offset-1 number of lines from the
		    bottom of the screen.  Note that the command
		    ``dL'' deletes all lines from the current line to
		    the bottom line shown on the screen.

	  Previous Context - `` and ''

     Page 9					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

	  Syntax:   ''
		    'character
		    ``
		    `character

	  Function: Moves the cursor to previous context or to context
		    marked with the m command.	If the single
		    quotation mark or back quotation mark is doubled,
		    the cursor is moved to previous context.  If a
		    single character is given after either quotation
		    mark, the cursor is moved to the location of the
		    specified mark as defined by the m command.
		    Previous context is the location in the file of
		    the last ``nonrelative'' cursor movement.  The
		    single quotation mark (') syntax is used to move
		    to the beginning of the line representing the
		    previous context. The back quotation mark (`)
		    syntax is used to move to the previous context
		    within a line.

	The Screen Commands
	  The screen commands are not cursor movement commands and
	  cannot be used in delete commands as the delimiters of text
	  objects.  However, the screen commands do move the cursor
	  and are useful in paging or scrolling through a file.	 These
	  commands are described below:

	  Scroll- Ctrl-U and Ctrl-D

	  Syntax:   [size]Ctrl-U
		    [size]Ctrl-D

	  Function: Scrolls the screen up a half window (Ctrl-U) or
		    down a half window (Ctrl-D).  If size is given,
		    the scroll is size number of lines.	 This value is
		    remembered for all later scrolling commands.

	  Page - Ctrl-F and Ctrl-B

	  Syntax:   Ctrl-F
		    Ctrl-B

	  Function: Pages screen forward and backward.	Two lines of
		    continuity are kept between pages if possible.  A
		    preceding count gives the number of pages to move
		    forward or backward.

	  Status - Ctrl-G

	  Syntax:   BELL
		    Ctrl-G

     Page 10					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

	  Function: Displays vi status on status line.	This gives you
		    the name of the file you are editing, whether it
		    has been modified, the current line number, the
		    number of lines in the file, and the percentage of
		    the file (in lines) that precedes the cursor.

	  Zero Screen - z

	  Syntax:   [linenumber]z[size]RETURN
		    [linenumber]z[size].
		    [linenumber]z[size]-

	  Function: Redraws the display with the current line placed
		    at or ``zeroed'' at the top, middle, or bottom of
		    the screen, respectively.  If you give a size, the
		    number of lines displayed is equal to size.	 If a
		    preceding linenumber is given, the given line is
		    placed at the top of the screen.  If the last
		    argument is a RETURN, the current line is placed
		    at the top of the screen.  If the last argument is
		    a period (.), the current line is placed in the
		    middle of the screen.  If the last argument is a
		    minus sign (-), the current line is placed at the
		    bottom of the screen.

	  Redraw - Ctrl-R or Ctrl-L

	  Syntax:   Ctrl-R
		    Ctrl-L
		    (Command depends on terminal type.)

	  Function: Redraws the screen.	 Use this command to erase any
		    system messages or line noise that may scramble
		    your screen. Note that system messages do not
		    affect the file you are editing.

	Text Insertion
	  The text insertion commands always place you in insert mode.
	  Exit from insert mode is always done by pressing ESC.	 The
	  following insertion commands are ``pure'' insertion
	  commands; no text is deleted when you use them.  This
	  differs from the text modification commands, change,
	  replace, and substitute, which delete and then insert text
	  in one operation.

	  Insert - i and I

	  Syntax:   i[text]ESC
		    I[text]ESC

	  Function: Insert text in editing buffer.  The lowercase i
		    command places you in insert mode.	Text is

     Page 11					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

		    inserted before the character beneath the cursor.
		    To insert a newline, press a RETURN.  Exit insert
		    mode by typing the ESC key.	 The uppercase I
		    command places you in insert mode, but begins text
		    insertion at the beginning of the current line (at
		    the first non-blank character), rather than before
		    the cursor.

	  Append - a and A

	  Syntax:   a[text]ESC
		    A[text]ESC

	  Function: Appends text to the editing buffer.	 The lowercase
		    a command works exactly like the lowercase i
		    command, except that text insertion begins after
		    the cursor and not before.	This is the one way to
		    add text to the end of a line.  The uppercase A
		    command begins appending text at the end of the
		    current line rather than after the cursor.

	  Open New Line - o and O

	  Syntax:   o[text]ESC
		    O[text]ESC

	  Function: Opens a new line and inserts text.	The lowercase
		    o command opens a new line below the current line;
		    uppercase O opens a new line above the current
		    line.  After the new line has been opened, both
		    these commands work like the I command.

	Text Deletion
	  Many of the text deletion commands use the SM d key as an
	  operator.  This operator deletes text objects delimited by
	  the cursor and a cursor movement command.  Deleted text is
	  always saved away in a buffer.  The delete commands are
	  described below:

	  Delete Character - x and X

	  Syntax:   x
		    X

	  Function: Deletes a character.  The lowercase x command
		    deletes the character beneath the cursor.  With a
		    preceding count, count characters are deleted to
		    the right beginning with the character beneath the
		    cursor.  This is a quick and easy way to delete a
		    few characters.  The uppercase X command deletes
		    the character just before the cursor.  With a

     Page 12					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

		    preceding count, count characters are deleted
		    backward, beginning with the character just before
		    the cursor.

	  Delete - d and D

	  Syntax:   dcursor-movement
		    dd
		    D

	  Function: Deletes a text object.  The lowercase d command
		    takes a cursor-movement as an argument.  If the
		    cursor-movement is an intraline command, deletion
		    takes place from the cursor to the end of the text
		    object delimited by the cursor-movement.  Deletion
		    forward deletes the character beneath the cursor;
		    deletion backward does not.	 If the cursor-
		    movement is a multi-line command, deletion takes
		    place from and including the current line to the
		    text object delimited by the cursor-movement.

	  The dd command deletes whole lines.  The uppercase D command
	  deletes from and including the cursor to the end of the
	  current line.

	  Deleted text is automatically pushed on a stack of buffers
	  numbered 1 through 9.	 The most recently deleted text is
	  also placed in a special delete buffer that is logically
	  buffer 0.  This special buffer is the default buffer for all
	  (put) commands using the double quotation mark (") to
	  specify the number of the buffer for delete, put, and yank
	  commands.  The buffers 1 through 9 can be accessed with the
	  p and P (put) commands by appending the double quotation
	  mark (") to the number of the buffer.	 For example:

	       "4p

	  puts the contents of delete buffer number 4 in your editing
	  buffer just below the current line.  Note that the last
	  deleted text is ``put'' by default and does not need a
	  preceding buffer number.

	Text Modification
	  The text modification commands all involve the replacement
	  of text with other text.  This means that some text will
	  necessarily be deleted.  All text modification commands can
	  be ``undone'' with the u command:

	  Undo - u and U

	  Syntax:   u
		    U

     Page 13					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

	  Function: Undoes the last insert or delete command.  The
		    lowercase u command undoes the last insert or
		    delete command.  This means that after an insert,
		    u deletes text; and after a delete, u inserts
		    text.  For the purposes of undo, all text
		    modification commands are considered insertions.

		    The uppercase U command restores the current line
		    to its state before it was edited, no matter how
		    many times the current line has been edited since
		    you moved to it.

	  Repeat - .

	  Syntax:   .

	  Function: Repeats the last insert or delete command.	A
		    special case exists for repeating the p and P
		    ``put'' commands.  When these commands are
		    preceded by the name of a delete buffer,
		    successive u commands display the contents of the
		    delete buffers.

	  Change - c and C

	  Syntax:   ccursor-movement textESC
		    CtextESC
		    cctextESC

	  Function: Changes a text object and replaces it with text .
		    Text is inserted as with the i command.  A dollar
		    sign ($) marks the extent of the change.  The c
		    command changes arbitrary text objects delimited
		    by the cursor and a cursor-movement . cc affects
		    whole lines while C affects from the cursor to the
		    end of the line.

	  Replace - r and R

	  Syntax:   rchar
		    RtextESC

	  Function: Overstrikes character or line with char or text ,
		    respectively.  Use r to overstrike a single
		    character and R to overstrike a whole line.	 A
		    count multiplies the replacement text count times.

	  Substitute - s and S

	  Syntax:   stextESC
		    StextESC

     Page 14					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

	  Function: Substitutes current character or current line with
		    text. Use s to replace a single character with new
		    text.  Use S to replace the current line with new
		    text.  If a preceding count is given, text
		    substitutes for count number of characters or
		    lines depending on whether the command is s or S,
		    respectively.

	  Filter - !

	  Syntax:   !cursor-movement cmd RETURN

	  Function: Filters the text object delimited by the cursor
		    and cursor-movement through the  command, cmd.
		    For example, the following command sorts all lines
		    between the cursor and the bottom of the screen,
		    substituting the designated lines with the sorted
		    lines:

			 !Lsort

		    Arguments and shell metacharacters may be included
		    as part of cmd; however, standard input and output
		    are always associated with the text object being
		    filtered.  !! affects the current line.

	  Join Lines - J

	  Syntax:   J

	  Function: Joins the current line with the following line.
		    If a count is given, count lines are joined.

	  Shift - < and >

	  Syntax:   >[cursor-movement]
		    <[cursor-movement]
		    >>
		    <<

	  Function: Shifts text right (>) or left (<).	Text is
		    shifted by the value of the option shiftwidth,
		    which is normally set to eight spaces.  Both the >
		    and < commands shift all lines in the text object
		    delimited by the current line and cursor-movement.
		    The >> and << commands affect whole lines.	All
		    versions of the command can take a preceding count
		    that acts to multiply the number of objects
		    affected.

	Text Movement
	  The text movement commands move text in and out of the named

     Page 15					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

	  buffers a-z and out of the delete buffers 1-9.  These
	  commands either ``yank'' text out of the editing buffer and
	  into a named buffer or ``put'' text into the editing buffer
	  from a named buffer or a delete buffer.  By default, text is
	  put and yanked from the ``unnamed buffer'', which is also
	  where the most recently deleted text is placed.  Thus it is
	  quite reasonable to delete text, move your cursor to the
	  location where you want the deleted text placed, and then
	  put the text back into the editing buffer at this new
	  location with the p or P command.

	  The named buffers are most useful for keeping track of
	  several chunks of text that you want to keep on hand for
	  later access, movement, or rearrangement.  These buffers are
	  named with the letters a through z.  To refer to one of
	  these buffers (or one of the numbered delete buffers) in a
	  command, use a quotation mark.  For example, to yank a line
	  into the buffer named a, enter:

	       "ayy

	  To put this text back into the file, enter:

	       "ap

	  If you delete text in the buffer named A rather than a, text
	  is appended to the buffer named a (A and a refer to the same
	  buffer but are handled differently).

	  Note that the contents of the named buffers are not
	  destroyed when you switch files.  Therefore, you can delete
	  or yank text into a buffer, switch files, and then do a put.
	  Buffer contents are destroyed when you exit the editor, so
	  be careful.

	  Put - p and P

	  Syntax:   ["alphanumeric]p
		    ["alphanumeric]P

	  Function: Puts text from a buffer into the editing buffer.
		    If no buffer name is specified, text is put from
		    the unnamed buffer.	 The lowercase p command puts
		    text either below the current line or after the
		    cursor, depending on whether the buffer contains a
		    partial line or not.  The uppercase P command puts
		    text either above the current line or before the
		    cursor, again depending on whether the buffer
		    contains a partial line or not.

	  Yank - y and Y

     Page 16					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

	  Syntax:   ["letter]ycursor-movement
		    ["letter]yy
		    ["letter]Y

	  Function: Copies text in the editing buffer to a named
		    buffer.  If no buffer name is specified, text is
		    yanked into the unnamed buffer.  If an uppercase
		    letter is used, text is appended to the buffer and
		    does not overwrite and destroy the previous
		    contents.  When a cursor-movement is given as an
		    argument, the delimited text object is yanked.
		    The Y and yy commands yank a single line, or, if a
		    preceding count is given, multiple lines can be
		    yanked.

	Searching
	  The search commands search either forward or backward in the
	  editing buffer for text that matches a given regular
	  expression.

	  Search - / and ?

	  Syntax:   /[pattern]/[offset]RETURN
		    /[pattern]RETURN
		    ?[pattern]?[offset]RETURN
		    ?[pattern]RETURN

	  Function: Searches forward (/) or backward (?) for pattern.
		    A string is actually a regular expression.	The
		    trailing delimiter is not required.	 If no pattern
		    is given, then the last pattern searched for is
		    used.  After the second delimiter, an offset may
		    be given, specifying the beginning of a line
		    relative to the line on which pattern was found.
		    For example:

			 /word/-

		    finds the beginning of the line immediately
		    preceding the line containing ``word'' and the
		    following command:

			 /word/+2

		    finds the beginning of the line two lines after
		    the line containing ``word''.  See also the
		    ignorecase and magic options.

	  Next String - n and N

	  Syntax:   n
		    N

     Page 17					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

	  Function: Repeats the last search command.  The n command
		    repeats the search in the same direction as the
		    last search command.  The N command repeats the
		    search in the opposite direction of the last
		    search command.

	  Find Character - f and F

	  Syntax:   fchar
		    Fchar
		    ;
		    ,

	  Function: Finds character char on the current line.  The
		    lowercase f searches forward on the line; the
		    uppercase F searches backward.  The semicolon (;)
		    repeats the last character search.	The comma (,)
		    reverses the direction of the search.

	  To Character - t and T

	  Syntax:   tchar
		    Tchar
		    ;
		    ,

	  Function: Moves the cursor up to but not on char.  The
		    semicolon (;) repeats the last character search.
		    The comma (,) reverses the direction of the
		    search.

	  Mark - m

	  Syntax:   mletter

	  Function: Marks a place in the file with a lowercase letter.
		    You can move to a mark using the ``to mark''
		    commands described below.  It is often useful to
		    create a mark, move the cursor, and then delete
		    from the cursor to the mark ``a'' with the
		    following command:

			 d'a

	  To Mark - ' and `

	  Syntax:   'letter
		    `letter

	  Function: Move to letter.  These commands let you move to
		    the location of a mark.  Marks are denoted by
		    single lowercase alphabetic characters.  Before

     Page 18					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

		    you can move to a mark, it must first be created
		    with the m command.	 The back quotation mark (`)
		    moves you to the exact location of the mark within
		    a line; the forward quotation mark (') moves you
		    to the beginning of the line containing the mark.
		    Note that these commands are also legal cursor
		    movement commands.

	Exit and Escape Commands
	  There are several commands that are used to escape from vi
	  command mode and to exit the editor.	These are described in
	  the following section.

	  ex Escape - :

	  Syntax:   :

	  Function: Enters ex escape mode to execute an ex command.
		    The colon appears on the status line as a prompt
		    for an ex command.	You then can enter an ex
		    command line terminated by either a RETURN or an
		    ESC and the ex command will execute.  You are then
		    prompted to type RETURN to return to vi command
		    mode.  During the input of the ex command line or
		    during execution of the ex command, you may press
		    INTERRUPT to stop what you are doing and return to
		    vi command mode.

	  Exit Editor - ZZ

	  Syntax:   ZZ

	  Function: Exit vi and write out the file if any changes have
		    been made.	This returns you to the shell from
		    which you started vi.

	  Quit to ex - Q

	  Syntax:   Q

	  Function: Enters the ex editor.  When you do this, you will
		    still be editing the same file.  You can return to
		    vi by entering the vi command from ex.

     ex Commands
	  Entering the colon (:) escape command when in command mode
	  produces a colon prompt on the status line. This prompt is
	  for a command available in the line-oriented editor, ex.  In
	  general, ex commands let you write out or read in files,
	  escape to the shell, or switch editing files.

	  Many of these commands perform actions that affect the

     Page 19					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

	  ``current'' file by default.	The current file is normally
	  the file that you named when you started vi, although the
	  current file can be changed with the ``file'' command, f, or
	  with the ``next'' command, n.	 In most respects, these
	  commands are identical to similar commands for the editor,
	  ed.  All such ex commands are aborted by either RETURN or
	  ESC.	We shall use RETURN in our examples.  Command entry is
	  terminated by typing INTERRUPT.

	Command Structure
	  Most ex command names are English words, and initial
	  prefixes of the words are acceptable abbreviations.  In
	  descriptions, only the abbreviation is discussed, since this
	  is the most frequently used form of the command.  The
	  ambiguity of abbreviations is resolved in favor of the more
	  commonly used commands.  As an example, the command
	  substitute can be abbreviated s , while the shortest
	  available abbreviation for the set command is se.

	  Most commands accept prefix addresses specifying the lines
	  in the file that they are to affect.	A number of commands
	  also may take a trailing count specifying the number of
	  lines to be involved in the command.	Counts are rounded
	  down if necessary.  Thus, the command ``10p'' displays the
	  tenth line in the buffer while ``move 5'' moves the current
	  line after line 5.

	  Some commands take other information or parameters, stated
	  after the command name.  Examples might be option names in a
	  set command, such as ``set number'', a filename in an edit
	  command, a regular expression in a substitute command, or a
	  target address for a copy command. For example:

	       1,5 copy 25

	  A number of commands have variants.  The variant form of the
	  command is invoked by placing an exclamation mark (!)
	  immediately after the command name.  Some of the default
	  variants may be controlled by options; in this case, the
	  exclamation mark turns off the meaning of the default.

	  In addition, many commands take flags, including the
	  characters ``p'' and ``l''.  A ``p'' or ``l'' must be
	  preceded by a blank or tab.  In this case, the command
	  abbreviated by these characters is executed after the
	  command completes.  Since ex normally displays the new
	  current line after each change, p is rarely necessary.  Any
	  number of plus (+) or minus (-) characters may also be given
	  with these flags.  If they appear, the specified offset is
	  applied to the current line value before the printing
	  command is executed.

     Page 20					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

	  Most commands that change the contents of the editor buffer
	  give feedback if the scope of the change exceeds a threshold
	  given by the report option.  This feedback helps to detect
	  undesirably large changes so that they may be quickly and
	  easily reversed with the undo command.  After commands with
	  global effect, you will be informed if the net change in the
	  number of lines in the buffer during this command exceeds
	  this threshold.

	Command Addressing
	  The following specifies the line addressing syntax for ex
	  commands:

	  .		 The current line.  Most commands leave the
			 current line as the last line which they
			 affect.  The default address for most
			 commands is the current line, thus ``.''  is
			 rarely used alone as an address.

	  n		 The nth line in the editor's buffer, lines
			 being numbered sequentially from 1.

	  $		 The last line in the buffer.

	  %		 An abbreviation for ``1,$'', the entire
			 buffer.

	  +n or -n	 An offset, n relative to the current buffer
			 line.	The forms ``.+3'' ``+3'' and ``+++''
			 are all equivalent.  If the current line is
			 line 100 they all address line 103.

	  /pattern/ or ?pattern?
			 Scan forward and backward respectively for a
			 text matching the regular expression given by
			 pattern.  Scans normally wrap around the end
			 of the buffer.	 If all that is desired is to
			 print the next line containing pattern, the
			 trailing slash (/) or question mark (?)  may
			 be omitted.  If pattern is omitted or
			 explicitly empty, the string matching the
			 last specified regular expression is located.
			 The forms ``RETURN'' and ``?RETURN'' scan
			 using the last named regular expression.
			 After a substitute, ``RETURN'' and
			 ``??RETURN'' would scan using that
			 substitute's regular expression.

	  '' or 'x	 Before each nonrelative motion of the current
			 line dot (.), the previous current line is
			 marked with a label, subsequently referred to
			 with two single quotation marks ('').	This

     Page 21					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

			 makes it easy to refer or return to this
			 previous context.  Marks are established with
			 the vi m command, using a single lowercase
			 letter as the name of the mark.  Marked lines
			 are later referred to with the following
			 notation:

			      'x.

			 where x is the name of a mark.

	  Addresses to commands consist of a series of addresses,
	  separated by a comma (,) or a semicolon (;).	Such address
	  lists are evaluated left to right.  When addresses are
	  separated by a semicolon (;) the current line (.)  is set to
	  the value of the previous addressing expression before the
	  next address is interpreted.	If more addresses are given
	  than the command requires, all but the last one or two are
	  ignored.  If the command takes two addresses, the first
	  addressed line must precede the second in the buffer.	 Null
	  address specifications are permitted in a list of addresses,
	  the default in this case is the current line ``.''; thus
	  ``,100'' is equivalent to ``.,100''.	It is an error to give
	  a prefix address to a command which expects none.

	Command Format
	  The following is the format for all ex commands:

	       [address] [command] [!] [parameters] [count] [flags]

	  All parts are optional depending on the particular command
	  and its options. The following section describes specific
	  commands.

	Argument List Commands
	  The argument list commands allow you to work on a set of
	  files, by remembering the list of filenames that are
	  specified when you invoke vi.	 The args command lets you
	  examine this list of filenames.  The file command gives you
	  information about the current file.  The n (next) command
	  lets you either edit the next file in the argument list or
	  change the list.  The rewind command lets you restart
	  editing the files in the list.  All of these commands are
	  described below:

	  args		The members of the argument list are
			displayed, with the current argument delimited
			by brackets.
			For example, a list might look like this:

			     file1 file2 [file3] file4 file5

     Page 22					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

			The current file is file3.

	  f		Displays the current filename, whether it has
			been modified since the last write command,
			whether it is read-only, the current
			linenumber, the number of lines in the buffer,
			and the percentage of the buffer that you have
			edited.	 In the rare case that the current
			file is ``[Not edited]'', this is noted also;
			in this case you have to use w! to write to
			the file, since the editor is not sure that a
			w command will not destroy a file unrelated to
			the current contents of the buffer.

	  f file	The current filename is changed to file which
			is considered ``[Not edited]''.

	  n		The next file in the command line argument
			list is edited.

	  n!		This variant suppresses warnings about the
			modifications to the buffer not having been
			written out, discarding irretrievably any
			changes that may have been made.

	  n [+command] filelist
			The specified filelist is expanded and the
			resulting list replaces the current argument
			list; the first file in the new list is then
			edited.	 If command is given (it must contain
			no spaces), then it is executed after editing
			the first such file.

	  rew		The argument list is rewound, and the first
			file in the list is edited.

	  rew!		Rewinds the argument list discarding any
			changes made to the current buffer.

	  If you use C-Shell and set the prompt variable to output a
	  prompt for non-interactive shells, the prompt is interpreted
	  as a filename when you use these commands.  This causes
	  unexpected problems.	To avoid these problems, use the
	  default prompt value as specified in
	  /usr/lib/mkuser/mkuser.cshrc.

	Edit Commands
	  To edit a file other than the one you are currently editing,
	  you will often use one of the variations of the e command.

	  In the following discussions, note that the name of the
	  current file is always remembered by vi and is specified by

     Page 23					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

	  a percent sign (%).  The name of the previous file in the
	  editing buffer is specified by a number sign (#).

	  The edit commands are described below:

	  e file      Used to begin an editing session on a new file.
		      The editor first checks to see if the buffer has
		      been modified since the last w command was
		      issued.  If it has been, a warning is issued and
		      the command is aborted.  The command otherwise
		      deletes the entire contents of the editor
		      buffer, makes the named file the current file,
		      and displays the new filename.  After ensuring
		      that this file is sensible, (i.e., that it is
		      not a binary file, directory, or a device), the
		      editor reads the file into its buffer.  If the
		      read of the file completes without error, the
		      number of lines and characters read is displayed
		      on the status line.  If none of these errors
		      occurred, the file is considered edited.	If the
		      last line of the input file is missing the
		      trailing newline character, it is supplied and a
		      complaint issued.	 The current line is initially
		      the first line of the file.

	  e! file     This variant form suppresses the complaint about
		      modifications having been made and not written
		      from the editor buffer, thus discarding all
		      changes that have been made before editing the
		      new file.

	  e +n file   Causes the editor to begin editing at line n
		      rather than at the first line.  The argument n
		      may also be an editor command containing no
		      spaces; for example, ``+/pattern''.

	  Ctrl-^      This is a shorthand equivalent for
		      ``:e #RETURN'', which returns to the previous
		      position in the last edited file.	 If you do not
		      want to write the file, you should use
		      ``:e! #RETURN'' instead.

	Write Commands
	  The write commands let you write out all or part of your
	  editing buffer to either the current file or to some other
	  file.	 These commands are described below:

	  w file      Writes changes made back to file, displaying the
		      number of lines and characters written.
		      Normally, file is omitted and the buffer is
		      written to the name of the current file.	If
		      file is specified, text is written to that file.

     Page 24					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

		      The editor writes to a file only if it is the
		      current file and is edited, or if the file does
		      not exist.  Otherwise, you must give the variant
		      form w! to force the write.  If the file does
		      not exist it is created.	The current filename
		      is changed only if there is no current filename;
		      the current line is never changed.

		      If an error occurs while writing the current and
		      edited file, the editor displays:

			   No write since last change

		      even if the buffer had not previously been
		      modified.

	  w>> file    Appends the buffer contents at the end of an
		      existing file.  Previous file contents are not
		      destroyed.

	  w! name     Overrides the checking of the normal write
		      command, and writes to any file that the system
		      permits.

	  w !command
		      Writes the specified lines into command.	A
		      blank or tab before the exclamation mark is
		      necessary.  Note the difference in spacing
		      between

			   w! file

		      which overrides checks and

			   w !cmd

		      which writes to a command.  The output of this
		      command is displayed on the screen and not
		      inserted in the editing buffer.

	Read Commands
	  The read commands let you read text into your editing buffer
	  at any location you specify.	The text you read in must be
	  at least one line long, and can be either a file or the
	  output from a command.

	  r file      Places a copy of the text of the given file in
		      the editing buffer after the specified line.  If
		      no file is given, the current filename is used.
		      The current filename is not changed unless there
		      is none, in which case the file becomes the
		      current name.  If the file buffer is empty and

     Page 25					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

		      there is no current name, this is treated as an
		      e command.

		      Address 0 is legal for this command and causes
		      the file to be read at the beginning of the
		      buffer.  Statistics are given as for the e
		      command when the r successfully terminates.
		      After an r the current line is the last line
		      read.

	  r !command  Reads the output of command into the buffer
		      after the specified line.	 A blank or tab before
		      the exclamation mark (!) is mandatory.

	Quit Commands
	  There are several ways to exit vi.  Some abort the editing
	  session, some write out the editing buffer before exiting,
	  and some warn you if you decide to exit without writing out
	  the buffer.  All of these ways of exiting are described
	  below:

	  q	    Exits vi.  No automatic write of the editor buffer
		    to a file is performed.  However, vi displays a
		    warning message if the file has changed since the
		    last w command was issued, and does not quit.  vi
		    also displays a diagnostic if there are more files
		    in the argument list left to edit.	Normally, you
		    will wish to save your changes, and you should
		    enter a w command.	If you wish to discard them,
		    enter the q! command variant.

	  q!	    Quits from the editor, discarding changes to the
		    buffer without complaint.

	  wq name   Like a w and then a q command.

	  wq! name  Overrides checking normally made before execution
		    of the w command to any file.  For example, if you
		    own a file but do not have write permission turned
		    on, the wq! allows you to update the file anyway.

	  x name    If any changes have been made and not written,
		    writes the buffer out and then quits.  Otherwise,
		    it just quits.

	Global and Substitute Commands
	  The global and substitute commands allow you to perform
	  complex changes to a file in a single command.  Learning how
	  to use these commands is a must for an experienced vi user.

	  g/pattern/cmds
		    The g command has two distinct phases.  In the

     Page 26					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

		    first phase, each line matching pattern in the
		    editing buffer is marked.  Next, the given command
		    list is executed with the current line, dot (.),
		    initially set to each marked line.

		    The command list consists of the remaining
		    commands on the current input line and may
		    continue to multiple lines by ending all but the
		    last such line with a backslash (\).  This
		    multiple-line option will not work from within vi,
		    you must switch to ex to do it.  The vi command
		    ``Q'' can be used to exit to ex and the ex command
		    ``vi'' returns to visual mode.  If cmds (or the
		    trailing slash (/) delimiter) is omitted, each
		    line matching pattern is displayed.

		    The g command itself may not appear in cmds.  The
		    options autoprint and autoindent are inhibited
		    during a global command and the value of the
		    report option is temporarily infinite, in
		    deference to a report for the entire global.
		    Finally, the context mark (') or (`) is set to the
		    value of the current line (.)  before the global
		    command begins and is not changed during a global
		    command.

		    The following global commands, most of them
		    substitutions, cover the most frequent uses of the
		    global command.

	  g/s1/p	 This command simply prints all lines that
			 contain the string ``s1'' .

	  g/s1/s//s2/	 This command substitutes the first occurrence
			 of ``s1'' on all lines that contain it with
			 the string ``s2''.

	  g/s1/s//s2/g	 This command substitutes all occurrences of
			 ``s1'' with the string ``s2''.	 This includes
			 multiple occurrences of ``s1'' on a line.

	  g/s1/s//s2/gp	 This command works the same as the preceding
			 example, except that in addition, all changed
			 lines are displayed on the screen.

	  g/s1/s//s2/gc	 This command prompts you to confirm that you
			 want to make each substitution of the string
			 ``s1'' with the string ``s2''.	 If you enter
			 a Y , the given substitution is made,
			 otherwise it is not.

	  g/s0/s/s1/s2/g This command marks all those lines that

     Page 27					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

			 contain the string ``s0'', and then for those
			 lines only, substitutes all occurrences of
			 the string ``s1'' with ``s2''.

	  g!/pattern/cmds
			 This variant form of g runs cmds at each line
			 not matching pattern.

	  g/^/s//   /g	 This command inserts blank spaces at the
			 beginning of each line in a file.

	  s/pattern/repl/options
			 On each specified line, the first instance of
			 text matching the regular expression pattern
			 is replaced by the replacement text repl.  If
			 the global indicator option character g
			 appears, all instances on a line are
			 substituted.  If the confirm indication
			 character c appears, before each substitution
			 the line to be substituted is printed on the
			 screen with the string to be substituted
			 marked with caret (^) characters.  By
			 entering Y , you cause the substitution to be
			 performed; any other input causes no change
			 to take place.	 After an s command, the
			 current line is the last line substituted.

	  v/pattern/cmds A synonym for the global command variant g!,
			 running the specified cmds on each line that
			 does not match pattern.

	Text Movement Commands
	  The text movement commands are largely superseded by
	  commands available in vi command mode.  However, the
	  following two commands are still quite useful:

	  co addr flags	 A copy of the specified lines is placed after
			 addr, which may be ``0''.  The current line
			 ``.''	addresses the last line of the copy.

	  [range]maddr	 The m command moves the lines specified by
			 range after the line given by addr.  For
			 example, m+ swaps the current line and the
			 following line, since the default range is
			 just the current line.	 The first of the
			 moved lines becomes the current line (dot).

	Shell Escape Commands
	  You will often want to escape from the editor to execute
	  normal  commands. You may also want to change your working
	  directory so that your editing can be done with respect to a
	  different working directory.	These operations are described

     Page 28					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

	  below:

	  cd directory	 The specified directory becomes the current
			 directory.  If no directory is specified, the
			 current value of the home option is used as
			 the target directory.	After a cd , the
			 current file is not considered to have been
			 edited so that write restrictions on
			 preexisting files still apply.

	  sh		 A new shell is created.  You  may invoke as
			 many commands as you like in this shell.  To
			 return to vi, enter a Ctrl-D to terminate the
			 shell.

	  !command	 The remainder of the line after the
			 exclamation (!) is sent to a shell to be
			 executed.  Within the text of command , the
			 characters ``%'' and ``#'' are expanded as
			 the filenames of the current file and the
			 last edited file and the character ``!''  is
			 replaced with the text of the previous
			 command.  Thus, in particular, ``!!''
			 repeats the last such shell escape.  If any
			 such expansion is performed, the expanded
			 line is echoed.  The current line is
			 unchanged by this command.

	  If there has been ``[No write]'' of the buffer contents
	  since the last change to the editing buffer, a diagnostic is
	  displayed before the command is executed, as a warning.  A
	  single exclamation (!) is displayed when the command
	  completes.

	  If you use C-Shell and set the prompt variable to output a
	  prompt for non-interactive shells, the prompt is interpreted
	  as an argument for command in shell escapes.	This causes
	  unexpected problems.	To avoid these problems, use the
	  default prompt value as specified in
	  /usr/lib/mkuser/mkuser.cshrc.

	Other Commands
	  The following command descriptions explain how to use
	  miscellaneous ex commands that do not fit into the above
	  categories.

	  The abbr, map, and set commands can also be defined with the
	  EXINIT environment variable, which is read by the editor
	  each time it starts up.  For more information, see
	  environ(M).  Alternatively, these commands can be placed in
	  a .exrc file in your home directory, which the editor reads
	  if EXINIT is not defined.

     Page 29					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

	  abbr	    Maps the first argument to the following string.
		    For example, the following command

			 :abbr rainbow yellow green blue red

		    maps ``rainbow'' to ``yellow green blue red''.
		    Abbreviations can be turned off with the
		    unabbreviate command, as in:

			 :una rainbow

	  map, map! Maps any character or escape sequence to a command
		    sequence.  For example, the following command maps
		    the CTRL-A key to a shell escape that runs the
		    clear(C) command:

			 map ^A :!clear^M

		    To include the CTRL-A and CTRL-M characters in the
		    mapping, you must use vi's CTRL-V escape.

		    Characters mapped with map work in command mode,
		    while characters mapped with map! work in insert
		    mode.  Characters mapped with map! cannot be
		    unmapped using unmap.

	  nu	    Displays each specified line preceded by its
		    buffer line number.	 The current line is left at
		    the last line displayed.  To get automatic line
		    numbering of lines in the buffer, set the number
		    option.

	  preserve  The current editor buffer is saved as though the
		    system had just crashed.  This command is for use
		    only in emergencies when a w command has resulted
		    in an error and you do not know how to save your
		    work.

	  =	    Displays the line number of the addressed line.
		    The current line is unchanged.

	  recover file
		    Recovers file from the system save area.  The
		    system saves a copy of the editing buffer only if
		    you have made changes to the file, the system
		    crashes, or you execute a preserve command.	 When
		    you use preserve, you are notified by mail when a
		    file is saved.

	  set argument
		    With no arguments, set displays those options
		    whose values have been changed from their

     Page 30					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

		    defaults; with the argument all, it displays all
		    of the option values.

		    Giving an option name followed by a question mark
		    (?)	 causes the current value of that option to be
		    displayed.	The question mark is unnecessary
		    unless the option is a Boolean value.  Switch
		    options are given values either with:

			 set option

		    to turn them on or:

			 set nooption

		    to turn them off.  String and numeric options are
		    assigned with:

			 set option=value

		    More than one option can be given to set; all are
		    interpreted from left to right.  See ``Options''
		    for a complete list and descriptions.

	  tag label The focus of editing switches to the location of
		    label.  If necessary, vi will switch to a
		    different file in the current directory to find
		    label.  If you have modified the current file
		    before giving a tag command, you must first write
		    it out. If you give another tag command with no
		    argument, the previous label is used.

		    Similarly, if you press Ctrl-], vi searches for
		    the word immediately after the cursor as a tag.
		    This is equivalent to entering ``:tag'', the word
		    following the cursor, and then pressing the RETURN
		    key.

		    The tags file is normally created by a program
		    such as ctags, and consists of a number of lines
		    with three fields separated by blanks or tabs. The
		    first field gives the name of the tag, the second
		    the name of the file where the tag resides, and
		    the third gives an addressing form which can be
		    used by the editor to find the tag.	 This field is
		    usually a contextual scan using /pattern/ to be
		    immune to minor changes in the file. Such scans
		    are always performed as if the nomagic option was
		    set.  The tag names in the tags file must be
		    sorted alphabetically.

	  unmap	    Unmaps any character or escape sequence that has

     Page 31					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

		    been mapped using the map command.

	Options
	  There are a number of options that can be set to affect the
	  vi environment.  These can be set with the ex set command
	  while editing, with the EXINIT environment variable, or in
	  the vi start-up file, .exrc.	This file normally sets the
	  user's preferred options so that they do not need to be set
	  manually each time you invoke vi.

	  The first thing that must be done before you can use vi, is
	  to set the terminal type so that vi understands how to talk
	  to the particular terminal you are using.

	  There are only two kinds of options: switch options and
	  string options.  A switch option is either on or off.	 A
	  switch is turned off by prefixing the word no to the name of
	  the switch within a set command.  String options are strings
	  of characters that are assigned values with the syntax
	  option=string.  Multiple options may be specified on a line.
	  vi options are listed below:

	  autoindent, ai     default: noai
	       Can be used to ease the preparation of structured
	       program text.  For each line created by an append,
	       change, insert, open, or substitute operation, vi looks
	       at the preceding line to determine and insert an
	       appropriate amount of indentation.  To back the cursor
	       up to the preceding tab stop, press Ctrl-D.  The tab
	       stops going backward are defined as multiples of the
	       shiftwidth option.  You cannot backspace over the
	       indent, except by pressing Ctrl-D.

	       Specially processed in this mode is a line with no
	       characters added to it, which turns into a completely
	       blank line (the whitespace provided for the autoindent
	       is discarded).  Also, specially processed in this mode
	       are lines beginning with a caret (^) and immediately
	       followed by a Ctrl-D.  This causes the input to be
	       repositioned at the beginning of the line, but retains
	       the previous indent for the next line.  Similarly, a
	       ``0'' followed by a Ctrl-D, repositions the cursor at
	       the beginning without retaining the previous indent.
	       Autoindent doesn't happen in global commands.

	  autoprint ap	    default: ap
	       Causes the current line to be displayed after each ex
	       copy, move, or substitute command.  This has the same
	       effect as supplying a trailing ``p'' to each such
	       command.	 Autoprint is suppressed in globals, and only
	       applies to the last command on a line.

     Page 32					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

	  autowrite, aw	    default: noaw
	       Causes the contents of the buffer to be automatically
	       written to the current file if you have modified it
	       when you give a next, rewind, tag, or ! command, or a
	       Ctrl-^ (switch files) or Ctrl-] (goto tag) command.

	  beautify, bf	   default: nobeautify
	       Causes all control characters except tab, newline and
	       formfeed to be discarded from the input.	 A complaint
	       is registered the first time a backspace character is
	       discarded.  Beautify does not apply to command input.

	  directory, dir     default: dir=/tmp
	       Specifies the directory in which vi places the editing
	       buffer file.  If the directory does not have write
	       permission, the editor will exit abruptly when it fails
	       to write to the buffer file.

	  edcompatible	   default: noedcompatible
	       Causes the presence or absence of g and c suffixes on
	       substitute commands to be remembered, and to be toggled
	       on and off by repeating the suffixes. The suffix r
	       causes the substitution to be like the tilde (~)
	       command, instead of like the ampersand command (&).

	  errorbells, eb     default: noeb
	       Error messages are preceded by a bell. If possible, the
	       editor always places the error message in inverse video
	       instead of ringing the bell.

	  hardtabs, ht	   default: ht=8
	       Gives the boundaries on which terminal hardware tabs
	       are set or on which tabs the system expands.

	  ignorecase, ic     default: noic
	       Maps all uppercase characters in the text to lowercase
	       in regular expression matching.	In addition, all
	       uppercase characters in regular expressions are mapped
	       to lowercase except in character class specifications
	       enclosed in brackets.

	  lisp	   default: nolisp
	       Autoindent indents appropriately for LISP code, and the
	       ( ) { } [[ and ]] commands are modified to have meaning
	       for LISP.

	  list	   default: nolist
	       All printed lines are displayed, showing tabs and end-
	       of-lines.

	  magic	    default: magic
	       If nomagic is set, the number of regular expression

     Page 33					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

	       metacharacters is greatly reduced, with only up-arrow
	       (^) and	dollar sign ($) having special effects.	 In
	       addition, the metacharacters ``~'' and ``&'' in
	       replacement patterns are treated as normal characters.
	       All the normal metacharacters may be made magic when
	       nomagic is set by preceding them with a backslash (\).

	  mesg	   default: nomesg
	       Causes write permission to be turned off to the
	       terminal while you are in visual mode, if nomesg is
	       set.  This prevents people writing to your screen with
	       the write command and scrambling your screen as you
	       edit.

	  number, n	default: nonumber
	       Causes all output lines to be printed with their line
	       numbers.

	  open	   default: open
	       If set to noopen, the commands open and visual are not
	       permitted from ex.  This is set to prevent confusion
	       resulting from accidental entry to open or visual mode.

	  optimize, opt	    default: optimize
	       Output of text to the screen is expedited by setting
	       the terminal so that it does not perform automatic
	       carriage returns when displaying more than one line of
	       output, thus greatly speeding output on terminals
	       without addressable cursors when text with leading
	       whitespace is printed.

	  paragraphs, para     default: para =IPLPPPQPP TPbp
	       Specifies paragraph delimiters for the { and }
	       operations.  The pairs of characters in the option's
	       value are the names of the nroff macros that start
	       paragraphs.

	  prompt     default: prompt
	       ex input is prompted for with a colon (:). If noprompt
	       is set, when ex command mode is entered with the Q
	       command, no colon prompt is displayed on the status
	       line.

	  redraw     default: noredraw
	       The editor simulates (using great amounts of output),
	       an intelligent terminal on a dumb terminal.  Useful
	       only at very high speed.

	  remap	    default: remap
	       If on, mapped characters are repeatedly tried until
	       they are unchanged. For example, if o is mapped to O
	       and O is mapped to I, o will map to I if remap is set,

     Page 34					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

	       and to O if noremap is set.

	  report     default: report=5
	       Specifies a threshold for feedback from commands.  Any
	       command that modifies more than the specified number of
	       lines will provide feedback as to the scope of its
	       changes.	 For global commands and the undo command, the
	       net change in the number of lines in the buffer is
	       presented at the end of the command.  Thus notification
	       is suppressed during a g command on the individual
	       commands performed.

	  scroll     default: scroll=1/2 window
	       Determines the number of logical lines scrolled when
	       Ctrl-D is received from a terminal input in command
	       mode, and the number of lines displayed by a command
	       mode z command (double the value of scroll).

	  sections     default: sections=SHNHH HU
	       Specifies the section macros for the [[ and ]]
	       operations.  The pairs of characters in the option's
	       value are the names of the nroff macros that start
	       sections.

	  shell, sh	default: sh=/bin/sh
	       Gives the pathname of the shell forked for the shell
	       escape command (!), and by the shell command.  The
	       default is taken from SHELL in the environment, if
	       present.

	  shiftwidth, sw     default:sw=8
	       Gives the width of a software tab stop, used in reverse
	       tabbing with Ctrl-D when using autoindent to append
	       text, and by the shift commands.

	  showmatch, sm	    default: nosm
	       When a ) or } is typed, moves the cursor to the
	       matching ( or { for one second if this matching
	       character is on the screen.

	  showmode     default: noshowmode
	       Causes the message ``INPUT MODE'' to appear on the
	       lower right corner of the screen when insert mode is
	       activated.

	  slowopen     default: noslowopen
	       Postpones update of the display during inserts.

	  tabstop, ts	  default: ts=8
	       The editor expands tabs in the input file to be on n
	       boundaries for the purposes of display.

     Page 35					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

	  taglength, tl	    default: tl=0
	       The first n characters in a tag name are significant,
	       but all others are ignored.  A value of zero (the
	       default) means that all characters are significant.

	  tags	   default: tags=tags /usr/lib/tags
	       A path of files to be used as tag files for the tag
	       command.	 A requested tag is searched for in the
	       specified files, sequentially.  By default, files named
	       tags are searched for in the current directory and in
	       /usr/lib.

	  term	   default=value of shell TERM variable
	       The terminal type of the output device.

	  terse	    default: noterse
	       Shorter error diagnostics are produced for the
	       experienced user.

	  timeout , to	   default: noto
	       Eliminates the 1 second time limit for maps (character
	       mappings).

	  warn	   default: warn
	       Warn if there has been ``[No write since last change]''
	       before a shell escape command (!).

	  window     default: window = speed dependent
	       This specifies the number of lines in a text window.
	       The default is 8 at slow speeds (600 baud or less), 16
	       at medium speed (1200 baud), and the full screen (minus
	       one line) at higher speeds.

	  w300, w1200, w9600
	       These are not true options but set window (above) only
	       if the speed is slow (300), medium (1200), or high
	       (9600), respectively.

	  wrapscan, ws	   default: ws
	       Searches, using the regular expressions in addressing,
	       will wrap around past the end of the file.

	  wrapmargin, wm     default: wm=0
	       Defines the margin for automatic insertion of newlines
	       during text input.  A value of zero specifies no wrap
	       margin.

	  writeany, wa	   default: nowa
	       Inhibits the checks normally made before write
	       commands, allowing a write to any file that the system
	       protection mechanism will allow.

     Page 36					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

     Regular Expressions
	  A regular expression specifies a set of strings of
	  characters.  A member of this set of strings is said to be
	  by the regular expression.  vi remembers two previous
	  regular expressions:	the previous regular expression used
	  in a substitute command and the previous regular expression
	  used elsewhere, referred to as the previous scanning regular
	  expression.  The previous regular expression can always be
	  referred to by a null regular expression:  e.g., ``//'' or
	  ``??''.

	  The regular expressions allowed by vi are constructed in one
	  of two ways depending on the setting of the magic option.
	  The ex and vi default setting of magic gives quick access to
	  a powerful set of regular expression metacharacters.	The
	  disadvantage of magic is that the user must remember that
	  these metacharacters are magic and precede them with the
	  backslash (\) to use them as ``ordinary'' characters.	 With
	  nomagic set, regular expressions are much simpler, there
	  being only two metacharacters.  The power of the other
	  metacharacters is still available by preceding the now
	  ordinary character with a ``\''.  Note that ``\'' is always
	  a metacharacter.  In this discussion, the magic option is
	  assumed. With nomagic , the only special characters are the
	  caret (^) at the beginning of a regular expression, the
	  dollar sign ($) at the end of a regular expression, and the
	  backslash (\).  The tilde (~) and the ampersand (&) also
	  lose their special meanings related to the replacement
	  pattern of a substitute.

	  The following basic constructs are used to construct magic
	  mode regular expressions.

	  char An ordinary character matches itself.  Ordinary
	       characters are any characters except a caret (^) at the
	       beginning of a line, a dollar sign ($) at the end of
	       line, an asterisk (*) as any character other than the
	       first, and any of the following characters:

		    .  \  [  ~

	       These characters must be preceded by a backslash (\) if
	       they are to be treated as ordinary characters.

	  ^    At the beginning of a pattern, forces the match to
	       succeed only at the beginning of a line.

	  $    At the end of a regular expression, forces the match to
	       succeed only at the end of the line.

	  .    Matches any single character except the newline
	       character.

     Page 37					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

	  \<   Forces the match to occur only at the beginning of a
	       ``word''; that is, either at the beginning of a line,
	       or just before a letter, digit, or underline and after
	       a character not one of these.

	  \>   Similar to ``\<'', but matching the end of a ``word'',
	       i.e., either the end of the line or before a character
	       which is not a letter, a digit, or the underline
	       character.

	  [string]
	       Matches any single character in the class defined by
	       string.	Most characters in string define themselves.
	       A pair of characters separated by a dash (-) in string
	       defines the set of characters between the specified
	       lower and upper bounds, thus ``[a-z]'' as a regular
	       expression matches any single lowercase letter.	If the
	       first character of string is a caret (^) then the
	       construct matches those characters which it otherwise
	       would not.  Thus ``[^a-z]'' matches anything but a
	       lowercase letter or a newline.  To place any of the
	       characters caret, left bracket, or dash in string they
	       must be escaped with a preceding backslash (\).

	  The concatenation of two regular expressions first matches
	  the leftmost regular expression and then the longest string
	  that can be recognized as a regular expression.  The first
	  part of this new regular expression matches the first
	  regular expression and the second part matches the second.
	  Any of the single character matching regular expressions
	  mentioned above may be followed by an asterisk (*) to form a
	  regular expression that matches zero or more adjacent
	  occurrences of the characters matched by the prefixing
	  regular expression.  The tilde (~) may be used in a regular
	  expression to match the text that defined the replacement
	  part of the last s command.  A regular expression may be
	  enclosed between the sequences ``\('' and ``\)'' to remember
	  the text matched by the enclosed regular expression.	This
	  text can later be interpolated into the replacement text
	  using the following notation:

	       \digit

	  where digit enumerates the set of remembered regular
	  expressions.

	  The basic metacharacters for the replacement pattern are the
	  ampersand (&) and the tilde (~); these are given as ``\&''
	  and ``\~'' when nomagic is set.  Each instance of the
	  ampersand is replaced by the characters matched by the
	  search pattern.  In the replacement pattern, the tilde
	  stands for the text of the previous replacement pattern.

     Page 38					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

	  Other metasequences possible in the replacement pattern are
	  always introduced by a backslash (\).	 The sequence ``\n''
	  is replaced by the text matched by the nth regular
	  subexpression enclosed between ``\('' and ``\)''.  When
	  nested, parenthesized subexpressions are present, n is
	  determined by counting occurrences of ``\('' starting from
	  the left.  The sequences ``\u'' and ``\l'' cause the
	  immediately following character in the replacement to be
	  converted to uppercase or lowercase, respectively, if this
	  character is a letter.  The sequences ``\U'' and ``\L'' turn
	  such conversion on, either until ``\E'' or ``\e'' is
	  encountered, or until the end of the replacement pattern.

     Files
	  /tmp			   default directory where temporary
				   work files are placed; it can be
				   changed using the directory option
				   (see the ex(C) set command.).

	  /usr/lib/terminfo/?/*	   compiled terminal description
				   database

	  /usr/lib/.COREterm/?/*   subset of compiled terminal
				   description database

     Credit
	  This utility was developed at the University of California
	  at Berkeley and is used with permission.

     Notes
	  The /usr/lib/ex3.7preserve program can be used to restore vi
	  buffer files that were lost as a result of a system crash.
	  The program searches the /tmp directory for vi buffer files
	  and places them in the directory /usr/preserve. The owner
	  can retrieve these files using the -r option.

	  The /usr/lib/ex3.7preserve program must be placed in the
	  system startup file, /etc/rc, before the command that cleans
	  out the /tmp directory.  See the XENIX System
	  Administrator's Guide for more information on /etc/rc.

	  Two options, although they continue to be supported, have
	  been replaced in the documentation by the options that fol-
	  low the Command Syntax Standard (see intro(C)).  A -r option
	  that is not followed with an argument has been replaced by
	  -L and +command has been replaced by -c command.

	  vi does not strip the high bit from 8 bit characters read in
	  from text files, text insertion, and editing commands.  It
	  does not look for magic numbers of object files when reading
	  in a text file.  It also writes out text and displays text
	  without stripping the high bit.

     Page 39					      (printed 2/7/91)

     VI(C)		      XENIX System V			 VI(C)

	  vi uses the LC_CTYPE environment variable to determine if a
	  character is printable, displaying the octal codes of non-
	  printable 8 bit characters.  It also uses LC_CTYPE and LANG
	  to convert between upper and lowercase characters for the
	  tilde command and for the ignorecase option.

	  When the percent sign (%) is used in a shell escape from vi
	  via the exclamation mark (!) the % is replaced with the name
	  of the file being edited.  In previous versions of vi, each
	  character in this replacement had the high bit set to 1 to
	  quote it; in the current version of vi it is left alone.

     Warnings
	  Tampering with the entries in /usr/lib/.COREterm/?/* or
	  /usr/lib/terminfo/?/* (for example, changing or removing an
	  entry) can affect programs such as vi that expect all en-
	  tries to be present and correct.  In particular, removing
	  the ``dumb'' terminal entry may cause unexpected problems.

	  Software tabs using ^T work only immediately after the au-
	  toindent.

	  Left and right shifts on intelligent terminals do not make
	  use of insert and delete operations in the terminal.

	  Refer to the crypt(C) page for information about restric-
	  tions on the availability of encryption options.

     Page 40					      (printed 2/7/91)

[top]
                             _         _         _ 
                            | |       | |       | |     
                            | |       | |       | |     
                         __ | | __ __ | | __ __ | | __  
                         \ \| |/ / \ \| |/ / \ \| |/ /  
                          \ \ / /   \ \ / /   \ \ / /   
                           \   /     \   /     \   /    
                            \_/       \_/       \_/ 
More information is available in HTML format for server Xenix

List of man pages available for Xenix

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net