NAME
	  vi, vedit, view - Edits files	with a full screen display

     SYNOPSIS
	  vi [-lRsv] -r[file] [-t tag] [-wnumber] [+subcommand]	[-]
	  [file	...]

	  view [-lv] [-t tag] [-wnumber] [+subcommand] [-] [file ...]

	  vedit


	  The vi command is a display editor that is based on an
	  underlying line editor (ex).

     FLAGS
	  -l  Indents appropriately for	LISP code, and accepts the (,
	      ), {, }, [, and ]	characters (parentheses, braces, and
	      brackets)	as text	rather than interpreting them as vi
	      subcommands.  The	LISP modifier is active	in open	or
	      visual modes.

	  -r[file]
	      Recovers file after an editor or system crash.  If you
	      do not specify a file, vi	displays a list	of all saved
	      files.

	  -R  Sets the readonly	option to protect the file against
	      overwriting.

	  -s  Invokes vi in open mode.	(Silent	mode.)

	  -t tag
	      Edits the	file containing	the tag	and positions the edi-
	      tor at its definition.  To use this flag,	you must first
	      create a database	of function names and their locations
	      using the	ctags command.

	  -v  Invokes the visual editor.  When the -v flag is speci-
	      fied, an enlarged	set of subcommands is available,
	      including	screen editing and cursor movement features.

	  -wnumber
	      Sets the default window size to number.  This is useful
	      when you use the editor over a low-speed line.

	  -   Suppresses all interactive user feedback.	 If you	use
	      this flag, file input/output errors do not generate an
	      error message.

	  +[subcommand]
	      Performs the ex subcommand before	editing	begins.	 If
	      you do not specify subcommand, the cursor	is placed on
	      the first	line of	the file.


     DESCRIPTION
	  The ex editor	subcommands can	be used	within the vi editor,
	  because vi is	based on ex.  The view command is a read-only
	  version of vi; the readonly option is	set to protect files
	  during browsing.  The	vedit command is a version of vi
	  intended for beginners.  In it, the report option is set to
	  1, the showmode option is set, and the novice	option (making
	  vedit	a line editor, rather than a screen editor) is set.
	  (For more information	on these options, see Setting
	  Options.)

	  The file argument specifies the files	to be edited.  If you
	  supply more than one file on the command line, vi edits each
	  file in the order specified.

	  When you use vi, changes you make to a file are reflected on
	  your display.	 The position of the cursor on the display
	  indicates its	position within	the file.  The subcommands
	  affect the file at the cursor	position.

	Limitations of the vi Editor
	  The maximum limits of	the vi editor are as follows:


	    o  2048 bytes per line.

	    o  256 bytes per global command list.

	    o  128 bytes in the	previous inserted and deleted text.

	    o  128 bytes in a shell escape command.

	    o  128 bytes in a string-valued option.

	    o  30 bytes	in a tag name.

	    o  128 map macros with 2048	bytes total.


	Editing	Modes
	  The vi editor	has the	following operational modes:


	  Command mode
	      When you start the vi editor, it is in Command mode.
	      Any subcommand can be entered from this mode, except
	      commands that can	only be	used in	the Text Input mode
	      (those subcommands that make corrections during text
	      insertion).  When	subcommands and	the other modes	end,
	      vi returns to Command mode.  Pressing <Esc> cancels a
	      partial subcommand.

	  Text Input mode
	      Entered by the a,	A, i, I, o, O, cx (where x represents
	      the scope	of the subcommand), C, s, S, and R subcom-
	      mands.  After entering one of these commands, you	can
	      enter text into the editing buffer at the	current	cursor
	      position.	 To return to Command mode, press <Esc>	for
	      normal exit or press the Interrupt key sequence to end
	      abruptly.

	  Last Line mode
	      Some subcommands (those with the prefix :	(colon), /
	      (slash), ? (question mark), or !!) read input on a line
	      displayed	at the bottom of the screen.  When you enter
	      the initial character, vi	places the cursor at the bot-
	      tom of the screen, where you enter the remaining charac-
	      ters of the command.  Press <Return> to perform the sub-
	      command and enter	the Interrupt key sequence to cancel
	      it.

	      When !! is used, the cursor moves	only after the two
	      exclamation points are entered.  When : is used, special
	      meaning is given to the following	characters if used as
	      counts before a command:


	      %	  All lines, regardless	of cursor position.

	      $	  Last line.

	      .	  Current line.


	Setting	Options
	  The vi editor	allows you to customize	options	so that	you
	  can use the editor for a specific task.  Use the set command
	  to set or change an option.  To view the current setting of
	  options, enter :set all while	in vi Command mode.

	  Some options are set to a string or a	number value; other
	  options are simply turned on or off.	To change an option
	  that is set to a value, enter	a command in the form :set
	  option=value.	 To toggle an option that can be set to	on or
	  off, enter a line of the form	:set option to set it to on or
	  :set nooption	to set it to off.

	  Options can be abbreviated in	a set command.	The following
	  table	lists some of vi's options, along with abbreviations
	  and descriptions:
			   Table 0-0.  The vi Options

     Option		    Abbreviation   Description

	  [no]autoindent	 ai		Indents	automatically in Text mode
						to the indentation on the previous
						line by	using the spacing between
						tab stops specified by the
						shiftwidth option.  The	default	is
						noai.  To back the cursor up to	the
						previous tab stop, type	<Ctrl-d>.
						This option is not in effect for
						global commands.

	  [no]autoprint		 ap		Prints the current line	after any
						command	that changes the editing
						buffer.	The default is ap.  This
						option applies only to the last
						command	in a sequence of commands
						on a single line, and is not in
						effect for global commands.

	  [no]autowrite		 aw		Writes the editing buffer to the
						file automatically before the :n,
						:ta, <Ctrl-a>, and ! subcommands if
						the editing buffer was changed
						since the last write command.  The
						default	is noaw.

	  [no]beautifying text	 bf		Prevents user from entering control
						characters (except for tab, new-
						line, and formfeed) in the editing
						buffer during text entry.  The
						default	is nobf.  This option does
						apply to command input.

	  directory		 dir=		Displays the directory that con-
						tains the editing buffer.  The
						default	is dir=/tmp.

	  [no]edcompatible	 ed		Retains	global (g) and confirm (c)
						subcommand suffixes during multiple
						substitutions and causes the read
						(r) suffix to work like	the r sub-
						command.  The default is noed.

	  [no]flash		 fl		Uses visual flash rather than audi-
						ble bell.  The default is fl.




	  hardtabs		 ht=		Tells vi the distance between the
						hardware tab stops on your display.
						The default is ht=8.

	  [no]ignorecase	 ic		Ignores	the distinction	between
						uppercase and lowercase	while
						searching for regular expressions.
						The default is noic.

	  [no]lisp		 lisp		Enters vi in LISP mode.	 In this
						mode, vi appropriately indents for
						LISP code and the (, ),	{, }, [[,
						and ]].	 The default is	nolisp.

	  [no]list		 list		Displays text with tabs	and the	end
						of lines marked.  Tabs are
						displayed as ^I	and the	end of
						lines as $.  The default is nolist.

	  [no]magic		 magic		Treats the characters ., [, and	*
						as special characters in scans.	 In
						Off mode, only the (, ), and $
						characters retain special meanings;
						however, special meaning of other
						characters can still be	invoked	by
						preceding the character	with a \
						(backslash).  The default is magic.

	  [no]modeline		 modeline	Runs an	editor command line if
						found in the first five	and the
						last five lines	of the file.  An
						editor command line may	be anywhere
						in a line.  To be recognized as	a
						command	line, it must contain a
						space or a tab followed	by the
						string ex: or vi:.  The	command
						line is	ended by a second :
						(colon).  The editor tries to
						interpret any data between the
						first and second : as editor com-
						mands.	The default is nomodeline.

	  [no]number		 nu		Displays lines prefixed	with their
						line numbers.  The default is nonu.

	  [no]optimize		 opt		Speeds up the operation	of termi-
						nals that do not have cursor
						addressing.  The default is noopt.




	  paragraphs		 para=		Defines	macro names that start
						paragraphs.  The default is
						para=IPLPPPQPP LIpplpipnpbp.  Sin-
						gle letter nroff macros, such as .P
						must include the space as a quoted
						character if respecifying a para-
						graph.

	  [no]redraw		 re		Simulates a smart display on a dumb
						display.  The default is nore.

	  [no]remap		 remap		Enables	following of map keys.	For
						example, if remap is set, map u	k
						map r u	causes r to map	to k.  If
						noremap	is set,	r maps to u.  The
						default	is remap.

	  report		 report=	Sets the number	of repetitions of a
						command	before a message is
						displayed.  For	subcommands that
						can produce a number of	messages,
						such as	global subcommands, the
						messages are displayed when the
						command	is completed.  The default
						is report=5.

	  scroll		 scr=		Sets the number	of lines to be
						scrolled when you scroll the screen
						up or down.  The default scroll	is
						one-half the size of the screen.

	  sections		 sect=		Defines	macro names that start sec-
						tions.	The default is sect=NHSHH
						HUuhsh+c.  Single letter nroff mac-
						ros, such as .P	must include the
						space as a quoted character if
						respecifying a paragraph.

	  shell			 sh=		Defines	the shell for !	or :! com-
						mands.	The default is the value of
						the SHELL environment variable.

	  shiftwidth		 sw=		Sets the distance for the software
						tab stops used by autoindent, the
						shift commands (> and <), and the
						text input commands (<Ctrl-d> and
						<Ctrl-t>) to allow the editor to
						indent text and	move back to a pre-
						vious indentation.  The	default	is
						sw=8.


	  [no]showmatch		 sm		Shows the matching open	parenthesis
						(  or open brace { as you type the
						close parenthesis ) or close brace
						}.  The	default	is nosm.

	  [no]showmode		 smd		Displays mode indicator	at the bot-
						tom of the screen when in the
						insert or replace mode.	 The
						default	is nosmd.

	  [no]slowopen		 slow		Postpones updating the display dur-
						ing inserts.  The default is
						noslow.

	  tabstops		 ts=		Sets distance between tab stops
						when a file is displayed.  The
						default	is ts=8.

	  [no]tags		 tag		Specifies a list of possible
						filenames of tag files.	 The
						default	is tags	/usr/lib/tags.

	  term			 term=		Sets the kind of display you are
						using.	The default is term=$TERM,
						where $TERM is the value of the
						TERM shell variable.

	  [no]terse		 terse		Allows vi to display the short form
						of messages.  The default is
						noterse.

	  [no]timeout		 to		Sets a time limit of 2 seconds on
						entry of characters.  This limit
						allows the characters in a macro to
						be entered and processed as
						separate characters when timeout is
						set.  To resume	use of the macro,
						set notimeout.	The default is to.

	  [no]warn		 warn		Displays a warning message before
						the ! subcommand executes a shell
						command	if this	is the first time
						you issued a shell command after a
						given set of changes were made in
						the editing buffer, but	not written
						to a file.  The	default	is warn.






	  window		 wi=		Sets the number	of lines displayed
						in one window of text.	The default
						is dependent on	the baud rate at
						which you are operating:  600 baud
						or less	/ 8 lines, 1200	baud / 16
						lines, higher speeds / full screen
						minus 1.

	  wrapmargin		 wm=		Sets the margin	for automatic
						wordwrapping from one line to the
						next.  A value of 0 indicates no
						wordwrapping.  The default is wm=0.

	  [no]wrapscan		 ws		Allows string searches to wrap from
						the end	of the editing buffer to
						the beginning.	The default is ws.

	  [no]writeany		 wa		Turns off the checks usually made
						before a write command.	 The
						default	is nowa.

	Defining Macros
	  If you use a subcommand or sequence of subcommands fre-
	  quently, you can create a macro that issues the subcommand
	  or sequence when you call a macro.  To create	a macro, enter
	  the sequence of subcommands into an editing buffer named
	  with a letter	of the alphabet.  When used as buffer names,
	  lowercase ASCII letters a through z overlay the contents of
	  the buffer, while uppercase ASCII letters A through Z	append
	  text to the previous contents	of the buffer, allowing	the
	  building of a	macro piece by piece.

	  To invoke the	macro, enter @x, where x is the	letter name of
	  the buffer.  Enter @@	 to repeat the last macro you invoked.

	Mapping	Keys
	  You can use the map command to set a keystroke to a subcom-
	  mand or a sequence of	subcommands.  To set a key mapping,
	  enter	:map key subcommand where key is the key to which you
	  want to assign a subcommand or sequence of subcommands and
	  subcommand is	the subcommand or sequence of subcommands.
	  For example, to set @	to delete lines, enter:

	  :map	@  dd



	  In this example, @ is	the key	to which the subcommand	is
	  assigned and dd is the subcommand.

	  In the next example, a subcommand sequence is	mapped to a
	  key:
	  :map * {>}



	  The *	(asterisk) is the key to which the subcommand sequence
	  is assigned and {>} is the subcommand	sequence.  The { (open
	  brace) moves the cursor to the beginning of the paragraph
	  and the > (right angle bracket) indents the paragraph	to the
	  next shiftwidth.

	  To display the list of the current key mappings while	you
	  are in Command mode, enter the :map command.	You can	also
	  remove a key mapping.	 To remove a key mapping, enter	:unmap
	  string or :unmap! string where string	is the string used
	  used after the :map command to set the key and subcommand
	  sequence.  For example, to remove key	mapping	for the	previ-
	  ous example, enter:

	  :unmap *



	  If function keys are defined for your	terminal, they can be
	  put in a map or unmap	command	by typing <Ctrl-v> then	press-
	  ing the desired key.	In this	way, function keys that	are
	  unused during	editing	can be mapped to useful	editing	sub-
	  command sequences.

	Abbreviations
	  You can define abbreviations for long	phrases	that you use
	  often.  vi then automatically	expands	these abbreviations
	  whenever you enter them in insert mode.

	  To define an abbreviation, enter:

	  :abbr	abbreviation phrase


	  where	abbreviation is	the abbreviation you specify for the
	  longer text specified	by phrase.  For	example, to specify
	  the abbreviation imho	for the	phrase In my humble opinion,
	  enter:

	  :abbr	imho In	my humble opinion



	Keeping	a Customized Change
	  When you customize vi	from the vi command line, the custom-
	  ized editor is in effect until you exit the editor.  If you
	  want such things as option settings and key mappings so you
	  can reuse them, you must put them in the .exrc file in your
	  home directory.  vi processes	the commands given in the
	  EXINT	variable and then reads	this file each time you	invoke
	  it.  When you	type the commands in a file, do	not type the :
	  (colon) before each command.	The : is required only if you
	  are in the editor.  Here is an example of an .exrc file:

	  set ai aw
	  set wm=5
	  map  @  dd



	The vi Character Sets
	  The collation	sequence, as defined by	the value of the
	  LC_COLLATE environment variable, defines the alphanumeric
	  set used by your system.  This table affects the performance
	  of vi	macros and subcommands.

	  The vi editor	uses the collation sequence to distinguish
	  between a small word and a big word.	A small	word is
	  bounded by letters or	numbers	as defined in the collation
	  table.  For example, isn't is	two small words.  The '	(apos-
	  trophe) is not a number or an	alphabetic character, and it
	  bounds both the small	word t and the small word isn.	A big
	  word is bounded by spaces, tabs, or newline indicators.  For
	  example, stop	is a big word.	For more information, see the
	  section Moving to Words.

     SUBCOMMANDS
	Subcommand Syntax
	  [named_buffer] [operator] [number] argument

	  Surrounding brackets indicate	optional items.


	  [named_buffer]
	      A	temporary text storage area.

	  [operator]
	      Specifies	the subcommand or action; instructs the	vi
	      editor.

	  [number]
	      A	whole decimal value that specifies either the extent
	      of the action or a line address.	The vi editor inter-
	      prets this number	in one of the following	ways:


	       1.  Go to line number:

		   5G
		   10z<Return>



	       2.  Go forward number columns.

		   25<Space>



	       3.  Scroll number of lines:

		   10<Ctrl-d>
		   10<Ctrl-u>



	       4.  Delete number lines:

		   6dd



	       5.  % means all.	 To yank all lines:

		   %y



		   (The	preceding command replaces 1,$y.)


	  argument
	      Specifies	what to	act on.	 This can be a text object (a
	      character, word, sentence, paragraph, section, or	char-
	      acter string) or a text position (a line,	position in
	      the current line,	or screen position).


	Moving Within a	File
	  Enter	the following subcommands in Command mode.  You	can
	  cancel an incomplete subcommand by pressing <Esc>.


	  <Left	Arrow>,	h, <Ctrl-h>
	      Moves the	cursor one character to	the left.

	  <Down	Arrow>,	j, <Ctrl-j>, <Ctrl-n>
	      Moves the	cursor down one	line, remaining	in the same
	      column.

	  <Up Arrow>, k, <Ctrl-p>
	      Moves the	cursor up one line, remaining in the same
	      column.

	  <Right Arrow>, l <Space>
	      Moves the	cursor one character to	the right.

	      Long lines:  Lines over one screen width are wrapped but
	      not broken.  When	using the Up Arrow or Page Up key, @
	      lines are	added at the bottom of the screen when too few
	      physical lines are available to display the complete
	      line.  The Down Arrow key	moves the entire line off the
	      screen at	once.


	Character Positioning Within a Line
	  Enter	the following subcommands in Command mode.


	  ^   Moves the	cursor to the first nonspace character.

	  0   Moves the	cursor to the beginning	of the line.

	  $   Moves the	cursor to the end of the line.

	  fx  Moves the	cursor to the next x character.

	  Fx  Moves the	cursor to the last x character.

	  tx  Moves the	cursor to one column before the	next x charac-
	      ter.

	  Tx  Moves the	cursor to one column after the last x charac-
	      ter.

	  ;   Repeats the last f, F, t,	or T subcommand.

	  ,   Repeats the last f, F, t,	or T subcommand	in the oppo-
	      site direction.

	  number<Space>
	      Moves the	cursor to the specified	column.


	Moving to Words
	  Enter	the following subcommands in Command mode.


	  w   Moves the	cursor to the next small word.

	  b   Moves the	cursor to the previous small word.

	  e   Moves the	cursor to the end of the next small word.

	  W   Moves the	cursor to the next big word.

	  B   Moves the	cursor to the previous big word.

	  E   Moves the	cursor to the end of the next big word.


	Moving by Line Positioning
	  Enter	the following subcommands in Command mode.


	  G   Moves to the line	number given as	preceding argument, or
	      the end of the file if no	preceding count	is given.

	  H   Moves the	cursor to the top line on the screen.

	  L   Moves the	cursor to the last line	on the screen.

	  M   Moves the	cursor to the middle line on the screen.

	  +   Moves the	cursor to the next line, at its	first nonspace
	      character.

	  -   Moves the	cursor to the previous line, at	its first non-
	      space character.

	  <Return>
	      Moves the	cursor to the next line, at its	first nonspace
	      character.


	Moving to Sentences, Paragraphs, or Sections
	  Enter	the following subcommands in Command mode.  You	can
	  cancel an incomplete subcommand by pressing <Esc>.


	  (   Places the cursor	at the beginning of the	previous sen-
	      tence (or	the previous S-expression if you are in	LISP
	      mode).

	  )   Places the cursor	at the beginning of the	next sentence
	      (or the next S-expression	if you are in LISP mode).

	  {   Places the cursor	at the beginning of the	previous para-
	      graph (or	at the next list if you	are in LISP mode).

	  }   Places the cursor	at the beginning of the	next para-
	      graph, at	the next section if you	are in C mode, or at
	      the next list if you are in LISP mode.

	  |   Requires a count;	the cursor is placed in	that column
	      (if possible).

	  ]]  Places the cursor	at the next section, or	function if
	      you are in LISP mode.

	  [[  Places the cursor	at the previous	section, or function
	      if you are in LISP mode.


	Paging and Scrolling
	  <Ctrl-u>
	      Scrolls up (default 12 lines).

	  <Ctrl-d>
	      Scrolls down (default 12 lines).

	  <Ctrl-f>
	      Pages forward one	screen.

	  <Ctrl-b>
	      Pages backward one screen.

	  <Ctrl-y>
	      Scrolls the window up one	line.

	  <Ctrl-e>
	      Scrolls the window down one line.

	  <Ctrl-m>
	      Moves to the first nonwhite character in the next	line.
	      A	count specifies	the number of lines to go forward.

	  <Ctrl-t>
	      Inserts shiftwidth white space in	input mode, if at the
	      beginning	of the line or preceded	only by	white space.
	      This inserted space can only be backed over using
	      <Ctrl-d>.

	  <Ctrl-[>
	      Cancels a	partially formed command; sounds the bell if
	      there is none.

	      In input mode, terminates	input mode.

	      When entering a command on the bottom line of the	screen
	      (ex command line or search pattern with \	or ?), ter-
	      minates input and	executes command.

	  z+  Pages up.

	  z^  Pages down.


	Searching for Patterns
	  The following	commands allow you to search for patterns
	  within a file.  Patterns can be regular expressions as
	  described for	grep.


	  /pattern
	      Places the cursor	at the next line containing pattern.

	  ?pattern
	      Places the cursor	at the next previous line containing
	      pattern.

	  n   Repeats the last search for pattern in the same direc-
	      tion.

	  N   Repeats the last search for pattern in the opposite
	      direction.

	  /pattern/+number
	      Places the cursor	at the numberth	line after the line
	      matching pattern.

	  ?pattern?-number
	      Places the cursor	at the numberth	line before the	line
	      matching pattern.

	  %   Finds the	parenthesis or brace that matches the one at
	      the current cursor position.

	  <Ctrl-t>
	      Finds the	word at	the cursor in the tags file then edits
	      the proper file, placing the cursor at the tag.  If the
	      tag is in	the current file, moves	cursor to it.


	Marking	and Returning
	  Enter	the following subcommands in Command mode.  You	can
	  cancel an incomplete subcommand by pressing <Esc>.


	  ``  Moves the	cursor to the same cursor position of the pre-
	      vious current line.

	  ''  Moves the	cursor to the beginning	of the previous
	      current line.

	  mx  Marks the	current	position with the letter specified by
	      x.

	  `x  Moves the	cursor to the same cursor position of line
	      marked x.

	  'x  Moves the	cursor to the beginning	of the line marked x.


	Adjusting the Screen
	  Enter	the following subcommands in Command mode.  An incom-
	  plete	subcommand can be cancelled by pressing	<Esc>.


	  <Ctrl-l>
	      Clears and redraws the screen.

	  <Ctrl-r>
	      Redraws the screen and eliminates	blank lines marked
	      with a @.

	  z<Return>
	      Redraws the screen with the current line at the top of
	      the screen.

	  z-  Redraws the screen with the current line at the bottom
	      of the screen.

	  z.  Redraws the screen with the current line at the center
	      of the screen.

	  /pattern/z-
	      Redraws the screen with the line containing pattern at
	      the bottom.

	  znumber<Return>
	      Makes the	window number lines long.


	Adding Text to a File--Text Input
	  The following	subcommands are	entered	in Command mode	and
	  bring	the vi editor into Text	Input mode to allow you	to add
	  text to your file.  End Text Intput mode by pressing <Esc>.


	  atext
	      Inserts text after the cursor.

	  Atext
	      Adds text	to the end of the line.

	  itext
	      Inserts text before the cursor.

	  Itext
	      Inserts text before the first nonspace character in the
	      line.

	  o   Adds an empty line below the current line.

	  O   Adds an empty line above the current line.


	Changing Text While in Input Mode
	  Use the following commands only while	in Text	Entry mode.
	  They have different meanings in Command mode.


	  <Ctrl-h>
	      Erases the last character.

	  <Ctrl-w>
	      Erases the last small word.  (For	more information about
	      small words, see the section vi Character	Sets.)

	  \   Quotes the Erase and Kill	characters.

	  <Esc>
	      Ends insertion, back to Command mode.

	  Quit key sequence
	      Interrupts, terminates insert or <Ctrl-d>.

	  <Ctrl-d>
	      Goes back	to the previous	autoindent stop.

	  ^<Ctrl-d>
	      Ends autoindent for this line only.

	  0<Ctrl-d>
	      Moves the	cursor back to the left	margin.

	  <Ctrl-v>
	      Quotes a nonprinting character.


	Changing Text from Command Mode
	  Use the following subcommands	in Command mode.  An incom-
	  plete	subcommand can be cancelled by pressing	<Esc>.


	  C   Changes the rest of the line (c$).

	  c   Must be followed by a movement command.  Deletes the
	      specified	region of text and enters input	mode to
	      replace it with the entered text.	 If more than part of
	      a	single line is affected, the deleted text is saved in
	      the numeric buffers.  If only part of the	current	line
	      is affected, the last character to be deleted is marked
	      with a $.	 A count is passed through to the move
	      command.	If the command is cc, the whole	of the current
	      line is changed.

	  cc  Changes a	line.

	  cw  Changes a	word.

	  D   Deletes the rest of the line (d$)	and puts it into the
	      undo buffer.

	  d   Must be followed by a movement command.  Deletes the
	      specified	region of text.	 If more than part of a	line
	      is affected, the text is saved in	the numeric buffers.
	      A	count is passed	through	to the move command.  If the
	      command is dd, the whole of the current line is deleted.

	  dd  Deletes a	line and puts it into the undo buffer.

	  dw  Deletes a	word and puts it into the undo buffer.

	  J   Joins lines.

	  rx  Replaces the current character with the character	speci-
	      fied by x.

	  R   Overwrites characters.

	  s   Substitutes characters (cl).

	  S   Substitutes lines	(cc).

	  u   Undoes the previous change.

	  x   Deletes a	character.

	  X   Deletes characters before	cursor (dh).

	  <<  Shifts one line to the left.

	  <L  Shifts all lines from the	cursor to the end of the
	      screen to	the left.  (The	< character describes a	range
	      upon which the L subcommand acts.)

	  >>  Shifts one line to the right.

	  >L  Shifts all lines from the	cursor to the end of the
	      screen to	the right.  (The > character describes a range
	      upon which the L subcommand acts.)

	  ~   Changes the letter at the	cursor to the opposite case.


	Copying	and Moving Text
	  Use the following subcommands	in Command mode.  An incom-
	  plete	subcommand can be cancelled by pressing	<Esc>.


	  p (P)
	      Puts back	text in	the undo buffer	after (before) the
	      cursor.

	      Puts back	text from the buffer x after (before) the cur-
	      sor.

	      Deletes object into the buffer x.

	  yobject
	      Yanks object into	the undo buffer	(for example, yw to
	      yank a word).

	      Yanks object into	buffer x.

	  Y   Places the line in the undo buffer.


	Restoring and Repeating	Changes
	  Use the following subcommands	in Command mode.  An incom-
	  plete	subcommand can be cancelled by pressing	<Esc>.


	  u   Undoes the last command.

	  U   Restores the current line	if the cursor has not left the
	      line since the last change.

	  .   Repeats the last change or increments the	np command.

	      Note that	this command is	not meant for use with a
	      macro.  Enter @@ to repeat a macro.

	      Retrieves	the nth	last delete of a complete line or
	      block of lines.


	Saving Changes to a File
	  Use the following subcommands	in Command mode.  An incom-
	  plete	subcommand can be cancelled by pressing	<Esc>.	If you
	  are using these subcommands within the ex editor, you	do not
	  need to type the : (colon).


	  :w  Writes the editing buffer	contents to the	original file.

	  :w file
	      Writes the editing buffer	contents to the	named file.

	  :w! file
	      Overwrites file with the editing buffer contents.


	Interrupting, Cancelling, and Exiting vi
	  Q   Enters the ex editor in Command mode.

	  ZZ  Exits vi,	saving changes,	if any were made.

	  :q  Quits vi.	 If you	have changed the contents of the edit-
	      ing buffer, vi displays a	warning	message	and does not
	      quit.

	  :q! Quits vi,	discarding the editing buffer with no warning.

	  :sh Runs a shell.  You can return to vi by pressing <Ctrl-
	      d>.

	  :w !command
	      Runs the file through the	specified shell	command
	      (causes no change	to the file).

	  :!command
	      Runs command, then returns.

	  :!! Repeats the last :!command command.

	  n!!command
	      Executes the shell command identified by command and
	      replaces the number of lines specified by	n with the
	      output of	command.  If n is not specified, the default
	      is 1.  If	command	expects	standard input,	the lines
	      specified	are used as input.  (10!!sort sorts the	next
	      10 lines.)

	  !linescommand
	      Works like n!!command, except that lines is a line
	      address (for example, !Gsort sorts the rest of the
	      file).

	  Quit key sequence
	      Interrupts a subcommand.


	Editing	a Second File
	  Enter	the following subcommands in Command mode.  An incom-
	  plete	subcommand can be cancelled by pressing	<Esc>.


	  :e file
	      Edits file.  If you are using this subcommand from the
	      ex editor, you do	not need to type the : (colon).

	  :e! Reedits the current file and discards all	changes.

	  :e  +	 file
	      Edits file, starting at the end.

	  :e  +number
	      Edits file, starting at the line number.

	  :e # and <Ctrl-a>
	      Edits the	alternate file.	 The alternate file is usually
	      the the previous current filename.  However, if changes
	      are pending on the current file when a new file is
	      called, the new file becomes the alternate file.

	  :r file
	      Reads the	file into the editing buffer by	adding new
	      lines below the current line.  If	you are	using this
	      subcommand from the ex editor, you do not	need to	type
	      the : (colon).

	  :r !command
	      Runs the shell command identified	by command and places
	      its output in the	file by	adding new lines below the
	      current cursor position.

	  :ta tag
	      Edits a file containing tag at the location of tag.  If
	      the tag is in another file and the current file has been
	      changed (and noaw	is set), a warning is posted.  To use
	      this command, you	must first create a database of	func-
	      tion names and their locations using the ctags command.
	      If you are using this subcommand from the	ex editor, you
	      do not need to type the :	(colon).

	  <Ctrl-t>
	      Finds the	word at	the cursor in the tags file and	edits
	      the indicated file, placing the cursor at	the tag.  Same
	      as :ta, but the tag is the word to the right of the cur-
	      sor.


	Editing	a List of Files
	  Enter	the following subcommands in Command mode.


	  :n  Edits the	next file in the list entered on the command
	      line.

	  :n file ...
	      Specifies	a new list of files to edit.


	Displaying File	Information
	  Enter	the following subcommand in Command mode to show the
	  current filename, the	current	line number, the number	of
	  lines	in the file, and the percentage	of lines of the	file
	  that are before the cursor:


	  <Ctrl-g>


     RELATED INFORMATION
	  Commands:  ctags(1), ed(1)/red(1), edit(1), ex(1),
	  grep(1)/fgrep(1)/egrep(1).




































Acknowledgement and Disclaimer