summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/vi/USD.doc/edit/Makefile19
-rw-r--r--usr.bin/vi/USD.doc/edit/edit.vindex115
-rw-r--r--usr.bin/vi/USD.doc/edit/edittut.ms2322
-rw-r--r--usr.bin/vi/USD.doc/exref/Makefile15
-rw-r--r--usr.bin/vi/USD.doc/exref/ex.rm2230
-rw-r--r--usr.bin/vi/USD.doc/exref/ex.summary734
-rw-r--r--usr.bin/vi/USD.doc/vi.man/Makefile14
-rw-r--r--usr.bin/vi/USD.doc/vi.man/vi.11294
-rw-r--r--usr.bin/vi/USD.doc/vitut/Makefile18
-rw-r--r--usr.bin/vi/USD.doc/vitut/vi.apwh.ms1079
-rw-r--r--usr.bin/vi/USD.doc/vitut/vi.chars644
-rw-r--r--usr.bin/vi/USD.doc/vitut/vi.in2064
-rw-r--r--usr.bin/vi/USD.doc/vitut/vi.summary468
13 files changed, 0 insertions, 11016 deletions
diff --git a/usr.bin/vi/USD.doc/edit/Makefile b/usr.bin/vi/USD.doc/edit/Makefile
deleted file mode 100644
index 2e24838debf..00000000000
--- a/usr.bin/vi/USD.doc/edit/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 6/8/93
-
-DIR= usd/11.edit
-SRCS= edittut.ms
-EXTRA= edit.vindex
-MACROS= -msU
-
-paper.ps: ${SRCS}
- ${TBL} ${SRCS} | ${ROFF} > ${.TARGET}
-
-# index for versatec is different from the one in edit.tut
-# because the fonts are different and entries reference page
-# rather than section numbers. if you have a typesetter
-# you should just use the index in edit.tut, and ignore editvindex.
-
-editvindex:
- ${TROFF} ${MACROS} -n22 edit.vindex
-
-.include <bsd.doc.mk>
diff --git a/usr.bin/vi/USD.doc/edit/edit.vindex b/usr.bin/vi/USD.doc/edit/edit.vindex
deleted file mode 100644
index 2098f14ea19..00000000000
--- a/usr.bin/vi/USD.doc/edit/edit.vindex
+++ /dev/null
@@ -1,115 +0,0 @@
-.\" Copyright (c) 1980, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)edit.vindex 8.1 (Berkeley) 6/8/93
-.\"
-.bd I
-.ND
-.TL
-Index
-.sp 3
-.2C
-.nf
-addressing, \fIsee\fR line numbers
-append mode, 4
-backslash (\\), 18
-buffer, 2
-command mode, 4
-context search, 8, 10, 13, 18
-control characters (``^'' notation), 8
-control-d, 6
-current filename, 19, 20
-current line (.), 9, 15
-diagnostic messages, 4
-disk, 2
-documentation, 21
-edit (to begin editing session), 3, 7
-editing commands:
-.in +2
-append (a), 4, 7
-change (c), 16
-copy (co), 13
-delete (d), 13-14
-edit (e), 12
-file (f), 19
-global (g), 18-19
-move (m), 12-13
-number (nu), 9
-preserve (pre), 20-21
-print (p), 8
-quit (q), 5, 11
-quit! (q!), 11
-read (r), 20
-recover (rec), 20
-substitute (s), 9-10, 17, 18
-undo (u), 14, 17
-write (w), 5-6, 11, 19-20
-z, 11
-.sp 10i
-! (shell escape), 19
-$= , 15
-+, 15
-\-, 15
-//, 8, 18
-??, 18
-\&\fB.\fR, 9, 15
-\&\fB.\fR=, 9, 15
-.in -2
-erasing
-.ti +2
-characters (#), 8
-.ti +2
-lines (@), 8
-ex (text editor), 21
-\fIEx Reference Manual\fR, 21
-file, 1
-file recovery, 20
-filename, 2
-Interrupt (message), 7
-line numbers, \fIsee also\fR current line
-.ti +2
-dollar sign ($), 8, 12-13, 15
-.ti +2
-dot (.), 9, 15
-.ti +2
-relative (+ and \-), 15, 16
-logging out, 6
-login procedure, 2
-``magic'' characters, 21
-non-printing characters, 8
-``not found'' (message), 3
-program, 1
-recovery \fIsee\fR file recovery
-shell, 18
-shell escape (!), 19
-special characters (^, $, \e), 18
-text input mode, 4
-UNIX, 1
diff --git a/usr.bin/vi/USD.doc/edit/edittut.ms b/usr.bin/vi/USD.doc/edit/edittut.ms
deleted file mode 100644
index 5f4c28cb6d2..00000000000
--- a/usr.bin/vi/USD.doc/edit/edittut.ms
+++ /dev/null
@@ -1,2322 +0,0 @@
-.\" Copyright (c) 1980, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)edittut.ms 8.1 (Berkeley) 6/8/93
-.\"
-.EH 'USD:11-%''Edit: A Tutorial'
-.OH 'Edit: A Tutorial''USD:11-%'
-.LP
-.ds u \s-2UNIX\s0
-.ll 5i
-.nr LL 5i
-.ND
-.sp 4
-.ce
-\f3\s+2Edit: A Tutorial\s0\f1
-.sp
-.ce 3
-.I
-Ricki Blau
-.sp
-James Joyce
-.R
-.sp
-.ce 3
-Computing Services
-University of California
-Berkeley, California 94720
-.sp 3
-.ce
-.I
-ABSTRACT
-.R
-.sp
-.LP
-This narrative introduction to the use of the text editor
-.I edit
-assumes no prior familiarity with computers or with text editing.
-Its aim is to lead the beginning \s-2UNIX\(dg\s+2 user through the
-.FS
-\(dgUNIX is a trademark of Bell Laboratories.
-.FE
-fundamental steps of writing and revising a file of text.
-Edit,
-a version of the text editor
-.I ex,
-was designed to provide an informative environment
-for new and casual users.
-.PP
-We welcome comments and suggestions about this tutorial
-and the \s-2UNIX\s+2 documentation in general.
-.sp .5v
-September 1981
-.bp
-.ll 6.5i
-.nr LL 6.5i
-.nr LT 6.5i
-.ds u \s-2UNIX\s0
-.ce
-\s+2\f3Contents\f1\s0
-.LP
-.nf
-Introduction\ \ \ 3
-.sp
-Session 1\ \ \4
-.in +.5i
-Making contact with \s-2UNIX\s+2\ \ \ 4
-Logging in\ \ \4
-Asking for \fIedit\fR\ \ \ 4
-The ``Command not found'' message\ \ \ 5
-A summary\ \ \5
-Entering text\ \ \ 5
-Messages from \fIedit\fR\ \ \ 5
-Text input mode\ \ \ 6
-Making corrections\ \ \ 6
-Writing text to disk\ \ \ 7
-Signing off\ \ \7
-.in -.5i
-.sp
-Session 2\ \ \ 8
-.in +.5i
-Adding more text to the file\ \ \ 8
-Interrupt\ \ \ 8
-Making corrections\ \ \ 8
-Listing what's in the buffer (p)\ \ \ 9
-Finding things in the buffer\ \ \ 9
-The current line\ \ \ 10
-Numbering lines (nu)\ \ \ 10
-Substitute command (s)\ \ \ 10
-Another way to list what's in the buffer (z)\ \ \ 11
-Saving the modified text\ \ \ 12
-.in -.5i
-.sp
-Session 3\ \ \ 13
-.in +.5i
-Bringing text into the buffer (e)\ \ \ 13
-Moving text in the buffer (m)\ \ \ 13
-Copying lines (copy)\ \ \ 14
-Deleting lines (d)\ \ \ 14
-A word or two of caution\ \ \ 15
-Undo (u) to the rescue\ \ \ 15
-More about the dot (.) and buffer end ($)\ \ \ 16
-Moving around in the buffer (+ and \-)\ \ \ 16
-Changing lines (c)\ \ \ 17
-.in -.5i
-.sp
-Session 4\ \ \ 18
-.in +.5i
-Making commands global (g)\ \ \ 18
-More about searching and substituting\ \ \ 19
-Special characters\ \ \ 19
-Issuing \s-2UNIX\s+2 commands from the editor\ \ \ 20
-Filenames and file manipulation\ \ \ 20
-The file (f) command\ \ \ 20
-Reading additional files (r)\ \ \ 21
-Writing parts of the buffer\ \ \ 21
-Recovering files\ \ \ 21
-Other recovery techniques\ \ \ 21
-Further reading and other information\ \ \ 22
-Using \fIex\fR\ \ \ 22
-.in -.5i
-.sp
-Index\ \ \ 23
-.bp
-.SH
-.ce
-\s+2Introduction\s0
-.PP
-Text editing using a terminal connected to a computer
-allows you to create, modify, and print text
-easily.
-A
-.I
-text editor
-.R
-is a program
-that assists you
-as you create and modify text.
-The text editor you will learn here is named
-.I edit.
-Creating text using edit is as easy as typing it
-on an electric typewriter.
-Modifying text involves telling the text editor
-what you want to add, change, or delete.
-You can review your text
-by typing a command
-to print the file contents
-as they are currently.
-Another program (which we do not discuss in this
-document), a text formatter,
-rearranges your text
-for you into ``finished form.''
-.PP
-These lessons assume no prior familiarity with computers
-or with text editing.
-They consist of a series of text editing sessions
-which lead you through the fundamental steps
-of creating and revising text.
-After scanning each lesson and before beginning the next,
-you should try the examples at a terminal to get a feeling
-for the actual process of text editing.
-If you set aside some time for experimentation,
-you will soon become familiar with using the
-computer to write and modify text.
-In addition to the actual use of the text editor,
-other features of \s-2UNIX\s0 will be very important to your work.
-You can begin to
-learn about these other features by
-reading one of the other tutorials
-that provide a general introduction to the system.
-You will be ready to proceed with this lesson as soon as
-you are familiar with (1) your terminal and its special keys,
-(2) how to login,
-(3) and the ways of correcting typing errors.
-Let's first define some terms:
-.sp .5
-.IP program 12
-A set of instructions, given to the computer,
-describing the sequence of steps the computer performs
-in order to accomplish a specific task.
-The task must be specific,
-such as balancing your checkbook
-or editing your text.
-A general task,
-such as working for world peace,
-is something we can all do,
-but not something we can currently write programs to do.
-.IP UNIX
-\s-2UNIX\s0 is a special type of program,
-called an operating system, that supervises the machinery
-and all other programs comprising the total
-computer system.
-.IP edit
-.I edit
-is the name of the \s-2UNIX\s0 text editor you will be learning to use,
-and is a program that aids you in writing or revising text.
-Edit was designed for beginning users,
-and is a simplified version of an editor named
-.I ex.
-.IP file
-Each \s-2UNIX\s0 account is allotted
-space for the permanent storage of information,
-such as programs, data or text.
-A file is a logical unit of data,
-for example, an essay, a program,
-or a chapter from a book,
-which is stored on a computer system.
-Once you create a file,
-it is kept until you instruct the system to remove it.
-You may create a file during one \s-2UNIX\s0 session,
-end the session,
-and return to use it at a later time.
-Files contain anything you choose to write and store in them.
-The sizes of files vary to suit your needs;
-one file might hold only a single number,
-yet another might contain
-a very long document or program.
-The only way to save
-information from one session to the next is to store it in a file,
-which you will learn in Session 1.
-.IP filename
-Filenames are used to distinguish one file from another,
-serving the same purpose as the labels of manila
-folders in a file cabinet.
-In order to write or access information in a file,
-you use the name of that file in a \s-2UNIX\s0 command,
-and the system will automatically locate the file.
-.IP disk
-Files are stored on an input/output device called a disk,
-which looks something like a stack of phonograph records.
-Each surface is coated with a material similar to that
-on magnetic recording tape,
-and information is recorded on it.
-.IP buffer
-A temporary work space, made available to the user
-for the duration of a session of text editing
-and used for creating and modifying
-the text file.
-We can think of the buffer as a blackboard that is
-erased after each class, where each session with the editor
-is a class.
-.bp
-.SH
-.ce 1
-\s+2Session 1\s0
-.sp 1
-.SH
-Making contact with \s-1UNIX\s0
-.PP
-To use the editor you must first make contact with the computer
-by logging in to \s-2UNIX\s0.
-We'll quickly review the standard \s-2UNIX\s0 login procedure
-for the two ways you can make contact:
-on a terminal that is directly linked to the computer,
-or over a telephone line where the computer answers your call.
-.SH
-Directly-linked terminals
-.PP
-Turn on your terminal and press the \s-1RETURN\s0 key.
-You are now ready to login.
-.SH
-Dial-up terminals
-.PP
-If your terminal connects with the computer over a telephone line,
-turn on the terminal, dial the system access number,
-and, when you hear a high-pitched tone, place the
-telephone handset in the acoustic coupler, if you are using one.
-You are now ready to login.
-.SH
-Logging in
-.PP
-The message inviting you to login is:
-.DS I 1i
-login:
-.DE
-.LP
-Type your login name, which identifies you to \s-2UNIX\s0,
-on the same line as the login message,
-and press \s-2RETURN\s+2.
-If the terminal you are using
-has both upper and lower case,
-.B
-be sure you enter your login name in lower case;
-.R
-otherwise \s-2UNIX\s0 assumes your terminal
-has only upper case and will not recognize lower case
-letters you may type.
-\s-2UNIX\s0 types ``login:'' and you reply
-with your login name, for example ``susan'':
-.DS I 1i
-login: \fBsusan\fR \fI(and press the \s-2RETURN\s0 key)\fR
-.DE
-(In the examples, input you would type appears in
-.B "bold face"
-to distinguish it from the responses from \s-2UNIX\s0.)
-.PP
-\s-2UNIX\s0 will next respond with a request for a password
-as an additional precaution to prevent
-unauthorized people from using your account.
-The password will not appear when you type it,
-to prevent others from seeing it.
-The message is:
-.DS I 1i
-Password: \fI(type your password and press \s-2RETURN\s+2)\fR
-.DE
-If any of the information you gave during the login
-sequence was mistyped or incorrect,
-\s-2UNIX\s0 will respond with
-.DS I 1i
-Login incorrect.
-.if t .sp .2v
-.if n .sp 1
-login:
-.DE
-in which case you should start the login process anew.
-Assuming that you have successfully
-logged in, \s-2UNIX\s0
-will print the message of the day and eventually will present
-you with a % at the beginning of a fresh line.
-The % is the \s-2UNIX\s0 prompt symbol
-which tells you that \s-2UNIX\s0 is ready to accept a command.
-.bd I 3
-.SH
-Asking for \fIedit\fP
-.fl
-.bd I
-.PP
-You are ready to tell \s-2UNIX\s0 that you
-want to work with edit, the text editor.
-Now is a convenient time to choose
-a name for the file of text you are about to create.
-To begin your editing session,
-type
-.B edit
-followed by a space and then the filename
-you have selected; for example, ``text''.
-After that,
-press the \s-2RETURN\s0 key and wait for edit's response:
-.DS I 1i
-% \fBedit text\fP \fI(followed by a \s-2RETURN\s+2)\fR
-"text" No such file or directory
-:
-.DE
-If you typed the command correctly,
-you will now be in communication with edit.
-Edit has set aside a buffer for use as
-a temporary working space during your current editing session.
-Since ``text'' is a new file we are about to create
-the editor was unable to find that file, which it
-confirms by saying:
-.DS I 1i
-"text" No such file or directory
-.DE
-On the next line appears edit's prompt ``:'',
-announcing that you are in \f2command mode\f1 and
-edit expects a command from you.
-You may now begin to create the new file.
-.SH
-The ``Command not found'' message
-.PP
-If you misspelled edit by typing, say, ``editor'',
-this might appear:
-.DS I 1i
-% \fBeditor\fP
-editor: Command not found
-%
-.DE
-Your mistake in calling edit ``editor'' was
-treated by \s-2UNIX\s0 as a request
-for a program named ``editor''.
-Since there is no program
-named ``editor'',
-\s-2UNIX\s0 reported that the program was ``not found''.
-A new % indicates that \s-2UNIX\s0 is ready for another command,
-and you may then enter the correct command.
-.SH
-A summary
-.PP
-Your exchange with \s-2UNIX\s0 as you logged in and made contact with edit
-should look something like this:
-.DS I 1i
-login: \fBsusan\fP
-Password:
-\&... A Message of General Interest ...
-% \fBedit text\fP
-"text" No such file or directory
-:
-.DE
-.SH
-Entering text
-.PP
-You may now begin entering text into the buffer.
-This is done by \fIappending\fP (or adding) text to whatever
-is currently in the buffer.
-Since there is nothing in the buffer at the moment,
-you are appending text to nothing;
-in effect,
-since you are adding text to nothing
-you are creating text.
-Most edit commands have two equivalent forms:
-a word that suggests what the command does,
-and a shorter abbreviation of that word.
-Many beginners find the full command names
-easier to remember at first,
-but once you are familiar with editing you may
-prefer to type the shorter abbreviations.
-The command to input text is ``append''.
-(It may be abbreviated ``a''.)
-Type
-.B append
-and press the \s-2RETURN\s0 key.
-.DS I 1i
-% \fBedit text
-\fR:\|\fBappend
-.R
-.DE
-.SH
-.bd I 3
-Messages from
-.I edit
-.fl
-.bd I
-.PP
-If you make a mistake in entering a command and
-type something that edit does not recognize,
-edit will respond with a message
-intended to help you diagnose your error.
-For example, if you misspell the command to input text by typing,
-perhaps, ``add'' instead of ``append'' or ``a'',
-you will receive this message:
-.DS I 1i
-:\|\fBadd\fR
-add: Not an editor command
-:
-.DE
-When you receive a diagnostic message,
-check what you typed in order to determine what
-part of your command confused edit.
-The message above means that edit
-was unable to recognize your mistyped command
-and, therefore, did not execute it.
-Instead, a new ``:''
-appeared to let you know that
-edit is again ready to execute a command.
-.SH
-Text input mode
-.PP
-By giving the command ``append'' (or using the abbreviation ``a''),
-you entered
-.I
-text input mode,
-.R
-also known as
-.I
-append mode.
-.R
-When you enter text input mode,
-edit stops sending you a prompt.
-You will not receive any prompts
-or error messages
-while in text input mode.
-You can enter
-pretty much anything you want on the lines.
-The lines are transmitted one by one to the buffer
-and held there during the editing session.
-You may append as much text as you want, and
-.I
-when you wish to stop entering text lines you should
-type a period as the only character on the line
-and press the \s-2RETURN\s0 key.
-.R
-When you type the period and press \s-2RETURN\s0,
-you signal that you want to stop appending text,
-and edit responds by allowing
-you to exit text input mode and reenter command mode.
-Edit will again
-prompt you for a command by printing ``:''.
-.PP
-Leaving append mode does not destroy the text in
-the buffer.
-You have to leave append
-mode to do any of the other kinds of editing,
-such as changing, adding, or printing text.
-If you type a period as the first character and
-type any other character on the same line,
-edit will believe you want to remain in append mode
-and will not let you out.
-As this can be very frustrating,
-be sure to type
-.B only
-the period and the \s-2RETURN\s0 key.
-.PP
-This is a good place to learn an important
-lesson about computers and text: a blank space is
-a character as far as a computer is concerned.
-If you so much as type a period followed by a blank
-(that is, type a period and then the space bar on the keyboard),
-you will remain in append mode with the last line of text
-being:
-.DS I 1i
-.B
-.ps +2
-\&.
-.ps -2
-.R
-.DE
-Let's say that you enter the lines
-(try to type
-.B exactly
-what you see, including ``thiss''):
-.DS I 1i
-.B
-This is some sample text.
-And thiss is some more text.
-Text editing is strange, but nice.
-\&.
-.R
-.DE
-The last line is the period followed by a \s-2RETURN\s0
-that gets you out of append mode.
-.SH
-Making corrections
-.PP
-If you have read a general introduction to \s-2UNIX\s0,
-you will recall that it is possible to erase individual
-letters that you have typed.
-This is done by typing the designated erase character
-as many times as there are characters
-you want to erase.
-.PP
-The usual erase character varies from place to place and
-user to user. Often it
-is the backspace (control-H),
-so you can correct typing errors
-in the line you are typing
-by holding down the \s-1CTRL\s+1 key
-and typing the ``H'' key. (Sometimes it is the DEL key.)
-If you type the erase character
-you will notice
-that the terminal backspaces in the line you are on.
-You can backspace over your error,
-and then type what you want to be the rest of the line.
-.PP
-If you make a bad start
-in a line
-and would like to begin again,
-you can either backspace to the beginning of the line
-or you can use the at-sign ``@'' to erase everything on the line:
-.DS I 1i
-.B
-Text edtiing is strange, but@
-Text editing is strange, but nice.
-.R
-.fl
-.bd S
-.DE
-When you type the at-sign (@), you erase
-the entire line typed so far
-and are given a fresh line to type on.
-You may immediately begin to retype the line.
-This, unfortunately, does not work after you type the
-line and press \s-2RETURN\s+2.
-To make corrections in lines that have been completed,
-it is necessary to use the editing commands
-covered in the next sessions.
-.SH
-Writing text to disk
-.PP
-You are now ready to edit the text. One common operation
-is to write the text to disk as a file for safekeeping
-after the session is over.
-This is the only way to save information from one session to the next,
-since the editor's buffer is temporary and will last only until the
-end of the editing session.
-Learning how to write a file to disk is second in
-importance only to entering the text.
-To write the contents of the buffer to a disk
-file, use the command ``write''
-(or its abbreviation ``w''):
-.DS I 1i
-:\|\fBwrite
-.R
-.DE
-Edit will copy the contents of the buffer to a disk file.
-If the file does not yet exist,
-a new file will be created automatically
-and the presence of a ``[New file]'' will be noted.
-The newly-created file will be given the name specified when
-you entered the editor, in this case ``text''.
-To confirm that the disk file has been successfully written,
-edit will repeat the filename and give
-the number of lines and the total
-number of characters in the file.
-The buffer remains unchanged by the ``write'' command.
-All of the lines that were written to disk will still be
-in the buffer,
-should you want to modify or add to them.
-.PP
-Edit must have a name for the file to be written.
-If you forgot to indicate the name of the file
-when you began to edit,
-edit will print in response to your write command:
-.DS I 1i
-No current filename
-.DE
-If this happens, you can specify the filename in a new write command:
-.DS I 1i
-:\|\fBwrite text
-.R
-.DE
-After the ``write'' (or ``w''), type a space and then the name of the file.
-.SH
-Signing off
-.PP
-We have done enough for this first lesson on using the
-\s-2UNIX\s0 text editor, and are ready to quit the session with edit.
-To do this we type ``quit'' (or ``q'') and press \s-2RETURN\s+2:
-.DS I 1i
-:\|\fBwrite
-.R
-"text" [New file] 3 lines, 90 characters
-:\|\fBquit\fR
-%
-.DE
-The % is from \s-2UNIX\s0 to tell you that your session with edit is
-over and you may command \s-2UNIX\s0 further.
-Since we want
-to end the entire session at the terminal, we also need to
-exit from \s-2UNIX\s0.
-In response to the \s-2UNIX\s0 prompt of ``\|%\|''
-type the command
-.DS I 1i
-%\|\fBlogout\fR
-.DE
-This will end your session with \s-2UNIX\s0, and will ready the
-terminal for the next user.
-It is always important to type \fBlogout\fR at the end of a session
-to make absolutely sure no one
-could accidentally stumble into your abandoned
-session and thus gain access to your files,
-tempting even the most honest of souls.
-.sp 1
-.PP
-This is the end of the first session on \s-2UNIX\s0 text editing.
-.bp
-.TL
-Session 2
-.sp
-.PP
-Login with \s-2UNIX\s0 as in the first session:
-.DS I 1i
-login: \fBsusan\fP \fI(carriage return)\fR
-Password: \fI(give password and carriage return)\fR
-.if t .sp .2v
-.if n .sp 1
-\&... A Message of General Interest ...
-%
-.DE
-When you indicate you want to edit,
-you can specify the name of the file you worked on last time.
-This will
-start edit working, and it will fetch the contents of the
-file into the buffer, so that you can resume editing the same file.
-When edit has copied the file into the buffer, it
-will repeat its name and tell
-you the number of lines and characters it contains.
-Thus,
-.DS I 1i
-.B
-% edit text
-.R
-"text" 3 lines, 90 characters
-:
-.DE
-means you asked edit to fetch
-the file named ``text'' for editing,
-causing it to copy the
-90 characters of text into the buffer.
-Edit awaits
-your further instructions,
-and indicates this by its prompt character, the colon (:).
-In this session, we will append more text to our file,
-print the contents of the buffer, and learn to change the text of a line.
-.SH
-Adding more text to the file
-.PP
-If you want to add more to the end of your
-text you may do so by using the append command to enter text input mode.
-When ``append'' is the first command
-of your editing session,
-the lines you enter
-are placed at the end of the buffer.
-Here we'll use the abbreviation for the append command, ``a'':
-.DS I 1i
-:\|\fBa
-This is text added in Session 2.
-It doesn't mean much here, but
-it does illustrate the editor.
-\|\fB\s+2\&.\s-2
-.R
-.DE
-You may recall that once you enter append mode
-using the ``a'' (or ``append'') command,
-you need to type a line containing only a period (.)
-to exit append mode.
-.SH
-Interrupt
-.PP
-Should you press the \s-2RUB\s+2 key (sometimes labelled \s-2DELETE\s+2)
-while working with edit,
-it will send this message to you:
-.DS I 1i
-Interrupt
-:
-.DE
-Any command that edit might be executing
-is terminated by rub or delete,
-causing edit to prompt you for a new command.
-If you are appending text at the time,
-you will exit from append mode
-and be expected to give another command.
-The line of text you were typing
-when the append command was interrupted
-will not be entered into the buffer.
-.SH
-Making corrections
-.PP
-If while typing the line you hit an incorrect key,
-recall that
-you may delete the incorrect character
-or cancel the entire line of input by erasing in the usual way.
-Refer either
-to the last few pages of Session 1
-if you need to review
-the procedures for making a correction.
-The most important idea to remember is that
-erasing a character or cancelling a line must be done
-before you press the \s-2RETURN\s+2 key.
-.SH
-Listing what's in the buffer (p)
-.PP
-Having appended text to what you wrote in Session 1,
-you might want to see all the lines in the buffer.
-To print the contents of the buffer, type the command:
-.DS I 1i
-:\|\fB1,$p
-.R
-.DE
-The ``1''\(dg
-.FS
-\(dgThe numeral ``one'' is the top left-most key,
-and should not be confused with the letter ``el''.
-.FE
-stands for line 1 of the buffer,
-the ``$'' is a special symbol designating the last line
-of the buffer,
-and ``p'' (or \fBprint\fR) is the command to print from line 1
-to the end of the buffer.
-The command ``1,$p'' gives you:
-.DS I 1i
-This is some sample text.
-And thiss is some more text.
-Text editing is strange, but nice.
-This is text added in Session 2.
-It doesn't mean much here, but
-it does illustrate the editor.
-.DE
-Occasionally, you may accidentally
-type a character that can't be printed,
-which can be done by striking a key
-while the \s-2CTRL\s0 key is pressed.
-In printing lines, edit uses a special notation to
-show the existence of non-printing characters.
-Suppose you had introduced the non-printing character ``control-A''
-into the word ``illustrate''
-by accidently pressing the \s-2CTRL\s0 key while
-typing ``a''.
-This can happen on many terminals
-because the \s-2CTRL\s+2 key and the ``A'' key
-are beside each other.
-If your finger presses between the two keys,
-control-A results.
-When asked to print the contents of the buffer,
-edit would display
-.DS I 1i
-it does illustr^Ate the editor.
-.DE
-To represent the control-A, edit shows ``^A''.
-The sequence ``^'' followed by a capital
-letter stands for the one character
-entered by holding down the \s-2CTRL\s0 key and typing the letter
-which appears after the ``^''.
-We'll soon discuss the commands that can be used
-to correct this typing error.
-.PP
-In looking over the text we see that
-``this'' is typed as ``thiss'' in the second line,
-a deliberate error so we can learn to make corrections.
-Let's correct the spelling.
-.SH
-Finding things in the buffer
-.PP
-In order to change something in the buffer we first need to
-find it.
-We can find ``thiss'' in the text we have
-entered by looking at a listing
-of the lines.
-Physically speaking, we search the lines
-of text looking for ``thiss'' and stop searching when
-we have found it.
-The way to tell edit to search for something
-is to type it inside slash marks:
-.DS I 1i
-:\|\fB/thiss/
-.R
-.DE
-By typing
-.B /thiss/
-and pressing \s-1RETURN\s0,
-you instruct edit to search for ``thiss''.
-If you ask edit to look for a pattern of characters
-which it cannot find in the buffer,
-it will respond ``Pattern not found''.
-When edit finds
-the characters ``thiss'', it will print the line of text
-for your inspection:
-.DS I 1i
-And thiss is some more text.
-.DE
-Edit is now positioned in the buffer at the
-line it just printed,
-ready to make a change in the line.
-.bp
-.SH
-The current line
-.PP
-Edit keeps track of the line in the buffer where it is located
-at all times during an editing session.
-In general, the line that has been most recently
-printed, entered, or changed
-is the current location in the buffer.
-The editor is prepared to make changes
-at the current location in the buffer,
-unless you direct it to another location.
-.PP
-In particular,
-when you bring a file into the buffer,
-you will be located at the last line in the file,
-where the editor left off copying the lines
-from the file to the buffer.
-If your first editing command is ``append'',
-the lines you enter are added
-to the end of the file,
-after the current line \(em
-the last line in the file.
-.PP
-You can refer to your current location in the buffer by the
-symbol
-period (.) usually known by the name ``dot''.
-If you type ``.'' and carriage
-return you will be instructing edit to print the current line:
-.DS I 1i
-:\|\fB\s+2\&.\s-2
-.R
-And thiss is some more text.
-.DE
-.PP
-If you want to know the number of the current line,
-you can type
-.B \&.=
-and press \s-2RETURN\s+2,
-and edit will respond with the line number:
-.DS I 1i
-:\|\fB\s+2.\s-2=
-.R
-2
-.DE
-If you type the number of any line and press \s-2RETURN\s+2,
-edit will position you at that line and
-print its contents:
-.DS I 1i
-:\|\fB2
-.R
-And thiss is some more text.
-.DE
-You should experiment with these commands
-to gain experience in using them to make changes.
-.SH
-Numbering lines (nu)
-.PP
-The
-.B
-number (nu)
-.R
-command is similar to print,
-giving both the number and the text of each printed line.
-To see the number and the text of the current line type
-.DS I 1i
-:\|\fBnu
-.R
-\0\0\0\0\02\0\0And thiss is some more text.
-.DE
-Note that the shortest abbreviation for the number command is
-``nu'' (and not ``n'', which is used for a different command).
-You may specify a range of lines
-to be listed by the number command in the same way that lines
-are specified for print.
-For example, \f31,$nu\f1 lists all lines in the buffer with their
-corresponding line numbers.
-.SH
-Substitute command (s)
-.PP
-Now that you have found the misspelled word,
-you can change it from ``thiss'' to ``this''.
-As far as edit is concerned,
-changing things is a matter of
-substituting one thing for another.
-As
-.I a
-stood for
-.I append,
-so
-.I s
-stands for
-.I substitute.
-We will use the abbreviation ``s'' to reduce the chance
-of mistyping the substitute command.
-This command will instruct edit to make the change:
-.DS I 1i
-\f32s/thiss/this/\f1
-.DE
-We first indicate the line to be changed, line 2,
-and then
-type an ``s'' to indicate we want
-edit to make a substitution.
-Inside the first set of slashes
-are the characters that we want to change,
-followed by the characters to replace them,
-and then a closing slash mark.
-To summarize:
-.DS I 1i
-2s/ \fIwhat is to be changed\fR / \fIwhat to change it to \fR/
-.DE
-If edit finds an exact match of the characters to be
-changed it will make the change
-.B only
-in the first occurrence of the characters.
-If it does not find the characters
-to be changed, it will respond:
-.DS I 1i
-Substitute pattern match failed
-.DE
-indicating that your instructions could not be carried out.
-When edit does find the characters that you want to change,
-it will make the substitution and automatically print
-the changed line, so that you can check that the correct substitution
-was made.
-In the example,
-.DS I 1i
-:\|\fB2s/thiss/this/
-.R
-And this is some more text.
-.DE
-line 2 (and line 2 only) will be searched for the characters
-``thiss'', and when the first exact match is found, ``thiss''
-will be changed to ``this''.
-Strictly speaking, it was not necessary above to
-specify the number of the line to be changed.
-In
-.DS I 1i
-:\|\fBs/thiss/this/
-.R
-.DE
-edit will assume that we mean to change
-the line where we are currently located (``.'').
-In this case,
-the command without a line number would have produced the same result
-because we were already located
-at the line we wished to change.
-.PP
-For another illustration of the substitute command,
-let us choose the line:
-.DS I 1i
-Text editing is strange, but nice.
-.DE
-You can make this line a bit more positive
-by taking out the characters ``strange, but\ '' so the line
-reads:
-.DS I 1i
-Text editing is nice.
-.DE
-A command that will first position edit at the desired line
-and then make the substitution is:
-.DS I 1i
-:\|\fB/strange/s/strange, but //
-.R
-.DE
-.LP
-What we have done here is combine our search with
-our substitution.
-Such combinations are perfectly legal,
-and speed up editing quite a bit
-once you get used to them.
-That is, you do not necessarily have to use
-line numbers to identify a line to edit.
-Instead, you may identify the line you want to change
-by asking edit to search for a specified pattern of letters
-that occurs in that line.
-The parts of the above command are:
-.TS
-.in +1i
-.nr 35 \n(.u
-.nf
-.ds #d .d
-.if \(ts\n(.z\(ts\(ts .ds #d nl
-.nr 80 0
-.nr 38 \w\f3/strange/\fP
-.if \n(80<\n(38 .nr 80 \n(38
-.nr 38 \w\f3s\fP
-.if \n(80<\n(38 .nr 80 \n(38
-.nr 38 \w\f3/strange, but //\fP
-.if \n(80<\n(38 .nr 80 \n(38
-.nr 81 0
-.nr 38 \wtells edit to find the characters ``strange'' in the text
-.if \n(81<\n(38 .nr 81 \n(38
-.nr 38 \wtells edit to make a substitution
-.if \n(81<\n(38 .nr 81 \n(38
-.nr 38 \wsubstitutes nothing at all for the characters ``strange, but ''
-.if \n(81<\n(38 .nr 81 \n(38
-.nr 38 1n
-.nr 79 0
-.nr 40 \n(79+(0*\n(38)
-.nr 80 +\n(40
-.nr 41 \n(80+(3*\n(38)
-.nr 81 +\n(41
-.nr TW \n(81
-.if t .if (\n(TW+\n(.o)>7.75i .tm Table at line 307 file ed2.tbl is too wide - \n(TW units
-.fc  
-.nr #T 0
-.eo
-.de T#
-.ds #d .d
-.if \(ts\n(.z\(ts\(ts .ds #d nl
-.mk ##
-.nr ## -1v
-..
-.ec
-.ta \n(80u \n(81u
-\&\h'|\n(40u'\f3/strange/\fP\h'|\n(41u'tells edit to find the characters ``strange'' in the text
-.ta \n(80u \n(81u
-\&\h'|\n(40u'\f3s\fP\h'|\n(41u'tells edit to make a substitution
-.ta \n(80u \n(81u
-\&\h'|\n(40u'\f3/strange, but //\fP\h'|\n(41u'substitutes nothing at all for the characters ``strange, but ''
-.fc
-.nr T. 1
-.T# 1
-.if \n(35>0 .fi
-.in -1i
-.TE
-.PP
-You should note the space after ``but'' in ``/strange, but /''.
-If you do not indicate that the space is to be taken out,
-your line will read:
-.DS I 1i
-.if t Text editing is nice.
-.if n Text editing is nice.
-.DE
-which looks a little funny
-because of the extra space between ``is'' and ``nice''.
-Again, we realize from this that a blank space
-is a real character to a computer, and in editing text
-we need to be aware of spaces
-within a line just as we would be aware of an ``a'' or
-a ``4''.
-.SH
-Another way to list what's in the buffer (z)
-.PP
-Although the print command is useful for looking at specific lines
-in the buffer,
-other commands may be more convenient for
-viewing large sections of text.
-You can ask to see a screen full of text at a time
-by using the command
-.B z.
-If you type
-.DS I 1i
-:\|\fB1z
-.R
-.DE
-edit will start with line 1 and continue printing lines,
-stopping either when the screen of
-your terminal is full
-or when the last line in the buffer has been printed.
-If you want to read the next segment of text, type the command
-.DS I 1i
-:\|\fBz
-.DE
-If no starting line number is given for the z command,
-printing will start at the ``current'' line, in this case the
-last line printed.
-Viewing lines in the buffer one screen full at a time
-is known as \fIpaging\fR.
-Paging can also be used to print
-a section of text on a hard-copy terminal.
-.SH
-Saving the modified text
-.PP
-This seems to be a good place to pause in our work,
-and so we should end the second session.
-If you (in haste) type ``q'' to quit the session
-your dialogue with edit will be:
-.DS I 1i
-:\|\fBq
-.R
-No write since last change (:quit! overrides)
-:
-.DE
-This is edit's warning that you have not written
-the modified contents of the buffer to disk.
-You run the risk of losing the work you did
-during the editing session since you typed the latest write
-command.
-Because in this lesson we have not written
-to disk at all, everything we have done
-would have been lost
-if edit had obeyed the \fBq\fR command.
-If you did not want to save the work done during
-this editing session, you would have to type ``q!''
-or (``quit!'')
-to confirm that you indeed wanted to end the session
-immediately,
-leaving the file as it was
-after the most recent ``write'' command.
-However,
-since you want to save what
-you have edited, you need to type:
-.DS I 1i
-:\|\fBw
-.R
-"text" 6 lines, 171 characters
-.DE
-and then follow with the commands to quit and logout:
-.DS I 1i
-:\|\fBq
-% \fBlogout\fR
-.DE
-and hang up the phone or turn off the terminal when
-\s-2UNIX\s0 asks for a name.
-Terminals connected to the port selector
-will stop after the logout command,
-and pressing keys on the keyboard will do nothing.
-.sp 1
-.PP
-This is the end of the second session on \s-2UNIX\s0 text editing.
-.bp
-.TL
-Session 3
-.SH
-Bringing text into the buffer (e)
-.PP
-Login to \s-2UNIX\s0 and make contact with edit.
-You should try to login without
-looking at the notes, but if you must
-then by all means do.
-.PP
-Did you remember to give the name of the file
-you wanted to edit?
-That is, did you type
-.DS I 1i
-% \fBedit text\fR
-.DE
-or simply
-.DS I 1i
-% \fBedit\fR
-.DE
-Both ways get you in contact with edit, but the first way
-will bring a copy of the file named ``text'' into
-the buffer.
-If you did forget to tell edit the name of your file,
-you can get it into the buffer by
-typing:
-.DS I 1i
-:\|\fBe text
-.R
-"text" 6 lines, 171 characters
-.DE
-The command
-.B edit,
-which may be abbreviated \fBe\fR,
-tells edit that you want
-to erase anything that might already be in
-the buffer and bring a copy of the file ``text'' into the buffer
-for editing.
-You may also use the edit (e) command to change files in
-the middle of an editing session,
-or to give edit the name of a new file that you want to create.
-Because the edit command clears the buffer,
-you will receive a warning if you try to edit a new file without
-having saved a copy of the old file.
-This gives you a chance to write the contents of the buffer to disk
-before editing the next file.
-.SH
-Moving text in the buffer (m)
-.PP
-Edit allows you to move lines of text
-from one location in the buffer to another
-by means of the
-.B move
-(\fBm\fR) command.
-The first two examples are for illustration only,
-though after you have read this Session
-you are welcome to return to them for practice.
-The command
-.DS I 1i
-:\|\fB2,4m$
-.R
-.DE
-directs edit to move lines 2, 3, and 4
-to the end of the buffer ($).
-The format for the move command is that you specify
-the first line to be moved, the last line to be moved,
-the move command ``m'', and the line after which
-the moved text is to be placed.
-So,
-.DS I 1i
-:\|\fB1,3m6
-.R
-.DE
-would instruct edit to move lines 1 through 3 (inclusive)
-to a location after line 6 in the buffer.
-To move only one line, say, line 4,
-to a location in the buffer after line 5,
-the command would be ``4m5''.
-.PP
-Let's move some text using the command:
-.DS I 1i
-:\|\fB5,$m1
-.R
-2 lines moved
-it does illustrate the editor.
-.DE
-After executing a command that moves more than one line of the buffer,
-edit tells how many lines were affected by the move
-and prints the last moved line for your inspection.
-If you want to see more than just the last line,
-you can then
-use the print (p), z, or number (nu) command to view more text.
-The buffer should now contain:
-.DS I 1i
-This is some sample text.
-It doesn't mean much here, but
-it does illustrate the editor.
-And this is some more text.
-Text editing is nice.
-This is text added in Session 2.
-.DE
-You can restore the original order by typing:
-.DS I 1i
-:\|\fB4,$m1
-.R
-.DE
-or, combining context searching and the move command:
-.DS I 1i
-:\|\fB/And this is some/,/This is text/m/This is some sample/
-.R
-.DE
-(Do not type both examples here!)
-The problem with combining context searching
-with the move command
-is that your chance of making a typing error
-in such a long command is greater than
-if you type line numbers.
-.SH
-Copying lines (copy)
-.PP
-The
-.B copy
-command
-is used to make a second copy of specified lines,
-leaving the original lines where they were.
-Copy
-has the same format as the move command, for example:
-.DS I 1i
-:\|\fB2,5copy $
-.R
-.DE
-makes a copy of lines 2 through 5,
-placing the added lines after the buffer's end ($).
-Experiment with the copy command
-so that you can become familiar with how it works.
-Note that the shortest abbreviation for copy is
-\f3co\f1 (and
-not the letter ``c'', which has another meaning).
-.SH
-Deleting lines (d)
-.PP
-Suppose you want to delete
-the line
-.DS I 1i
-This is text added in Session 2.
-.DE
-from the buffer.
-If you know the number of the line to be deleted,
-you can type
-that number followed by
-\fBdelete\fR or \fBd\fR.
-This example deletes line 4,
-which is ``This is text added in Session 2.''
-if you typed the commands
-suggested so far.
-.DS I 1i
-:\|\fB4d
-.R
-It doesn't mean much here, but
-.DE
-Here ``4'' is the number of the line to be deleted,
-and ``delete'' or ``d'' is the command to delete the line.
-After executing the delete command,
-edit prints the line that has become the current line (``.'').
-.PP
-If you do not happen to know the line number
-you can search for the line and then delete it using this
-sequence of commands:
-.DS I 1i
-:\|\fB/added in Session 2./
-.R
-This is text added in Session 2.
-:\|\fBd
-.R
-It doesn't mean much here, but
-.DE
-The ``/added in Session 2./''
-asks edit to locate and print
-the line containing the indicated text,
-starting its search at the current line
-and moving line by line
-until it finds the text.
-Once you are sure that you have correctly specified the line
-you want to delete,
-you can enter the delete (d) command.
-In this case it is not necessary to
-specify a line number before the ``d''.
-If no line number is given,
-edit deletes the current line (``.''),
-that is, the line found by our search.
-After the deletion, your buffer should contain:
-.DS I 1i
-This is some sample text.
-And this is some more text.
-Text editing is nice.
-It doesn't mean much here, but
-it does illustrate the editor.
-And this is some more text.
-Text editing is nice.
-This is text added in Session 2.
-It doesn't mean much here, but
-.DE
-To delete both lines 2 and 3:
-.DS I 1i
-And this is some more text.
-Text editing is nice.
-.DE
-you type
-.DS I 1i
-:\|\f32,3d\f1
-2 lines deleted
-.DE
-which specifies the range of lines from 2 to 3,
-and the operation on those lines \(em ``d'' for delete.
-If you delete more than one line
-you will receive a message
-telling you the number of lines deleted,
-as indicated in the example above.
-.PP
-The previous example assumes that you know the line numbers for
-the lines to be deleted.
-If you do not you might combine the search command
-with the delete command:
-.DS I 1i
-:\|\fB/And this is some/,/Text editing is nice./d
-.R
-.DE
-.SH
-A word or two of caution
-.PP
-In using the search function to locate lines to
-be deleted you should be
-.B
-absolutely sure
-.R
-the characters you give as the basis for the search
-will take edit to the line you want deleted.
-Edit will search for the first
-occurrence of the characters starting from where
-you last edited \-
-that is, from the line you see printed if you type dot (.).
-.PP
-A search based on too few
-characters may result in the wrong lines being deleted,
-which edit will do as easily as if you had meant it.
-For this reason, it is usually safer
-to specify the search and then delete in two separate steps,
-at least until you become familiar enough with using the editor
-that you understand how best to specify searches.
-For a beginner it is not a bad idea to double-check
-each command before pressing \s-2RETURN\s+2 to send the command on its way.
-.SH
-Undo (u) to the rescue
-.PP
-The
-.B
-undo (u)
-.R
-command has the ability to
-reverse the effects of the last command that changed the buffer.
-To undo the previous command, type
-``u'' or ``undo''.
-Undo can rescue
-the contents of the buffer from many an unfortunate mistake.
-However, its powers are not unlimited,
-so it is still wise to be reasonably
-careful about the commands you give.
-.PP
-It is possible to undo only commands which
-have the power to change the buffer \(em for example,
-delete, append, move, copy, substitute, and even undo itself.
-The commands write (w) and edit (e), which interact with disk files,
-cannot be undone, nor can commands that do not change
-the buffer, such as print.
-Most importantly,
-the
-.B only
-command that can be reversed by undo
-is the
-last ``undo-able'' command you typed.
-You can use control-H and @ to change
-commands while you are typing them,
-and undo to reverse the effect of the commands
-after you have typed them and pressed \s-2RETURN\s+2.
-.PP
-To illustrate,
-let's issue an undo command.
-Recall that the last buffer-changing command we gave deleted
-the lines formerly numbered 2 and 3.
-Typing undo at this moment will reverse the effects
-of the deletion, causing those two lines to be
-replaced in the buffer.
-.DS I 1i
-:\|\fBu
-.R
-2 more lines in file after undo
-And this is some more text.
-.DE
-Here again, edit informs you if the command affects more
-than one line,
-and prints
-the text of the line which is now ``dot'' (the current line).
-.SH
-More about the dot (.) and buffer end ($)
-.PP
-The function assumed by the symbol dot depends on its context.
-It can be used:
-.IP
-1. to exit from append mode; we type dot (and only a dot) on
-a line and press \s-2RETURN\s+2;
-.IP
-2. to refer to the line we are at in the buffer.
-.LP
-Dot can also be combined with the equal sign to get
-the number of the line currently being edited:
-.DS I 1i
-:\|\fB\&.=
-.R
-.DE
-If we type ``\fB.\fR='' we are asking for the number of the line,
-and if we type ``\fB.\fR'' we are asking for the text of the line.
-.PP
-In this editing session and the last, we used the dollar
-sign to indicate the end of the buffer
-in commands such as print, copy, and move.
-The dollar sign as a command asks edit to print the last
-line in the buffer.
-If the dollar sign is combined with the equal sign (\f3$=\f1)
-edit will print the line number corresponding to the
-last line in the buffer.
-.PP
-``\fB.\fR'' and ``$'', then, represent line numbers.
-Whenever appropriate, these symbols can be used in
-place of line numbers in commands.
-For example
-.DS I 1i
-:\|\fB\s+2.\s-2,$d
-.R
-.DE
-instructs edit to delete all lines from the current line (\fB.\fR)
-to the end of the buffer.
-.SH
-Moving around in the buffer (+ and \-)
-.PP
-When you are editing
-you often want
-to go back and re-read a previous line.
-You could specify a context search for a line you want to
-read if you remember some of its text,
-but if you simply want to see what was written a few, say 3, lines
-ago, you can type
-.DS I 1i
-\-3p
-.DE
-This tells edit to move back to a position 3 lines
-before the current line (.)
-and print that line.
-You can move forward in the buffer similarly:
-.DS I 1i
-+2p
-.DE
-instructs edit to print the line that is 2
-ahead of your current position.
-.PP
-You may use ``+'' and ``\-'' in any command where edit
-accepts line numbers.
-Line numbers specified with ``+'' or ``\-''
-can be combined to print a range of lines.
-The command
-.DS I 1i
-:\|\fB\-1,+2copy$
-.R
-.DE
-makes a copy of 4 lines: the current line, the line before it,
-and the two after it.
-The copied lines will be placed after the last line
-in the buffer ($),
-and the original lines referred to by ``\-1'' and ``+2''
-remain where they are.
-.PP
-Try typing only ``\-''; you will move back one line just as
-if you had typed ``\-1p''.
-Typing the command ``+'' works similarly.
-You might also try typing a few plus or minus signs in a row
-(such as ``+++'') to see edit's response.
-Typing \s-2RETURN\s+2 alone on a line is the equivalent
-of typing ``+1p''; it will move you one line ahead in the buffer
-and print that line.
-.PP
-If you are at the last line of the buffer and try
-to move further ahead, perhaps by typing a ``+'' or
-a carriage return alone on the line,
-edit will remind you that you are at the end of the buffer:
-.sp
-.nf
-.ti 1i
-At end-of-file
-.br
-or
-.ti 1i
-Not that many lines in buffer
-.fi
-.LP
-Similarly, if you try to move to a position before the first line,
-edit will print one of these messages:
-.sp
-.nf
-.ti 1i
-Nonzero address required on this command
-.br
-or
-.ti 1i
-Negative address \- first buffer line is 1
-.fi
-.LP
-The number associated with a buffer line is the line's ``address'',
-in that it can be used to locate the line.
-.SH
-Changing lines (c)
-.PP
-You can also delete certain lines and
-insert new text in their place.
-This can be accomplished easily with the
-.B "change (c)"
-command.
-The change command instructs edit to delete specified lines
-and then switch to text input mode to
-accept the text that will replace them.
-Let's say you want to change the first two lines in the buffer:
-.DS I 1i
-This is some sample text.
-And this is some more text.
-.DE
-to read
-.DS I 1i
-This text was created with the \s-2UNIX\s0 text editor.
-.DE
-To do so, you type:
-.DS I 1i
-:\|\fB1,2c
-.R
-2 lines changed
-.B
-This text was created with the \s-2UNIX\s0 text editor.
-\s+2\&.\s-2
-.R
-:
-.DE
-In the command
-.B 1,2c
-we specify that we want to change
-the range of lines beginning with 1 and ending with 2
-by giving line numbers as with the print command.
-These lines will be deleted.
-After you type \s-2RETURN\s+2 to end the change command,
-edit notifies you if more than one line will be changed
-and places you in text input mode.
-Any text typed on the following lines will be inserted into
-the position where lines were deleted by the change command.
-.B
-You will remain in text input mode until you exit in the usual way,
-by typing a period alone on a line.
-.R
-Note that the number of lines added to the buffer need not be
-the same as the number of lines deleted.
-.sp 1
-.PP
-This is the end of the third session on text editing with \s-2UNIX\s0.
-.bp
-.SH
-.ce 1
-\s+2Session 4\s0
-.sp
-.PP
-This lesson covers several topics, starting with
-commands that apply throughout the buffer,
-characters with special meanings,
-and how to issue \s-2UNIX\s0 commands while in the editor.
-The next topics deal with files:
-more on reading and writing,
-and methods of recovering files lost in a crash.
-The final section suggests sources of further information.
-.SH
-Making commands global (g)
-.PP
-One disadvantage to the commands we have used for
-searching or substituting is that if you
-have a number of instances of a word to change
-it appears that you have to type the command
-repeatedly, once for
-each time the change needs to be made.
-Edit, however, provides a way to make commands
-apply to the entire contents of the buffer \-
-the
-.B
-global (g)
-.R
-command.
-.PP
-To print all lines
-containing a certain sequence of characters
-(say, ``text'')
-the command is:
-.DS I 1i
-:\|\fBg/text/p
-.R
-.DE
-The ``g'' instructs edit to
-make a global search for all lines
-in the buffer containing the characters ``text''.
-The ``p'' prints the lines found.
-.PP
-To issue a global command, start by typing a ``g'' and then a search
-pattern identifying
-the lines to be affected.
-Then, on the same line, type the command to be
-executed for the identified lines.
-Global substitutions are frequently useful.
-For example,
-to change all instances of the word ``text'' to the word ``material''
-the command would be a combination of the global search and the
-substitute command:
-.DS I 1i
-:\|\fBg/text/s/text/material/g
-.R
-.DE
-Note the ``g'' at the end of the global command,
-which instructs edit to change
-each and every instance of ``text'' to ``material''.
-If you do not type the ``g'' at the end of the command
-only the
-.I first
-instance of ``text'' \fIin each line\fR will be changed
-(the normal result of the substitute command).
-The ``g'' at the end of the command is independent of the ``g''
-at the beginning.
-You may give a command such as:
-.DS I 1i
-:\|\fB5s/text/material/g
-.R
-.DE
-to change every instance of ``text'' in line 5 alone.
-Further, neither command will change ``text'' to ``material''
-if ``Text'' begins with a capital rather than a lower-case
-.I t.
-.PP
-Edit does not automatically print the lines modified by a
-global command.
-If you want the lines to be printed, type a ``p''
-at the end of the global command:
-.DS I 1i
-:\|\fBg/text/s/text/material/gp
-.R
-.DE
-You should be careful
-about using the global command in combination with any other \-
-in essence, be sure of what you are telling edit to do
-to the entire buffer.
-For example,
-.DS I 1i
-:\|\fBg/ /d
-.R
-72 less lines in file after global
-.DE
-will delete every line containing a blank anywhere in it.
-This could adversely affect
-your document, since most lines have spaces between words
-and thus would be deleted.
-After executing the global command,
-edit will print a warning if the command added or deleted more than one line.
-Fortunately, the undo command can reverse
-the effects of a global command.
-You should experiment with the global command
-on a small file of text to see what it can do for you.
-.SH
-More about searching and substituting
-.PP
-In using slashes to identify a character string
-that we want to search for or change,
-we have always specified the exact characters.
-There is a less tedious way to
-repeat the same string of characters.
-To change ``text'' to ``texts'' we may type either
-.DS I 1i
-:\|\fB/text/s/text/texts/
-.R
-.DE
-as we have done in the past,
-or a somewhat abbreviated command:
-.DS I 1i
-:\|\fB/text/s//texts/
-.R
-.DE
-In this example, the characters to be changed
-are not specified \-
-there are no characters, not even a space,
-between the two slash marks
-that indicate what is to be changed.
-This lack of characters between the slashes
-is taken by the editor to mean
-``use the characters we last searched for as the characters to be changed.''
-.PP
-Similarly, the last context search may be repeated
-by typing a pair of slashes with nothing between them:
-.DS I 1i
-:\|\fB/does/
-.R
-It doesn't mean much here, but
-:\|\fB//
-.R
-it does illustrate the editor.
-.DE
-(You should note that the search command found the characters ``does''
-in the word ``doesn't'' in the first search request.)
-Because no characters are specified for the second search,
-the editor scans the buffer for the next occurrence of the
-characters ``does''.
-.PP
-Edit normally searches forward through the buffer,
-wrapping around from the end of the buffer to the beginning,
-until the specified character string is found.
-If you want to search in the reverse direction,
-use question marks (?) instead of slashes
-to surround the characters you are searching for.
-.PP
-It is also possible
-to repeat the last substitution
-without having to retype the entire command.
-An ampersand (&) used as a command
-repeats the most recent substitute command,
-using the same search and replacement patterns.
-After altering the current line by typing
-.DS I 1i
-:\|\fBs/text/texts/
-.R
-.DE
-you type
-.DS I 1i
-:\|\fB/text/&
-.R
-.DE
-or simply
-.DS I 1i
-:\|\fB//&
-.R
-.DE
-to make the same change on the next line in the buffer
-containing the characters ``text''.
-.SH
-Special characters
-.PP
-Two characters have special meanings when
-used in specifying searches: ``$'' and ``^''.
-``$'' is taken by the editor to mean ``end of the line''
-and is used to identify strings
-that occur at the end of a line.
-.DS I 1i
-:\|\fBg/text.$/s//material./p
-.R
-.DE
-tells the editor to search for all lines ending in ``text.''
-(and nothing else, not even a blank space),
-to change each final ``text.'' to ``material.'',
-and print the changed lines.
-.PP
-The symbol ``^'' indicates the beginning of a line.
-Thus,
-.DS I 1i
-:\|\fBs/^/1. /
-.R
-.DE
-instructs the editor to insert ``1.'' and a space at the beginning
-of the current line.
-.PP
-The characters ``$'' and ``^'' have special meanings only in the context
-of searching.
-At other times, they are ordinary characters.
-If you ever need to search for a character that has a special meaning,
-you must indicate that the
-character is to lose temporarily
-its special significance by typing another special character,
-the backslash (\\), before it.
-.DS I 1i
-:\|\fBs/\\\\\&$/dollar/
-.R
-.DE
-looks for the character ``$'' in the current
-line and replaces it by the word ``dollar''.
-Were it not for the backslash, the ``$'' would have represented
-``the end of the line'' in your search
-rather than the character ``$''.
-The backslash retains its special significance
-unless it is preceded by another backslash.
-.SH
-Issuing \s-2UNIX\s0 commands from the editor
-.PP
-After creating several files with the editor,
-you may want to delete files
-no longer useful to you or ask for a list of your files.
-Removing and listing files are not functions of the editor,
-and so they require the use of \s-2UNIX\s0 system commands
-(also referred to as ``shell'' commands, as
-``shell'' is the name of the program that processes \s-2UNIX\s0 commands).
-You do not need to quit the editor to execute a \s-2UNIX\s0 command
-as long as you indicate that it
-is to be sent to the shell for execution.
-To use the \s-2UNIX\s0 command
-.B rm
-to remove the file named ``junk'' type:
-.DS I 1i
-:\|\fB!rm junk
-.R
-!
-:
-.DE
-The exclamation mark (!)
-indicates that the rest of the line is to be processed as a shell command.
-If the buffer contents have not been written since the last change,
-a warning will be printed before the command is executed:
-.DS I 1i
-[No write since last change]
-.DE
-The editor prints a ``!'' when the command is completed.
-Other tutorials describe useful features of the system,
-of which an editor is only one part.
-.SH
-Filenames and file manipulation
-.PP
-Throughout each editing session,
-edit keeps track of the name of the file being edited as the
-.I "current filename."
-Edit remembers as the current filename the name given
-when you entered the editor.
-The current filename changes whenever the edit (e) command
-is used to specify a new file.
-Once edit has recorded a current filename,
-it inserts that name into any command where a filename has been omitted.
-If a write command does not specify a file,
-edit, as we have seen, supplies the current filename.
-If you are editing a file named ``draft3'' having 283 lines in it,
-you can have the editor write onto a different file
-by including its name in the write command:
-.DS I 1i
-:\fB\|w chapter3
-.R
-"chapter3" [new file] 283 lines, 8698 characters
-.DE
-The current filename remembered by the editor
-.I
-will not be changed as a result of the write command.
-.R
-Thus, if the next write command
-does not specify a name,
-edit will write onto the current file (``draft3'')
-and not onto the file ``chapter3''.
-.SH
-The file (f) command
-.PP
-To ask for the current filename, type
-.B file
-(or
-.B f ).
-In response, the editor provides current information about the buffer,
-including the filename, your current position, the number of
-lines in the buffer,
-and the percent of the distance through the file
-your current location is.
-.DS I 1i
-:\|\fBf
-.R
-"text" [Modified] line 3 of 4 --75%--
-.DE
-.\"The expression ``[Edited]'' indicates that the buffer contains
-.\"either the editor's copy of the existing file ``text''
-.\"or a file which you are just now creating.
-If the contents of the buffer have changed
-since the last time the file was written,
-the editor will tell you that the file has been ``[Modified]''.
-After you save the changes by writing onto a disk file,
-the buffer will no longer be considered modified:
-.DS I 1i
-:\|\fBw
-.R
-"text" 4 lines, 88 characters
-:\|\fBf
-.R
-"text" line 3 of 4 --75%--
-.DE
-.SH
-Reading additional files (r)
-.PP
-The
-\f3read (r)\f1 command allows you to add the contents of a file
-to the buffer
-at a specified location,
-essentially copying new lines
-between two existing lines.
-To use it, specify the line after which the new text will be placed,
-the \f3read (r)\f1 command,
-and then the name of the file.
-If you have a file named ``example'', the command
-.DS I 1i
-:\|\fB$r example
-.R
-"example" 18 lines, 473 characters
-.DE
-reads the file ``example''
-and adds it to the buffer after the last line.
-The current filename is not changed by the read command.
-.SH
-Writing parts of the buffer
-.PP
-The
-.B
-write (w)
-.R
-command can write all or part of the buffer
-to a file you specify.
-We are already familiar with
-writing the entire contents of the
-buffer to a disk file.
-To write only part of the buffer onto a file,
-indicate the beginning and ending lines before the write command,
-for example
-.DS I 1i
-:\|\fB45,$w ending
-.R
-.DE
-Here all lines from 45 through the end of the buffer
-are written onto the file named
-.I ending.
-The lines remain in the buffer
-as part of the document you are editing,
-and you may continue to edit the entire buffer.
-Your original file is unaffected
-by your command to write part of the buffer
-to another file.
-Edit still remembers whether you have saved changes to the buffer
-in your original file or not.
-.SH
-Recovering files
-.PP
-Although it does not happen very often,
-there are times \s-2UNIX\s+2 stops working
-because of some malfunction.
-This situation is known as a \fIcrash\fR.
-Under most circumstances,
-edit's crash recovery feature
-is able to save work to within a few lines of changes
-before a crash (or an accidental phone hang up).
-If you lose the contents of an editing buffer in a system crash,
-you will normally receive mail when you login that gives
-the name of the recovered file.
-To recover the file,
-enter the editor and type the command
-.B recover
-(\fBrec\fR),
-followed by the name of the lost file.
-For example,
-to recover the buffer for an edit session
-involving the file ``chap6'', the command is:
-.DS I 1i
-.R
-:\|\fBrecover chap6
-.R
-.DE
-Recover is sometimes unable to save the entire buffer successfully,
-so always check the contents of the saved buffer carefully
-before writing it back onto the original file.
-For best results,
-write the buffer to a new file temporarily
-so you can examine it without risk to the original file.
-Unfortunately,
-you cannot use the recover command
-to retrieve a file you removed
-using the shell command \f3rm\f1.
-.SH
-Other recovery techniques
-.PP
-If something goes wrong when you are using the editor,
-it may be possible to save your work by using the command
-.B preserve
-(\fBpre\fR),
-which saves the buffer as if the system had crashed.
-If you are writing a file and you get the message
-``Quota exceeded'', you have tried to use more disk storage
-than is allotted to your account.
-.I
-Proceed with caution
-.R
-because it is likely that only a part
-of the editor's buffer is now present in the file you tried to write.
-In this case you should use the shell escape from the editor (!)
-to remove some files you don't need and try to write
-the file again.
-If this is not possible and you cannot find someone to help you,
-enter the command
-.DS I 1i
-:\|\fBpreserve
-.R
-.DE
-and wait for the reply,
-.DS I 1i
-File preserved.
-.DE
-If you do not receive this reply,
-seek help immediately.
-Do not simply leave the editor.
-If you do, the buffer will be lost,
-and you may not be able to save your file.
-If the reply is ``File preserved.''
-you can leave the editor
-(or logout)
-to remedy the situation.
-After a preserve, you can use the recover command
-once the problem has been corrected,
-or the \fB\-r\fR option of the edit command
-if you leave the editor and want to return.
-.PP
-If you make an undesirable change to the buffer
-and type a write command before discovering your mistake,
-the modified version will replace any previous version of the file.
-Should you ever lose a good version of a document in this way,
-do not panic and leave the editor.
-As long as you stay in the editor,
-the contents of the buffer remain accessible.
-Depending on the nature of the problem,
-it may be possible
-to restore the buffer to a more complete
-state with the undo command.
-After fixing the damaged buffer, you can again write the file
-to disk.
-.SH
-Further reading and other information
-.PP
-Edit is an editor designed for beginning and casual users.
-It is actually a version of a more powerful editor called
-.I ex.
-These lessons are intended to introduce you to the editor
-and its more commonly-used commands.
-We have not covered all of the editor's commands,
-but a selection of commands
-that should be sufficient to accomplish most of your editing tasks.
-You can find out more about the editor in the
-.I
-Ex Reference Manual,
-.R
-which is applicable to both
-.I ex
-and
-.I edit.
-One way to become familiar with the manual is to begin by reading
-the description of commands that you already know.
-.bd I 3
-.SH
-Using
-.I ex
-.fl
-.bd I
-.PP
-As you become more experienced with using the editor,
-you may still find that edit continues to meet your needs.
-However, should you become interested in using
-.I ex,
-it is easy to switch.
-To begin an editing session with
-.I ex,
-use the name
-.B ex
-in your command instead of
-.B edit.
-.PP
-Edit commands also work in
-.I ex,
-but the editing environment is somewhat different.
-You should be aware of a few differences
-between
-.I ex
-and
-.I edit.
-In edit, only the characters ``^'', ``$'', and ``\\'' have
-special meanings in searching the buffer
-or indicating characters to be changed by a substitute command.
-Several additional characters have special
-meanings in ex, as described in the
-.I
-Ex Reference Manual.
-.R
-Another feature of the edit environment prevents users from
-accidently entering two alternative modes of editing,
-.I open
-and
-.I visual,
-in which
-the editor behaves quite differently from normal command mode.
-If you are using ex and you encounter strange behavior,
-you may have accidently entered open mode by typing ``o''.
-Type the \s-2ESC\s0 key and then a ``Q''
-to get out of open or visual mode and back into
-the regular editor command mode.
-The document
-.I
-An Introduction to Display Editing with Vi\|\|
-.R
-provide full details of visual mode.
-.bp
-.SH
-.ce 1
-\s+2Index\s0
-.LP
-.sp 2
-.2C
-.nf
-addressing, \fIsee\fR line numbers
-ampersand, 20
-append mode, 6-7
-append (a) command, 6, 7, 9
-``At end of file'' (message), 18
-backslash (\\), 21
-buffer, 3
-caret (^), 10, 20
-change (c) command, 18
-command mode, 5-6
-``Command not found'' (message), 6
-context search, 10-12, 19-21
-control characters (``^'' notation), 10
-control-H, 7
-copy (co) command, 15
-corrections, 7, 16
-current filename, 21
-current line (\|.\|), 11, 17
-delete (d) command, 15-16
-dial-up, 5
-disk, 3
-documentation, 3, 23
-dollar ($), 10, 11, 17, 20-21
-dot (\f3\|.\|\f1) 11, 17
-edit (text editor), 3, 5, 23
-edit (e) command, 5, 9, 14
-editing commands:
-.in +.25i
-append (a), 6, 7, 9
-change (c), 18
-copy (co), 15
-delete (d), 15-16
-edit (text editor), 3, 5, 23
-edit (e), 5, 9, 14
-file (f), 21-22
-global (g), 19
-move (m), 14-15
-number (nu), 11
-preserve (pre), 22-23
-print (p), 10
-quit (q), 8, 13
-read (r), 22
-recover (rec), 22, 23
-substitute (s), 11-12, 19, 20
-undo (u), 16-17, 23
-write (w), 8, 13, 21, 22
-z, 12-13
-! (shell escape), 21
-$=, 17
-+, 17
-\-, 17
-//, 12, 20
-??, 20
-\&., 11, 17
-\&.=, 11, 17
-.in -.25i
-entering text, 3, 6-7
-erasing
-.in +.25i
-characters (^H), 7
-lines (@), 7
-.in -.25i
-error corrections, 7, 16
-ex (text editor), 23
-\fIEx Reference Manual\fR, 23
-exclamation (!), 21
-file, 3
-file (f) command, 21-22
-file recovery, 22-23
-filename, 3, 21
-global (g) command, 19
-input mode, 6-7
-Interrupt (message), 9
-line numbers, \fIsee also\fR current line
-.in +.25i
-dollar sign ($), 10, 11, 17
-dot (\|.\|), 11, 17
-relative (+ and \-), 17
-.in -.25i
-list, 10
-logging in, 4-6
-logging out, 8
-``Login incorrect'' (message), 5
-minus (\-), 17
-move (m) command, 14-15
-``Negative address\(emfirst buffer line is 1'' (message), 18
-``No current filename'' (message), 8
-``No such file or directory'' (message), 5, 6
-``No write since last change'' (message), 21
-non-printing characters, 10
-``Nonzero address required'' (message), 18
-``Not an editor command'' (message), 6
-``Not that many lines in buffer'' (message), 18
-number (nu) command, 11
-password, 5
-period (\|.\|), 11, 17
-plus (+), 17
-preserve (pre) command, 22-23
-print (p) command, 10
-program, 3
-prompts
-.in .25i
-% (\s-2UNIX\s0), 5
-: (edit), 5, 6, 7
-\0 (append), 7
-.in -.25i
-question (?), 20
-quit (q) command, 8, 13
-read (r) command, 22
-recover (rec) command, 22, 23
-recovery, \fIsee\fR\| file recovery
-references, 3, 23
-remove (rm) command, 21, 22
-reverse command effects (undo), 16-17, 23
-searching, 10-12, 19-21
-shell, 21
-shell escape (!), 21
-slash (/), 11-12, 20
-special characters (^, $, \\), 10, 11, 17, 20-21
-substitute (s) command, 11-12, 19, 20
-terminals, 4-5
-text input mode, 7
-undo (u) command, 16-17, 23
-\s-1UNIX\s0, 3
-write (w) command, 8, 13, 21, 22
-z command, 12-13
-
diff --git a/usr.bin/vi/USD.doc/exref/Makefile b/usr.bin/vi/USD.doc/exref/Makefile
deleted file mode 100644
index 5976e8e986f..00000000000
--- a/usr.bin/vi/USD.doc/exref/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 6/8/93
-
-DIR= usd/13.ex
-SRCS= ex.rm
-EXTRA= ex.summary
-MACROS= -msU
-CLEANFILES=summary.*
-
-paper.ps: ${SRCS} summary.ps
- ${ROFF} ${SRCS} > ${.TARGET}
-
-summary.ps: ex.summary
- ${TBL} ex.summary | ${ROFF} > ${.TARGET}
-
-.include <bsd.doc.mk>
diff --git a/usr.bin/vi/USD.doc/exref/ex.rm b/usr.bin/vi/USD.doc/exref/ex.rm
deleted file mode 100644
index 79670c2cf66..00000000000
--- a/usr.bin/vi/USD.doc/exref/ex.rm
+++ /dev/null
@@ -1,2230 +0,0 @@
-.\" Copyright (c) 1980, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)ex.rm 8.1 (Berkeley) 6/8/93
-.\"
-.EH 'USD:13-%''Ex Reference Manual'
-.OH 'Ex Reference Manual''USD:13-%'
-.de ZP
-.nr pd \\n()P
-.nr )P 0
-.if \\n(.$=0 .IP
-.if \\n(.$=1 .IP "\\$1"
-.if \\n(.$>=2 .IP "\\$1" "\\$2"
-.nr )P \\n(pd
-.rm pd
-..
-.de LC
-.br
-.sp .1i
-.ne 4
-.LP
-.ta 4.0i
-..
-.bd S B 3
-.\".RP
-.TL
-Ex Reference Manual
-.br
-Version 3.7
-.AU
-William Joy
-.AU
-Mark Horton
-.AI
-Computer Science Division
-Department of Electrical Engineering and Computer Science
-University of California, Berkeley
-Berkeley, Ca. 94720
-.AB
-.I Ex
-a line oriented text editor, which supports both command and display
-oriented editing.
-This reference manual describes the command oriented part of
-.I ex;
-the display editing features of
-.I ex
-are described in
-.I "An Introduction to Display Editing with Vi."
-Other documents about the editor include the introduction
-.I "Edit: A tutorial",
-the
-.I "Ex/edit Command Summary",
-and a
-.I "Vi Quick Reference"
-card.
-.AE
-.NH 1
-Starting ex
-.PP
-.FS
-The financial support of an \s-2IBM\s0 Graduate Fellowship and the National
-Science Foundation under grants MCS74-07644-A03 and MCS78-07291 is gratefully
-acknowledged.
-.FE
-Each instance of the editor has a set of options,
-which can be set to tailor it to your liking.
-The command
-.I edit
-invokes a version of
-.I ex
-designed for more casual or beginning
-users by changing the default settings of some of these options.
-To simplify the description which follows we
-assume the default settings of the options.
-.PP
-When invoked,
-.I ex
-determines the terminal type from the \s-2TERM\s0 variable in the environment.
-It there is a \s-2TERMCAP\s0 variable in the environment, and the type
-of the terminal described there matches the \s-2TERM\s0 variable,
-then that description
-is used. Also if the \s-2TERMCAP\s0 variable contains a pathname (beginning
-with a \fB/\fR) then the editor will seek the description of the terminal
-in that file (rather than the default /etc/termcap).
-If there is a variable \s-2EXINIT\s0 in the environment, then the editor
-will execute the commands in that variable,
-otherwise if there is a file
-.I \&.exrc
-in your \s-2HOME\s0 directory
-.I ex
-reads commands from that file, simulating a
-.I source
-command.
-Option setting commands placed in
-\s-2EXINIT\s0 or
-.I \&.exrc
-will be executed before each editor session.
-.PP
-A command to enter
-.I ex
-has the following prototype:\(dg
-.FS
-\(dg Brackets `[' `]' surround optional parameters here.
-.FE
-.DS
-\fBex\fP [ \fB\-\fP ] [ \fB\-v\fP ] [ \fB\-t\fP \fItag\fP ] [ \fB\-r\fP ] [ \fB\-l\fP ] [ \fB\-w\fP\fIn\fP ] [ \fB\-x\fP ] [ \fB\-R\fP ] [ \fB+\fP\fIcommand\fP ] name ...
-.DE
-The most common case edits a single file with no options, i.e.:
-.DS
-\fBex\fR name
-.DE
-The
-.B \-
-command line option
-option suppresses all interactive-user feedback
-and is useful in processing editor scripts in command files.
-The
-.B \-v
-option is equivalent to using
-.I vi
-rather than
-.I ex.
-The
-.B \-t
-option is equivalent to an initial
-.I tag
-command, editing the file containing the
-.I tag
-and positioning the editor at its definition.
-The
-.B \-r
-option is used in recovering after an editor or system crash,
-retrieving the last saved version of the named file or,
-if no file is specified,
-typing a list of saved files.
-The
-.B \-l
-option sets up for editing \s-2LISP\s0, setting the
-.I showmatch
-and
-.I lisp
-options.
-The
-.B \-w
-option sets the default window size to
-.I n,
-and is useful on dialups to start in small windows.
-The
-.B \-x
-option causes
-.I ex
-to prompt for a
-.I key ,
-which is used to encrypt and decrypt the contents of the file,
-which should already be encrypted using the same key,
-see
-.I crypt (1).
-The
-.B \-R
-option sets the
-.I readonly
-option at the start.
-.I Name
-arguments indicate files to be edited.
-An argument of the form
-\fB+\fIcommand\fR
-indicates that the editor should begin by executing the specified command.
-If
-.I command
-is omitted, then it defaults to ``$'', positioning the editor at the last
-line of the first file initially. Other useful commands here are scanning
-patterns of the form ``/pat'' or line numbers, e.g. ``+100'' starting
-at line 100.
-.NH 1
-File manipulation
-.NH 2
-Current file
-.PP
-.I Ex
-is normally editing the contents of a single file,
-whose name is recorded in the
-.I current
-file name.
-.I Ex
-performs all editing actions in a buffer
-(actually a temporary file)
-into which the text of the file is initially read.
-Changes made to the buffer have no effect on the file being
-edited unless and until the buffer contents are written out to the
-file with a
-.I write
-command.
-After the buffer contents are written,
-the previous contents of the written file are no longer accessible.
-When a file is edited,
-its name becomes the current file name,
-and its contents are read into the buffer.
-.PP
-The current file is almost always considered to be
-.I edited.
-This means that the contents of the buffer are logically
-connected with the current file name,
-so that writing the current buffer contents onto that file,
-even if it exists,
-is a reasonable action.
-If the current file is not
-.I edited
-then
-.I ex
-will not normally write on it if it already exists.*
-.FS
-* The
-.I file
-command will say ``[Not edited]'' if the current file is not considered
-edited.
-.FE
-.NH 2
-Alternate file
-.PP
-Each time a new value is given to the current file name,
-the previous current file name is saved as the
-.I alternate
-file name.
-Similarly if a file is mentioned but does not become the current file,
-it is saved as the alternate file name.
-.NH 2
-Filename expansion
-.PP
-Filenames within the editor may be specified using the normal
-shell expansion conventions.
-In addition,
-the character `%' in filenames is replaced by the
-.I current
-file name and the character
-`#' by the
-.I alternate
-file name.\(dg
-.FS
-\(dg This makes it easy to deal alternately with
-two files and eliminates the need for retyping the
-name supplied on an
-.I edit
-command after a
-.I "No write since last change"
-diagnostic is received.
-.FE
-.NH 2
-Multiple files and named buffers
-.PP
-If more than one file is given on the command line,
-then the first file is edited as described above.
-The remaining arguments are placed with the first file in the
-.I "argument list."
-The current argument list may be displayed with the
-.I args
-command.
-The next file in the argument list may be edited with the
-.I next
-command.
-The argument list may also be respecified by specifying
-a list of names to the
-.I next
-command.
-These names are expanded,
-the resulting list of names becomes the new argument list,
-and
-.I ex
-edits the first file on the list.
-.PP
-For saving blocks of text while editing, and especially when editing
-more than one file,
-.I ex
-has a group of named buffers.
-These are similar to the normal buffer, except that only a limited number
-of operations are available on them.
-The buffers have names
-.I a
-through
-.I z.\(dd
-.FS
-\(dd It is also possible to refer to
-.I A
-through
-.I Z;
-the upper case buffers are the same as the lower but commands
-append to named buffers rather than replacing
-if upper case names are used.
-.FE
-.NH 2
-Read only
-.PP
-It is possible to use
-.I ex
-in
-.I "read only"
-mode to look at files that you have no intention of modifying.
-This mode protects you from accidently overwriting the file.
-Read only mode is on when the
-.I readonly
-option is set.
-It can be turned on with the
-.B \-R
-command line option,
-by the
-.I view
-command line invocation,
-or by setting the
-.I readonly
-option.
-It can be cleared by setting
-.I noreadonly .
-It is possible to write, even while in read only mode, by indicating
-that you really know what you are doing.
-You can write to a different file, or can use the ! form of write,
-even while in read only mode.
-.NH 1
-Exceptional Conditions
-.NH 2
-Errors and interrupts
-.PP
-When errors occur
-.I ex
-(optionally) rings the terminal bell and, in any case, prints an error
-diagnostic. If the primary input is from a file, editor processing
-will terminate. If an interrupt signal is received,
-.I ex
-prints ``Interrupt'' and returns to its command level. If the primary
-input is a file, then
-.I ex
-will exit when this occurs.
-.NH 2
-Recovering from hangups and crashes
-.PP
-If a hangup signal is received and the buffer has been modified since
-it was last written out, or if the system crashes, either the editor
-(in the first case) or the system (after it reboots in the second) will
-attempt to preserve the buffer. The next time you log in you should be
-able to recover the work you were doing, losing at most a few lines of
-changes from the last point before the hangup or editor crash. To
-recover a file you can use the
-.B \-r
-option. If you were editing the file
-.I resume,
-then you should change
-to the directory where you were when the crash occurred, giving the command
-.DS
-\fBex \-r\fP\fI resume\fP
-.DE
-After checking that the retrieved file is indeed ok, you can
-.I write
-it over the previous contents of that file.
-.PP
-You will normally get mail from the system telling you when a file has
-been saved after a crash. The command
-.DS
-\fBex\fP \-\fBr\fP
-.DE
-will print a list of the files which have been saved for you.
-(In the case of a hangup,
-the file will not appear in the list,
-although it can be recovered.)
-.NH 1
-Editing modes
-.PP
-.I Ex
-has five distinct modes. The primary mode is
-.I command
-mode. Commands are entered in command mode when a `:' prompt is
-present, and are executed each time a complete line is sent. In
-.I "text input"
-mode
-.I ex
-gathers input lines and places them in the file. The
-.I append,
-.I insert,
-and
-.I change
-commands use text input mode.
-No prompt is printed when you are in text input mode.
-This mode is left by typing a `.' alone at the beginning of a line, and
-.I command
-mode resumes.
-.PP
-The last three modes are
-.I open
-and
-.I visual
-modes, entered by the commands of the same name, and, within open and
-visual modes
-.I "text insertion"
-mode.
-.I Open
-and
-.I visual
-modes allow local editing operations to be performed on the text in the
-file. The
-.I open
-command displays one line at a time on any terminal while
-.I visual
-works on \s-2CRT\s0 terminals with random positioning cursors, using the
-screen as a (single) window for file editing changes.
-These modes are described (only) in
-.I "An Introduction to Display Editing with Vi."
-.NH
-Command structure
-.PP
-Most command names are English words,
-and initial prefixes of the words are acceptable abbreviations.
-The ambiguity of abbreviations is resolved in favor of the more commonly
-used commands.*
-.FS
-* As an example, the command
-.I substitute
-can be abbreviated `s'
-while the shortest available abbreviation for the
-.I set
-command is `se'.
-.FE
-.NH 2
-Command parameters
-.PP
-Most commands accept prefix addresses specifying the lines in the file
-upon which they are to have effect.
-The forms of these addresses will be discussed below.
-A number of commands also may take a trailing
-.I count
-specifying the number of lines to be involved in the command.\(dg
-.FS
-\(dg Counts are rounded down if necessary.
-.FE
-Thus the command ``10p'' will print the tenth line in the buffer while
-``delete 5'' will delete five lines from the buffer,
-starting with the current line.
-.PP
-Some commands take other information or parameters,
-this information always being given after the command name.\(dd
-.FS
-\(dd Examples would be option names in a
-.I set
-command i.e. ``set number'',
-a file name in an
-.I edit
-command,
-a regular expression in a
-.I substitute
-command,
-or a target address for a
-.I copy
-command, i.e. ``1,5 copy 25''.
-.FE
-.NH 2
-Command variants
-.PP
-A number of commands have two distinct variants.
-The variant form of the command is invoked by placing an
-`!' immediately after the command name.
-Some of the default variants may be controlled by options;
-in this case, the `!' serves to toggle the default.
-.NH 2
-Flags after commands
-.PP
-The characters `#', `p' and `l' may be placed after many commands.**
-.FS
-**
-A `p' or `l' must be preceded by a blank or tab
-except in the single special case `dp'.
-.FE
-In this case, the command abbreviated by these characters
-is executed after the command completes.
-Since
-.I ex
-normally prints the new current line after each change, `p' is rarely necessary.
-Any number of `+' or `\-' 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.
-.NH 2
-Comments
-.PP
-It is possible to give editor commands which are ignored.
-This is useful when making complex editor scripts
-for which comments are desired.
-The comment character is the double quote: ".
-Any command line beginning with " is ignored.
-Comments beginning with " may also be placed at the ends
-of commands, except in cases where they could be confused as part
-of text (shell escapes and the substitute and map commands).
-.NH 2
-Multiple commands per line
-.PP
-More than one command may be placed on a line by separating each pair
-of commands by a `|' character.
-However the
-.I global
-commands,
-comments,
-and the shell escape `!'
-must be the last command on a line, as they are not terminated by a `|'.
-.NH 2
-Reporting large changes
-.PP
-Most commands which change the contents of the editor buffer give
-feedback if the scope of the change exceeds a threshold given by the
-.I report
-option.
-This feedback helps to detect undesirably large changes so that they may
-be quickly and easily reversed with an
-.I undo.
-After commands with more global effect such as
-.I global
-or
-.I visual,
-you will be informed if the net change in the number of lines
-in the buffer during this command exceeds this threshold.
-.NH 1
-Command addressing
-.NH 2
-Addressing primitives
-.IP \fB.\fR 20
-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 `\fB.\fR' is rarely used alone as an address.
-.IP \fIn\fR 20
-The \fIn\fRth line in the editor's buffer, lines being numbered
-sequentially from 1.
-.IP \fB$\fR 20
-The last line in the buffer.
-.IP \fB%\fR 20
-An abbreviation for ``1,$'', the entire buffer.
-.IP \fI+n\fR\ \fI\-n\fR 20
-An offset relative to the current buffer line.\(dg
-.FS
-\(dg
-The forms `.+3' `+3' and `+++' are all equivalent;
-if the current line is line 100 they all address line 103.
-.FE
-.IP \fB/\fIpat\fR\fB/\fR\ \fB?\fIpat\fR\fB?\fR 20
-Scan forward and backward respectively for a line containing \fIpat\fR, a
-regular expression (as defined below). The scans normally wrap around the end
-of the buffer.
-If all that is desired is to print the next line containing \fIpat\fR, then
-the trailing \fB/\fR or \fB?\fR may be omitted.
-If \fIpat\fP is omitted or explicitly empty, then the last
-regular expression specified is located.\(dd
-.FS
-\(dd The forms \fB\e/\fP and \fB\e?\fP scan
-using the last regular expression used in a scan; after a substitute
-\fB//\fP and \fB??\fP would scan using the substitute's regular expression.
-.FE
-.IP \fB\(aa\(aa\fP\ \fB\(aa\fP\fIx\fP 20
-Before each non-relative motion of the current line `\fB.\fP',
-the previous current line is marked with a tag, subsequently referred to as
-`\(aa\(aa'.
-This makes it easy to refer or return to this previous context.
-Marks may also be established by the
-.I mark
-command, using single lower case letters
-.I x
-and the marked lines referred to as
-`\(aa\fIx\fR'.
-.NH 2
-Combining addressing primitives
-.PP
-Addresses to commands consist of a series of addressing primitives,
-separated by `,' or `;'.
-Such address lists are evaluated left-to-right.
-When addresses are separated by `;' the current line `\fB.\fR'
-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,
-then 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.\(dg
-.FS
-\(dg Null address specifications are permitted in a list of addresses,
-the default in this case is the current line `.';
-thus `,100' is equivalent to `\fB.\fR,100'.
-It is an error to give a prefix address to a command which expects none.
-.FE
-.NH 1
-Command descriptions
-.PP
-The following form is a prototype for all
-.I ex
-commands:
-.DS
-\fIaddress\fR \fBcommand\fR \fI! parameters count flags\fR
-.DE
-All parts are optional; the degenerate case is the empty command which prints
-the next line in the file. For sanity with use from within
-.I visual
-mode,
-.I ex
-ignores a ``:'' preceding any command.
-.PP
-In the following command descriptions, the
-default addresses are shown in parentheses,
-which are
-.I not,
-however,
-part of the command.
-.LC
-\fBabbreviate\fR \fIword rhs\fP abbr: \fBab\fP
-.ZP
-Add the named abbreviation to the current list.
-When in input mode in visual, if
-.I word
-is typed as a complete word, it will be changed to
-.I rhs .
-.LC
-( \fB.\fR ) \fBappend\fR abbr: \fBa\fR
-.br
-\fItext\fR
-.br
-\&\fB.\fR
-.ZP
-Reads the input text and places it after the specified line.
-After the command, `\fB.\fR'
-addresses the last line input or the
-specified line if no lines were input.
-If address `0' is given,
-text is placed at the beginning of the buffer.
-.LC
-\fBa!\fR
-.br
-\fItext\fR
-.br
-\&\fB.\fR
-.ZP
-The variant flag to
-.I append
-toggles the setting for the
-.I autoindent
-option during the input of
-.I text.
-.LC
-\fBargs\fR
-.ZP
-The members of the argument list are printed, with the current argument
-delimited by `[' and `]'.
-.ig
-.PP
-\fBcd\fR \fIdirectory\fR
-.ZP
-The
-.I cd
-command is a synonym for
-.I chdir.
-..
-.LC
-( \fB.\fP , \fB.\fP ) \fBchange\fP \fIcount\fP abbr: \fBc\fP
-.br
-\fItext\fP
-.br
-\&\fB.\fP
-.ZP
-Replaces the specified lines with the input \fItext\fP.
-The current line becomes the last line input;
-if no lines were input it is left as for a
-\fIdelete\fP.
-.LC
-\fBc!\fP
-.br
-\fItext\fP
-.br
-\&\fB.\fP
-.ZP
-The variant toggles
-.I autoindent
-during the
-.I change.
-.ig
-.LC
-\fBchdir\fR \fIdirectory\fR
-.ZP
-The specified \fIdirectory\fR becomes the current directory.
-If no directory is specified, the current value of the
-.I home
-option is used as the target directory.
-After a
-.I chdir
-the current file is not considered to have been
-edited so that write restrictions on pre-existing files apply.
-..
-.LC
-( \fB.\fP , \fB.\fP )\|\fBcopy\fP \fIaddr\fP \fIflags\fP abbr: \fBco\fP
-.ZP
-A
-.I copy
-of the specified lines is placed after
-.I addr,
-which may be `0'.
-The current line
-`\fB.\fR'
-addresses the last line of the copy.
-The command
-.I t
-is a synonym for
-.I copy.
-.LC
-( \fB.\fR , \fB.\fR )\|\fBdelete\fR \fIbuffer\fR \fIcount\fR \fIflags\fR abbr: \fBd\fR
-.ZP
-Removes the specified lines from the buffer.
-The line after the last line deleted becomes the current line;
-if the lines deleted were originally at the end,
-the new last line becomes the current line.
-If a named
-.I buffer
-is specified by giving a letter,
-then the specified lines are saved in that buffer,
-or appended to it if an upper case letter is used.
-.LC
-\fBedit\fR \fIfile\fR abbr: \fBe\fR
-.br
-\fBex\fR \fIfile\fR
-.ZP
-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
-.I write
-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 prints the new filename.
-After insuring that this file is sensible\(dg
-.FS
-\(dg I.e., that it is not a binary file such as a directory,
-a block or character special file other than
-.I /dev/tty,
-a terminal,
-or a binary or executable file
-(as indicated by the first word).
-.FE
-the editor reads the file into its buffer.
-.IP
-If the read of the file completes without error,
-the number of lines and characters read is typed.
-If there were any non-\s-2ASCII\s0 characters
-in the file they are stripped of their non-\s-2ASCII\s0
-high bits,
-and any null characters in the file are discarded.
-If none of these errors occurred, the file is considered
-.I edited.
-If the last line of the input file is missing the trailing
-newline character, it will be supplied and a complaint will be issued.
-This command leaves the current line `\fB.\fR' at the last line read.\(dd
-.FS
-\(dd If executed from within
-.I open
-or
-.I visual,
-the current line is initially the first line of the file.
-.FE
-.LC
-\fBe!\fR \fIfile\fR
-.ZP
-The variant form suppresses the complaint about modifications having
-been made and not written from the editor buffer, thus
-discarding all changes which have been made before editing the new file.
-.LC
-\fBe\fR \fB+\fIn\fR \fIfile\fR
-.ZP
-Causes the editor to begin at line
-.I n
-rather than at the last line;
-\fIn\fR may also be an editor command containing no spaces, e.g.: ``+/pat''.
-.LC
-\fBfile\fR abbr: \fBf\fR
-.ZP
-Prints the current file name,
-whether it has been `[Modified]' since the last
-.I write
-command,
-whether it is
-.I "read only" ,
-the current line,
-the number of lines in the buffer,
-and the percentage of the way through the buffer of the current line.*
-.FS
-* In the rare case that the current file is `[Not edited]' this is
-noted also; in this case you have to use the form \fBw!\fR to write to
-the file, since the editor is not sure that a \fBwrite\fR will not
-destroy a file unrelated to the current contents of the buffer.
-.FE
-.LC
-\fBfile\fR \fIfile\fR
-.ZP
-The current file name is changed to
-.I file
-which is considered
-`[Not edited]'.
-.LC
-( 1 , $ ) \fBglobal\fR /\fIpat\|\fR/ \fIcmds\fR abbr: \fBg\fR
-.ZP
-First marks each line among those specified which matches
-the given regular expression.
-Then the given command list is executed with `\fB.\fR' initially
-set to each marked line.
-.IP
-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 `\e'.
-If
-.I cmds
-(and possibly the trailing \fB/\fR delimiter) is omitted, each line matching
-.I pat
-is printed.
-.I Append,
-.I insert,
-and
-.I change
-commands and associated input are permitted;
-the `\fB.\fR' terminating input may be omitted if it would be on the
-last line of the command list.
-.I Open
-and
-.I visual
-commands are permitted in the command list and take input from the terminal.
-.IP
-The
-.I global
-command itself may not appear in
-.I cmds.
-The
-.I undo
-command is also not permitted there,
-as
-.I undo
-instead can be used to reverse the entire
-.I global
-command.
-The options
-.I autoprint
-and
-.I autoindent
-are inhibited during a
-.I global,
-(and possibly the trailing \fB/\fR delimiter) and the value of the
-.I report
-option is temporarily infinite,
-in deference to a \fIreport\fR for the entire global.
-Finally, the context mark `\'\'' is set to the value of
-`.' before the global command begins and is not changed during a global
-command,
-except perhaps by an
-.I open
-or
-.I visual
-within the
-.I global.
-.LC
-\fBg!\fR \fB/\fIpat\fB/\fR \fIcmds\fR abbr: \fBv\fR
-.IP
-The variant form of \fIglobal\fR runs \fIcmds\fR at each line not matching
-\fIpat\fR.
-.LC
-( \fB.\fR )\|\fBinsert\fR abbr: \fBi\fR
-.br
-\fItext\fR
-.br
-\&\fB.\fR
-.ZP
-Places the given text before the specified line.
-The current line is left at the last line input;
-if there were none input it is left at the line before the addressed line.
-This command differs from
-.I append
-only in the placement of text.
-.KS
-.LC
-\fBi!\fR
-.br
-\fItext\fR
-.br
-\&\fB.\fR
-.ZP
-The variant toggles
-.I autoindent
-during the
-.I insert.
-.KE
-.LC
-( \fB.\fR , \fB.\fR+1 ) \fBjoin\fR \fIcount\fR \fIflags\fR abbr: \fBj\fR
-.ZP
-Places the text from a specified range of lines
-together on one line.
-White space is adjusted at each junction to provide at least
-one blank character, two if there was a `\fB.\fR' at the end of the line,
-or none if the first following character is a `)'.
-If there is already white space at the end of the line,
-then the white space at the start of the next line will be discarded.
-.LC
-\fBj!\fR
-.ZP
-The variant causes a simpler
-.I join
-with no white space processing; the characters in the lines are simply
-concatenated.
-.LC
-( \fB.\fR ) \fBk\fR \fIx\fR
-.ZP
-The
-.I k
-command is a synonym for
-.I mark.
-It does not require a blank or tab before the following letter.
-.LC
-( \fB.\fR , \fB.\fR ) \fBlist\fR \fIcount\fR \fIflags\fR
-.ZP
-Prints the specified lines in a more unambiguous way:
-tabs are printed as `^I'
-and the end of each line is marked with a trailing `$'.
-The current line is left at the last line printed.
-.LC
-\fBmap\fR \fIlhs\fR \fIrhs\fR
-.ZP
-The
-.I map
-command is used to define macros for use in
-.I visual
-mode.
-.I Lhs
-should be a single character, or the sequence ``#n'', for n a digit,
-referring to function key \fIn\fR. When this character or function key
-is typed in
-.I visual
-mode, it will be as though the corresponding \fIrhs\fR had been typed.
-On terminals without function keys, you can type ``#n''.
-See section 6.9 of the ``Introduction to Display Editing with Vi''
-for more details.
-.LC
-( \fB.\fR ) \fBmark\fR \fIx\fR
-.ZP
-Gives the specified line mark
-.I x,
-a single lower case letter.
-The
-.I x
-must be preceded by a blank or a tab.
-The addressing form `\'x' then addresses this line.
-The current line is not affected by this command.
-.LC
-( \fB.\fR , \fB.\fR ) \fBmove\fR \fIaddr\fR abbr: \fBm\fR
-.ZP
-The
-.I move
-command repositions the specified lines to be after
-.I addr .
-The first of the moved lines becomes the current line.
-.LC
-\fBnext\fR abbr: \fBn\fR
-.ZP
-The next file from the command line argument list is edited.
-.LC
-\fBn!\fR
-.ZP
-The variant suppresses warnings about the modifications to the buffer not
-having been written out, discarding (irretrievably) any changes which may
-have been made.
-.LC
-\fBn\fR \fIfilelist\fR
-.br
-\fBn\fR \fB+\fIcommand\fR \fIfilelist\fR
-.ZP
-The specified
-.I filelist
-is expanded and the resulting list replaces the
-current argument list;
-the first file in the new list is then edited.
-If
-.I command
-is given (it must contain no spaces), then it is executed after editing the first such file.
-.LC
-( \fB.\fR , \fB.\fR ) \fBnumber\fR \fIcount\fR \fIflags\fR abbr: \fB#\fR or \fBnu\fR
-.ZP
-Prints each specified line preceded by its buffer line
-number.
-The current line is left at the last line printed.
-.KS
-.LC
-( \fB.\fR ) \fBopen\fR \fIflags\fR abbr: \fBo\fR
-.br
-( \fB.\fR ) \fBopen\fR /\fIpat\|\fR/ \fIflags\fR
-.ZP
-Enters intraline editing \fIopen\fR mode at each addressed line.
-If
-.I pat
-is given,
-then the cursor will be placed initially at the beginning of the
-string matched by the pattern.
-To exit this mode use Q.
-See
-.I "An Introduction to Display Editing with Vi"
-for more details.
-.KE
-.LC
-\fBpreserve\fR
-.ZP
-The current editor buffer is saved as though the system had just crashed.
-This command is for use only in emergencies when a
-.I write
-command has resulted in an error and you don't know how to save your work.
-After a
-.I preserve
-you should seek help.
-.LC
-( \fB.\fR , \fB.\fR )\|\fBprint\fR \fIcount\fR abbr: \fBp\fR or \fBP\fR
-.ZP
-Prints the specified lines
-with non-printing characters printed as control characters `^\fIx\fR\|';
-delete (octal 177) is represented as `^?'.
-The current line is left at the last line printed.
-.LC
-( \fB.\fR )\|\fBput\fR \fIbuffer\fR abbr: \fBpu\fR
-.ZP
-Puts back
-previously
-.I deleted
-or
-.I yanked
-lines.
-Normally used with
-.I delete
-to effect movement of lines,
-or with
-.I yank
-to effect duplication of lines.
-If no
-.I buffer
-is specified, then the last
-.I deleted
-or
-.I yanked
-text is restored.*
-.FS
-* But no modifying commands may intervene between the
-.I delete
-or
-.I yank
-and the
-.I put,
-nor may lines be moved between files without using a named buffer.
-.FE
-By using a named buffer, text may be restored that was saved there at any
-previous time.
-.LC
-\fBquit\fR abbr: \fBq\fR
-.ZP
-Causes
-.I ex
-to terminate.
-No automatic write of the editor buffer to a file is performed.
-However,
-.I ex
-issues a warning message if the file has changed
-since the last
-.I write
-command was issued, and does not
-.I quit.\(dg
-.FS
-\(dg \fIEx\fR
-will also issue a diagnostic if there are more files in the argument
-list.
-.FE
-Normally, you will wish to save your changes, and you
-should give a \fIwrite\fR command;
-if you wish to discard them, use the \fBq!\fR command variant.
-.LC
-\fBq!\fR
-.ZP
-Quits from the editor, discarding changes to the buffer without complaint.
-.LC
-( \fB.\fR ) \fBread\fR \fIfile\fR abbr: \fBr\fR
-.ZP
-Places a copy of the text of the given file in the
-editing buffer after the specified line.
-If no
-.I file
-is given the current file name is used.
-The current file name is not changed unless there is none in which
-case
-.I file
-becomes the current name.
-The sensibility restrictions for the
-.I edit
-command apply here also.
-If the file buffer is empty and there is no current name then
-.I ex
-treats this as an
-.I edit
-command.
-.IP
-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
-.I edit
-command when the
-.I read
-successfully terminates.
-After a
-.I read
-the current line is the last line read.\(dd
-.FS
-\(dd Within
-.I open
-and
-.I visual
-the current line is set to the first line read rather than the last.
-.FE
-.LC
-( \fB.\fR ) \fBread\fR \fB!\fR\fIcommand\fR
-.ZP
-Reads the output of the command
-.I command
-into the buffer after the specified line.
-This is not a variant form of the command, rather a read
-specifying a
-.I command
-rather than a
-.I filename;
-a blank or tab before the \fB!\fR is mandatory.
-.LC
-\fBrecover \fIfile\fR
-.ZP
-Recovers
-.I file
-from the system save area.
-Used after a accidental hangup of the phone**
-.FS
-** The system saves a copy of the file you were editing only if you
-have made changes to the file.
-.FE
-or a system crash** or
-.I preserve
-command.
-Except when you use
-.I preserve
-you will be notified by mail when a file is saved.
-.LC
-\fBrewind\fR abbr: \fBrew\fR
-.ZP
-The argument list is rewound, and the first file in the list is edited.
-.LC
-\fBrew!\fR
-.ZP
-Rewinds the argument list discarding any changes made to the current buffer.
-.LC
-\fBset\fR \fIparameter\fR
-.ZP
-With no arguments, prints those options whose values have been
-changed from their defaults;
-with parameter
-.I all
-it prints all of the option values.
-.IP
-Giving an option name followed by a `?'
-causes the current value of that option to be printed.
-The `?' is unnecessary unless the option is Boolean valued.
-Boolean options are given values either by the form
-`set \fIoption\fR' to turn them on or
-`set no\fIoption\fR' to turn them off;
-string and numeric options are assigned via the form
-`set \fIoption\fR=value'.
-.IP
-More than one parameter may be given to
-.I set \|;
-they are interpreted left-to-right.
-.LC
-\fBshell\fR abbr: \fBsh\fR
-.IP
-A new shell is created.
-When it terminates, editing resumes.
-.LC
-\fBsource\fR \fIfile\fR abbr: \fBso\fR
-.IP
-Reads and executes commands from the specified file.
-.I Source
-commands may be nested.
-.LC
-( \fB.\fR , \fB.\fR ) \fBsubstitute\fR /\fIpat\fR\|/\fIrepl\fR\|/ \fIoptions\fR \fIcount\fR \fIflags\fR abbr: \fBs\fR
-.IP
-On each specified line, the first instance of pattern
-.I pat
-is replaced by replacement pattern
-.I repl.
-If the
-.I global
-indicator option character `g'
-appears, then all instances are substituted;
-if the
-.I confirm
-indication character `c' appears,
-then before each substitution the line to be substituted
-is typed with the string to be substituted marked
-with `\(ua' characters.
-By typing an `y' one can cause the substitution to be performed,
-any other input causes no change to take place.
-After a
-.I substitute
-the current line is the last line substituted.
-.IP
-Lines may be split by substituting
-new-line characters into them.
-The newline in
-.I repl
-must be escaped by preceding it with a `\e'.
-Other metacharacters available in
-.I pat
-and
-.I repl
-are described below.
-.LC
-.B stop
-.ZP
-Suspends the editor, returning control to the top level shell.
-If
-.I autowrite
-is set and there are unsaved changes,
-a write is done first unless the form
-.B stop !
-is used.
-This commands is only available where supported by the teletype driver
-and operating system.
-.LC
-( \fB.\fR , \fB.\fR ) \fBsubstitute\fR \fIoptions\fR \fIcount\fR \fIflags\fR abbr: \fBs\fR
-.ZP
-If
-.I pat
-and
-.I repl
-are omitted, then the last substitution is repeated.
-This is a synonym for the
-.B &
-command.
-.LC
-( \fB.\fR , \fB.\fR ) \fBt\fR \fIaddr\fR \fIflags\fR
-.ZP
-The
-.I t
-command is a synonym for
-.I copy .
-.LC
-\fBta\fR \fItag\fR
-.ZP
-The focus of editing switches to the location of
-.I tag,
-switching to a different line in the current file where it is defined,
-or if necessary to another file.\(dd
-.FS
-\(dd If you have modified the current file before giving a
-.I tag
-command, you must write it out; giving another
-.I tag
-command, specifying no
-.I tag
-will reuse the previous tag.
-.FE
-.IP
-The tags file is normally created by a program such as
-.I 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 `/\fIpat\fR/' to be immune
-to minor changes in the file. Such scans are always performed as if
-.I nomagic
-was set.
-.PP
-The tag names in the tags file must be sorted alphabetically.
-.LC
-\fBunabbreviate\fR \fIword\fP abbr: \fBuna\fP
-.ZP
-Delete
-.I word
-from the list of abbreviations.
-.LC
-\fBundo\fR abbr: \fBu\fR
-.ZP
-Reverses the changes made in the buffer by the last
-buffer editing command.
-Note that
-.I global
-commands are considered a single command for the purpose of
-.I undo
-(as are
-.I open
-and
-.I visual.)
-Also, the commands
-.I write
-and
-.I edit
-which interact with the
-file system cannot be undone.
-.I Undo
-is its own inverse.
-.IP
-.I Undo
-always marks the previous value of the current line `\fB.\fR'
-as `\'\''.
-After an
-.I undo
-the current line is the first line restored
-or the line before the first line deleted if no lines were restored.
-For commands with more global effect
-such as
-.I global
-and
-.I visual
-the current line regains it's pre-command value after an
-.I undo.
-.LC
-\fBunmap\fR \fIlhs\fR
-.ZP
-The macro expansion associated by
-.I map
-for
-.I lhs
-is removed.
-.LC
-( 1 , $ ) \fBv\fR /\fIpat\fR\|/ \fIcmds\fR
-.ZP
-A synonym for the
-.I global
-command variant \fBg!\fR, running the specified \fIcmds\fR on each
-line which does not match \fIpat\fR.
-.LC
-\fBversion\fR abbr: \fBve\fR
-.ZP
-Prints the current version number of the editor
-as well as the date the editor was last changed.
-.LC
-( \fB.\fR ) \fBvisual\fR \fItype\fR \fIcount\fR \fIflags\fR abbr: \fBvi\fR
-.ZP
-Enters visual mode at the specified line.
-.I Type
-is optional and may be `\-' , `\(ua' or `\fB.\fR'
-as in the
-.I z
-command to specify the placement of the specified line on the screen.
-By default, if
-.I type
-is omitted, the specified line is placed as the first on the screen.
-A
-.I count
-specifies an initial window size; the default is the value of the option
-.I window.
-See the document
-.I "An Introduction to Display Editing with Vi"
-for more details.
-To exit this mode, type Q.
-.LC
-\fBvisual\fP file
-.br
-\fBvisual\fP +\fIn\fP file
-.ZP
-From visual mode,
-this command is the same as edit.
-.LC
-( 1 , $ ) \fBwrite\fR \fIfile\fR abbr: \fBw\fR
-.ZP
-Writes changes made back to \fIfile\fR, printing the number of lines and
-characters written.
-Normally \fIfile\fR is omitted and the text goes back where it came from.
-If a \fIfile\fR is specified, then text will be written to that file.*
-.FS
-* The editor writes to a file only if it is
-the current file and is
-.I edited ,
-if the file does not exist,
-or if the file is actually a teletype,
-.I /dev/tty,
-.I /dev/null.
-Otherwise, you must give the variant form \fBw!\fR to force the write.
-.FE
-If the file does not exist it is created.
-The current file name is changed only if there is no current file
-name; the current line is never changed.
-.IP
-If an error occurs while writing the current and
-.I edited
-file, the editor
-considers that there has been ``No write since last change''
-even if the buffer had not previously been modified.
-.LC
-( 1 , $ ) \fBwrite>>\fR \fIfile\fR abbr: \fBw>>\fR
-.ZP
-Writes the buffer contents at the end of
-an existing file.
-.IP
-.LC
-\fBw!\fR \fIname\fR
-.ZP
-Overrides the checking of the normal \fIwrite\fR command,
-and will write to any file which the system permits.
-.LC
-( 1 , $ ) \fBw\fR \fB!\fR\fIcommand\fR
-.ZP
-Writes the specified lines into
-.I command.
-Note the difference between \fBw!\fR which overrides checks and
-\fBw\ \ !\fR which writes to a command.
-.LC
-\fBwq\fR \fIname\fR
-.ZP
-Like a \fIwrite\fR and then a \fIquit\fR command.
-.LC
-\fBwq!\fR \fIname\fR
-.ZP
-The variant overrides checking on the sensibility of the
-.I write
-command, as \fBw!\fR does.
-.LC
-\fBxit\fP \fIname\fR
-.ZP
-If any changes have been made and not written, writes the buffer out.
-Then, in any case, quits.
-.LC
-( \fB.\fR , \fB.\fR )\|\fByank\fR \fIbuffer\fR \fIcount\fR abbr: \fBya\fR
-.ZP
-Places the specified lines in the named
-.I buffer,
-for later retrieval via
-.I put.
-If no buffer name is specified, the lines go to a more volatile place;
-see the \fIput\fR command description.
-.LC
-( \fB.+1\fR ) \fBz\fR \fIcount\fR
-.ZP
-Print the next \fIcount\fR lines, default \fIwindow\fR.
-.LC
-( \fB.\fR ) \fBz\fR \fItype\fR \fIcount\fR
-.ZP
-Prints a window of text with the specified line at the top.
-If \fItype\fR is `\-' the line is placed at the bottom; a `\fB.\fR' causes
-the line to be placed in the center.*
-A count gives the number of lines to be displayed rather than
-double the number specified by the \fIscroll\fR option.
-On a \s-2CRT\s0 the screen is cleared before display begins unless a
-count which is less than the screen size is given.
-The current line is left at the last line printed.
-.FS
-* Forms `z=' and `z\(ua' also exist; `z=' places the current line in the
-center, surrounds it with lines of `\-' characters and leaves the current
-line at this line. The form `z\(ua' prints the window before `z\-'
-would. The characters `+', `\(ua' and `\-' may be repeated for cumulative
-effect.
-On some v2 editors, no
-.I type
-may be given.
-.FE
-.LC
-\fB!\fR \fIcommand\fR\fR
-.ZP
-The remainder of the line after the `!' character is sent to a shell
-to be executed.
-Within the text of
-.I command
-the characters
-`%' and `#' are expanded as in filenames 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 will be echoed.
-The current line is unchanged by this command.
-.IP
-If there has been ``[No\ write]'' of the buffer contents since the last
-change to the editing buffer, then a diagnostic will be printed
-before the command is executed as a warning.
-A single `!' is printed when the command completes.
-.LC
-( \fIaddr\fR , \fIaddr\fR ) \fB!\fR \fIcommand\fR\fR
-.ZP
-Takes the specified address range and supplies it as
-standard input to
-.I command;
-the resulting output then replaces the input lines.
-.LC
-( $ ) \fB=\fR
-.ZP
-Prints the line number of the
-addressed line.
-The current line is unchanged.
-.KS
-.LC
-( \fB.\fR , \fB.\fR ) \fB>\fR \fIcount\fR \fIflags\fR
-.br
-( \fB.\fR , \fB.\fR ) \fB<\fR \fIcount\fR \fIflags\fR
-.IP
-Perform intelligent shifting on the specified lines;
-\fB<\fR shifts left and \fB>\fR shift right.
-The quantity of shift is determined by the
-.I shiftwidth
-option and the repetition of the specification character.
-Only white space (blanks and tabs) is shifted;
-no non-white characters are discarded in a left-shift.
-The current line becomes the last line which changed due to the
-shifting.
-.KE
-.LC
-\fB^D\fR
-.ZP
-An end-of-file from a terminal input scrolls through the file.
-The
-.I scroll
-option specifies the size of the scroll, normally a half screen of text.
-.LC
-( \fB.\fR+1 , \fB.\fR+1 )
-.br
-( \fB.\fR+1 , \fB.\fR+1 ) |
-.ZP
-An address alone causes the addressed lines to be printed.
-A blank line prints the next line in the file.
-.LC
-( \fB.\fR , \fB.\fR ) \fB&\fR \fIoptions\fR \fIcount\fR \fIflags\fR
-.ZP
-Repeats the previous
-.I substitute
-command.
-.LC
-( \fB.\fR , \fB.\fR ) \fB\s+2~\s0\fR \fIoptions\fR \fIcount\fR \fIflags\fR
-.ZP
-Replaces the previous regular expression with the previous
-replacement pattern from a substitution.
-.NH 1
-Regular expressions and substitute replacement patterns
-.NH 2
-Regular expressions
-.PP
-A regular expression specifies a set of strings of characters.
-A member of this set of strings is said to be
-.I matched
-by the regular expression.
-.I Ex
-remembers two previous regular expressions:
-the previous regular expression used in a
-.I substitute
-command
-and the previous regular expression used elsewhere
-(referred to as the previous \fIscanning\fR regular expression.)
-The previous regular expression
-can always be referred to by a null \fIre\fR, e.g. `//' or `??'.
-.NH 2
-Magic and nomagic
-.PP
-The regular expressions allowed by
-.I ex
-are constructed in one of two ways depending on the setting of
-the
-.I magic
-option.
-The
-.I ex
-and
-.I vi
-default setting of
-.I magic
-gives quick access to a powerful set of regular expression
-metacharacters.
-The disadvantage of
-.I magic
-is that the user must remember that these metacharacters are
-.I magic
-and precede them with the character `\e'
-to use them as ``ordinary'' characters.
-With
-.I nomagic,
-the default for
-.I edit,
-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 `\e'.
-Note that `\e' is thus always a metacharacter.
-.PP
-The remainder of the discussion of regular expressions assumes
-that
-that the setting of this option is
-.I magic.\(dg
-.FS
-\(dg To discern what is true with
-.I nomagic
-it suffices to remember that the only
-special characters in this case will be `\(ua' at the beginning
-of a regular expression,
-`$' at the end of a regular expression,
-and `\e'.
-With
-.I nomagic
-the characters `\s+2~\s0' and `&' also lose their special meanings
-related to the replacement pattern of a substitute.
-.FE
-.NH 2
-Basic regular expression summary
-.PP
-The following basic constructs are used to construct
-.I magic
-mode regular expressions.
-.IP \fIchar\fR 15
-An ordinary character matches itself.
-The characters `\(ua' at the beginning of a line,
-`$' at the end of line,
-`*' as any character other than the first,
-`.', `\e', `[', and `\s+2~\s0' are not ordinary characters and
-must be escaped (preceded) by `\e' to be treated as such.
-.IP \fB\(ua\fR
-At the beginning of a pattern
-forces the match to succeed only at the beginning of a line.
-.IP \fB$\fR
-At the end of a regular expression forces the match to
-succeed only at the end of the line.
-.IP \&\fB.\fR
-Matches any single character except
-the new-line character.
-.IP \fB\e<\fR
-Forces the match
-to occur only at the beginning of a ``variable'' or ``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.
-.IP \fB\e>\fR
-Similar to `\e<', but matching the end of a ``variable''
-or ``word'', i.e. either the end of the line or before character
-which is neither a letter, nor a digit, nor the underline character.
-.IP \fB[\fIstring\fR]\fR
-Matches any (single) character in the class defined by
-.I string.
-Most characters in
-.I string
-define themselves.
-A pair of characters separated by `\-' in
-.I string
-defines the set of characters collating between the specified lower and upper
-bounds, thus `[a\-z]' as a regular expression matches
-any (single) lower-case letter.
-If the first character of
-.I string
-is an `\(ua' then the construct
-matches those characters which it otherwise would not;
-thus `[\(uaa\-z]' matches anything but a lower-case letter (and of course a
-newline).
-To place any of the characters
-`\(ua', `[', or `\-' in
-.I string
-you must escape them with a preceding `\e'.
-.NH 2
-Combining regular expression primitives
-.PP
-The concatenation of two regular expressions matches the leftmost and
-then longest string
-which can be divided with the first piece matching the first regular
-expression and the second piece matching the second.
-Any of the (single character matching) regular expressions mentioned
-above may be followed by the character `*' to form a regular expression
-which matches any number of adjacent occurrences (including 0) of characters
-matched by the regular expression it follows.
-.PP
-The character `\s+2~\s0' may be used in a regular expression,
-and matches the text which defined the replacement part
-of the last
-.I substitute
-command.
-A regular expression may be enclosed between the sequences
-`\e(' and `\e)' with side effects in the
-.I substitute
-replacement patterns.
-.NH 2
-Substitute replacement patterns
-.PP
-The basic metacharacters for the replacement pattern are
-`&' and `~'; these are
-given as `\e&' and `\e~' when
-.I nomagic
-is set.
-Each instance of `&' is replaced by the characters
-which the regular expression matched.
-The metacharacter `~' stands, in the replacement pattern,
-for the defining text of the previous replacement pattern.
-.PP
-Other metasequences possible in the replacement pattern
-are always introduced by the escaping character `\e'.
-The sequence `\e\fIn\fR' is replaced by the text matched
-by the \fIn\fR-th regular subexpression enclosed between
-`\e(' and `\e)'.\(dg
-.FS
-\(dg When nested, parenthesized subexpressions are present,
-\fIn\fR is determined by counting occurrences of `\e(' starting from the left.
-.FE
-The sequences `\eu' and `\el' cause the immediately following character in
-the replacement to be converted to upper- or lower-case respectively
-if this character is a letter.
-The sequences `\eU' and `\eL' turn such conversion on, either until
-`\eE' or `\ee' is encountered, or until the end of the replacement pattern.
-.de LC
-.br
-.sp .1i
-.ne 4
-.LP
-.ta 3i
-..
-.NH 1
-Option descriptions
-.PP
-.LC
-\fBautoindent\fR, \fBai\fR default: noai
-.ZP
-Can be used to ease the preparation of structured program text.
-At the beginning of each
-.I append ,
-.I change
-or
-.I insert
-command
-or when a new line is
-.I opened
-or created by an
-.I append ,
-.I change ,
-.I insert ,
-or
-.I substitute
-operation within
-.I open
-or
-.I visual
-mode,
-.I ex
-looks at the line being appended after,
-the first line changed
-or the line inserted before and calculates the amount of white space
-at the start of the line.
-It then aligns the cursor at the level of indentation so determined.
-.IP
-If the user then types lines of text in,
-they will continue to be justified at the displayed indenting level.
-If more white space is typed at the beginning of a line,
-the following line will start aligned with the first non-white character
-of the previous line.
-To back the cursor up to the preceding tab stop one can hit
-\fB^D\fR.
-The tab stops going backwards are defined at multiples of the
-.I shiftwidth
-option.
-You
-.I cannot
-backspace over the indent,
-except by sending an end-of-file with a \fB^D\fR.
-.IP
-Specially processed in this mode is a line with no characters added
-to it, which turns into a completely blank line (the white
-space provided for the
-.I autoindent
-is discarded.)
-Also specially processed in this mode are lines beginning with
-an `\(ua' and immediately followed by a \fB^D\fR.
-This causes the input to be repositioned at the beginning of the line,
-but retaining the previous indent for the next line.
-Similarly, a `0' followed by a \fB^D\fR
-repositions at the beginning but without
-retaining the previous indent.
-.IP
-.I Autoindent
-doesn't happen in
-.I global
-commands or when the input is not a terminal.
-.LC
-\fBautoprint\fR, \fBap\fR default: ap
-.ZP
-Causes the current line to be printed after each
-.I delete ,
-.I copy ,
-.I join ,
-.I move ,
-.I substitute ,
-.I t ,
-.I undo
-or
-shift command.
-This has the same effect as supplying a trailing `p'
-to each such command.
-.I Autoprint
-is suppressed in globals,
-and only applies to the last of many commands on a line.
-.LC
-\fBautowrite\fR, \fBaw\fR default: noaw
-.ZP
-Causes the contents of the buffer to be written to the current file
-if you have modified it and give a
-.I next,
-.I rewind,
-.I stop,
-.I tag,
-or
-.I !
-command, or a \fB^\(ua\fR (switch files) or \fB^]\fR (tag goto) command
-in
-.I visual.
-Note, that the
-.I edit
-and
-.I ex
-commands do
-.B not
-autowrite.
-In each case, there is an equivalent way of switching when autowrite
-is set to avoid the
-.I autowrite
-(\fIedit\fR
-for
-.I next ,
-.I rewind!
-for .I rewind ,
-.I stop!
-for
-.I stop ,
-.I tag!
-for
-.I tag ,
-.I shell
-for
-.I ! ,
-and
-\fB:e\ #\fR and a \fB:ta!\fR command from within
-.I visual).
-.LC
-\fBbeautify\fR, \fBbf\fR default: nobeautify
-.ZP
-Causes all control characters except tab, newline and form-feed
-to be discarded from the input.
-A complaint is registered the first time a
-backspace character is discarded.
-.I Beautify
-does not apply to command input.
-.LC
-\fBdirectory\fR, \fBdir\fR default: dir=/tmp
-.ZP
-Specifies the directory in which
-.I ex
-places its buffer file.
-If this directory in not
-writable, then the editor will exit abruptly when it fails to be
-able to create its buffer there.
-.LC
-\fBedcompatible\fR default: noedcompatible
-.ZP
-Causes the presence of absence of
-.B g
-and
-.B c
-suffixes on substitute commands to be remembered, and to be toggled
-by repeating the suffices. The suffix
-.B r
-makes the substitution be as in the
-.I ~
-command, instead of like
-.I &.
-.LC
-\fBerrorbells\fR, \fBeb\fR default: noeb
-.ZP
-Error messages are preceded by a bell.*
-.FS
-* Bell ringing in
-.I open
-and
-.I visual
-on errors is not suppressed by setting
-.I noeb.
-.FE
-If possible the editor always places the error message in a standout mode of the
-terminal (such as inverse video) instead of ringing the bell.
-.LC
-\fBhardtabs\fR, \fBht\fR default: ht=8
-.ZP
-Gives the boundaries on which terminal hardware tabs are set (or
-on which the system expands tabs).
-.LC
-\fBignorecase\fR, \fBic\fR default: noic
-.ZP
-All upper case characters in the text are mapped to lower case in regular
-expression matching.
-In addition, all upper case characters in regular expressions are mapped
-to lower case except in character class specifications.
-.LC
-\fBlisp\fR default: nolisp
-.ZP
-\fIAutoindent\fR indents appropriately for
-.I lisp
-code, and the \fB( ) { } [[\fR and \fB]]\fR commands in
-.I open
-and
-.I visual
-are modified to have meaning for \fIlisp\fR.
-.LC
-\fBlist\fR default: nolist
-.ZP
-All printed lines will be displayed (more) unambiguously,
-showing tabs and end-of-lines as in the
-.I list
-command.
-.LC
-\fBmagic\fR default: magic for \fIex\fR and \fIvi\fR\(dg
-.FS
-\(dg \fINomagic\fR for \fIedit\fR.
-.FE
-.ZP
-If
-.I nomagic
-is set, the number of regular expression metacharacters is greatly reduced,
-with only `\(ua' and `$' having special effects.
-In addition the metacharacters
-`~'
-and
-`&'
-of the replacement pattern are treated as normal characters.
-All the normal metacharacters may be made
-.I magic
-when
-.I nomagic
-is set by preceding them with a `\e'.
-.LC
-\fBmesg\fR default: mesg
-.ZP
-Causes write permission to be turned off to the terminal
-while you are in visual mode, if
-.I nomesg
-is set.
-.LC
-\fBmodeline\fR default: nomodeline
-.ZP
-If
-.I modeline
-is set, then the first 5 lines and the last five lines of the file
-will be checked for ex command lines and the comands issued.
-To be recognized as a command line, the line must have the string
-.B ex:
-or
-.B vi:
-preceeded by a tab or a space. This string may be anywhere in the
-line and anything after the
-.I :
-is interpeted as editor commands. This option defaults to off because
-of unexpected behavior when editting files such as
-.I /etc/passwd.
-.LC
-\fBnumber, nu\fR default: nonumber
-.ZP
-Causes all output lines to be printed with their
-line numbers.
-In addition each input line will be prompted for by supplying the line number
-it will have.
-.LC
-\fBopen\fR default: open
-.ZP
-If \fInoopen\fR, the commands
-.I open
-and
-.I visual
-are not permitted.
-This is set for
-.I edit
-to prevent confusion resulting from accidental entry to
-open or visual mode.
-.LC
-\fBoptimize, opt\fR default: optimize
-.ZP
-Throughput of text is expedited by setting the terminal
-to not do automatic carriage returns
-when printing more than one (logical) line of output,
-greatly speeding output on terminals without addressable
-cursors when text with leading white space is printed.
-.LC
-\fBparagraphs,\ para\fR default: para=IPLPPPQPP\0LIbp
-.ZP
-Specifies the paragraphs for the \fB{\fR and \fB}\fR operations in
-.I open
-and
-.I visual.
-The pairs of characters in the option's value are the names
-of the macros which start paragraphs.
-.LC
-\fBprompt\fR default: prompt
-.ZP
-Command mode input is prompted for with a `:'.
-.LC
-\fBredraw\fR default: noredraw
-.ZP
-The editor simulates (using great amounts of output), an intelligent
-terminal on a dumb terminal (e.g. during insertions in
-.I visual
-the characters to the right of the cursor position are refreshed
-as each input character is typed.)
-Useful only at very high speed.
-.LC
-\fBremap\fP default: remap
-.ZP
-If on, macros are repeatedly tried until they are unchanged.
-For example, if
-.B o
-is mapped to
-.B O ,
-and
-.B O
-is mapped to
-.B I ,
-then if
-.I remap
-is set,
-.B o
-will map to
-.B I ,
-but if
-.I noremap
-is set, it will map to
-.B O .
-.LC
-\fBreport\fR default: report=5\(dg
-.FS
-\(dg 2 for \fIedit\fR.
-.FE
-.ZP
-Specifies a threshold for feedback from commands.
-Any command which modifies more than the specified number of lines
-will provide feedback as to the scope of its changes.
-For commands such as
-.I global ,
-.I open ,
-.I undo ,
-and
-.I visual
-which have potentially more far reaching scope,
-the net change in the number of lines in the buffer is
-presented at the end of the command, subject to this same threshold.
-Thus notification is suppressed during a
-.I global
-command on the individual commands performed.
-.LC
-\fBscroll\fR default: scroll=\(12 window
-.ZP
-Determines the number of logical lines scrolled when an end-of-file
-is received from a terminal input in command mode,
-and the number of lines printed by a command mode
-.I z
-command (double the value of
-.I scroll ).
-.LC
-\fBsections\fR default: sections=SHNHH\0HU
-.ZP
-Specifies the section macros for the \fB[[\fR and \fB]]\fR operations
-in
-.I open
-and
-.I visual.
-The pairs of characters in the options's value are the names
-of the macros which start paragraphs.
-.LC
-\fBshell\fR, \fBsh\fR default: sh=/bin/sh
-.ZP
-Gives the path name of the shell forked for
-the shell escape command `!', and by the
-.I shell
-command.
-The default is taken from SHELL in the environment, if present.
-.LC
-\fBshiftwidth\fR, \fBsw\fR default: sw=8
-.ZP
-Gives the width a software tab stop,
-used in reverse tabbing with \fB^D\fR when using
-.I autoindent
-to append text,
-and by the shift commands.
-.LC
-\fBshowmatch, sm\fR default: nosm
-.ZP
-In
-.I open
-and
-.I visual
-mode, when a \fB)\fR or \fB}\fR is typed, move the cursor to the matching
-\fB(\fR or \fB{\fR for one second if this matching character is on the
-screen. Extremely useful with
-.I lisp.
-.LC
-\fBslowopen, slow\fR terminal dependent
-.ZP
-Affects the display algorithm used in
-.I visual
-mode, holding off display updating during input of new text to improve
-throughput when the terminal in use is both slow and unintelligent.
-See
-.I "An Introduction to Display Editing with Vi"
-for more details.
-.LC
-\fBtabstop,\ ts\fR default: ts=8
-.ZP
-The editor expands tabs in the input file to be on
-.I tabstop
-boundaries for the purposes of display.
-.LC
-\fBtaglength,\ tl\fR default: tl=0
-.ZP
-Tags are not significant beyond this many characters.
-A value of zero (the default) means that all characters are significant.
-.LC
-\fBtags\fR default: tags=tags /usr/lib/tags
-.ZP
-A path of files to be used as tag files for the
-.I tag
-command.
-A requested tag is searched for in the specified files, sequentially.
-By default, files called
-.B tags
-are searched for in the current directory and in /usr/lib
-(a master file for the entire system).
-.LC
-\fBterm\fR from environment TERM
-.ZP
-The terminal type of the output device.
-.LC
-\fBterse\fR default: noterse
-.ZP
-Shorter error diagnostics are produced for the experienced user.
-.LC
-\fBwarn\fR default: warn
-.ZP
-Warn if there has been `[No write since last change]' before a `!'
-command escape.
-.LC
-\fBwindow\fR default: window=speed dependent
-.ZP
-The number of lines in a text window in the
-.I visual
-command.
-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.
-.LC
-\fBw300,\ w1200\, w9600\fR
-.ZP
-These are not true options but set
-.B window
-only if the speed is slow (300), medium (1200), or high (9600),
-respectively.
-They are suitable for an EXINIT
-and make it easy to change the 8/16/full screen rule.
-.LC
-\fBwrapscan\fR, \fBws\fR default: ws
-.ZP
-Searches using the regular expressions in addressing
-will wrap around past the end of the file.
-.LC
-\fBwrapmargin\fR, \fBwm\fR default: wm=0
-.ZP
-Defines a margin for automatic wrapover of text during input in
-.I open
-and
-.I visual
-modes. See
-.I "An Introduction to Text Editing with Vi"
-for details.
-.LC
-\fBwriteany\fR, \fBwa\fR default: nowa
-.IP
-Inhibit the checks normally made before
-.I write
-commands, allowing a write to any file which the system protection
-mechanism will allow.
-.NH 1
-Limitations
-.PP
-Editor limits that the user is likely to encounter are as follows:
-1024 characters per line,
-256 characters per global command list,
-128 characters per file name,
-128 characters in the previous inserted and deleted text in
-.I open
-or
-.I visual,
-100 characters in a shell escape command,
-63 characters in a string valued option,
-and 30 characters in a tag name, and
-a limit of 250000 lines in the file is silently enforced.
-.PP
-The
-.I visual
-implementation limits the number of macros defined with map to
-32, and the total number of characters in macros to be less than 512.
-.LP
-.LP
-.I Acknowledgments.
-Chuck Haley contributed greatly to the early development of
-.I ex.
-Bruce Englar encouraged the redesign which led to
-.I ex
-version 1.
-Bill Joy wrote versions 1 and 2.0 through 2.7,
-and created the framework that users see in the present editor.
-Mark Horton added macros and other features and made the
-editor work on a large number of terminals and Unix systems.
diff --git a/usr.bin/vi/USD.doc/exref/ex.summary b/usr.bin/vi/USD.doc/exref/ex.summary
deleted file mode 100644
index 618da07c742..00000000000
--- a/usr.bin/vi/USD.doc/exref/ex.summary
+++ /dev/null
@@ -1,734 +0,0 @@
-.\" Copyright (c) 1980, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)ex.summary 8.1 (Berkeley) 6/8/93
-.\"
-.ds p \v'-0.2'.\v'+0.2'
-.ds U \s-2UNIX\s+2
-.ds c \v'-0.2':\v'+0.2'
-.nr PO .25i
-.nr LL 6.75i
-.lt 6.75i
-.ll 6.75i
-.ds CH
-.ds LF Computing Services, U.C. Berkeley
-.ds RF April 3, 1979
-.de SP
-.sp 1v
-..
-.nr PI 3n
-.nr PD 0
-.ND
-.ps 12
-.ft B
-.ce 1
-Ex/Edit Command Summary (Version 2.0)
-.ft R
-.nr VS 11
-.nr PS 9
-.nr HM 0.5i
-.nr CW
-.2C
-.PP
-.I Ex
-and
-.I edit
-are text editors, used for creating
-and modifying files of text on the \*U
-computer system.
-.I Edit
-is a variant of
-.I ex
-with features designed to
-make it less complicated
-to learn and use.
-In terms of command syntax and effect
-the editors are essentially identical,
-and this command summary applies to both.
-.PP
-The summary is meant as a quick reference
-for users already acquainted
-with
-.I edit
-or \fIex\fP.
-Fuller explanations of the editors are available
-in the documents
-.I
-Edit: A Tutorial
-.R
-(a self-teaching introduction) and the
-.I
-Ex Reference Manual
-.R
-(the comprehensive reference source for
-both \fIedit\fP and \fIex\fP).
-Both of these writeups are available in the
-Computing Services Library.
-.PP
-In the examples included with the
-summary, commands and text entered by
-the user are printed in \fBboldface\fR to
-distinguish them from responses printed
-by the computer.
-.sp 0.45v
-.LP
-.B
-The Editor Buffer
-.PP
-In order to perform its tasks
-the editor sets aside a temporary
-work space,
-called a \fIbuffer\fR,
-separate from the user's permanent
-file.
-Before starting to work on an existing
-file the editor makes a copy of it in the
-buffer, leaving the original untouched.
-All editing changes are made to the
-buffer copy, which must then
-be written back to the permanent
-file in order to update the
-old version.
-The buffer disappears
-at the end of the editing session.
-.sp 0.45v
-.LP
-.B
-Editing: Command and Text Input Modes
-.PP
-.R
-During an editing session there are
-two usual modes of operation:
-\fIcommand\fP mode and \fItext input\fP
-mode.
-(This disregards, for the moment,
-.I open
-and
-.I visual
-modes, discussed below.)
-In command mode, the editor issues a
-colon prompt (:)
-to show that it is ready to
-accept and execute a command.
-In text input mode, on the other hand, there is
-no prompt and the editor merely accepts text to
-be added to the buffer.
-Text input mode is initiated by the commands
-\fIappend\fP, \fIinsert\fP, and \fIchange\fP,
-and is terminated by typing a period as the
-first and only character on a line.
-.sp 0.45v
-.LP
-.B
-Line Numbers and Command Syntax
-.PP
-.R
-The editor keeps track of lines of text
-in the buffer by numbering them consecutively
-starting with 1 and renumbering
-as lines are added or deleted.
-At any given time the editor is positioned
-at one of these lines; this position is
-called the \fIcurrent line\fP.
-Generally, commands that change the
-contents of the buffer print the
-new current line at the end of their
-execution.
-.PP
-Most commands can be preceded by one or two
-line-number addresses which indicate the lines
-to be affected.
-If one number is given the command operates on
-that line only; if two, on an inclusive range
-of lines.
-Commands that can take line-number prefixes also
-assume default prefixes if none are given.
-The default assumed by each command is designed
-to make it convenient to use in many instances
-without any line-number prefix.
-For the most part, a command used without a
-prefix operates on the current line,
-though exceptions to this rule should be noted.
-The \fIprint\fP command
-by itself, for instance, causes
-one line, the current line, to be
-printed at the terminal.
-.PP
-The summary shows the number of line addresses
-that can be
-prefixed to each command as well as
-the defaults assumed if they are omitted.
-For example,
-.I (.,.)
-means that up to 2 line-numbers may be given,
-and that if none is given the
-command operates on the current line.
-(In the address prefix notation, ``.'' stands
-for the current line and ``$'' stands for
-the last line of the buffer.)
-If no such notation appears, no
-line-number prefix may be used.
-.PP
-Some commands take trailing
-information;
-only
-the more important instances of this
-are mentioned in the summary.
-.sp 0.25v
-.LP
-.B
-Open and Visual Modes
-.PP
-.R
-Besides command and text input modes,
-.I ex
-and
-.I edit
-provide on some CRT terminals other modes of editing,
-.I open
-and
-.I visual .
-In these modes the cursor can
-be moved to individual words
-or characters in a line.
-The commands then given are very different
-from the standard editor commands; most do not appear on the screen when
-typed.
-.I
-An Introduction to Display Editing with Vi
-.R
-provides a full discussion.
-.sp 0.25v
-.LP
-.B
-Special Characters
-.PP
-.R
-.fi
-Some characters take on special meanings
-when used in context searches
-and in patterns given to the \fIsubstitute\fP command.
-For \fIedit\fR, these are ``^'' and ``$'',
-meaning the beginning and end of a line,
-respectively.
-.I Ex
-has the following additional special characters:
-.B
-.ce 1
-\&. & * [ ] ~
-.R
-To use one of the special characters as its
-simple graphic representation
-rather than with its special meaning,
-precede it by a backslash (\\).
-The backslash always has a special meaning.
-.1C
-.rm LF
-.rm RF
-.rm CF
-.nr FM 0.4
-.TS
-cp10 cp10 cp10 cp10
-ltw(1.0i) lt2w(0.40i)fB ltw(3.0i) ltw(1.8i).
-Name Abbr Description Examples
-.sp 1.75
-(.)\fBappend a T{
-Begins text input mode,
-adding lines to the buffer after
-the line specified. Appending continues
-until ``.'' is typed alone at the
-beginning of a new line, followed by
-a carriage return. \fI0a\fR places
-lines at the beginning of the buffer.
-T} T{
-.nf
-\fR:\fBa
-Three lines of text
-are added to the buffer
-after the current line.
-\*p
-.R
-\*c
-.fi
-T}
-.SP
-\fR(.,.)\fBchange c T{
-Deletes indicated line(s) and
-initiates text input mode to
-replace them with new text which follows.
-New text is terminated the same way
-as with \fIappend\fR.
-T} T{
-.nf
-:\fB5,6c
-Lines 5 and 6 are
-deleted and replaced by
-these three lines.
-\*p
-.R
-\*c
-.fi
-T}
-.SP
-\fR(.,.)\fBcopy \fIaddr co T{
-Places a copy of the specified lines
-after the line indicated by \fIaddr\fR.
-The example places a copy of lines 8 through
-12, inclusive, after line 25.
-T} T{
-.nf
-\fR:\fB8,12co 25
-\fRLast line copied is printed
-\fR\*c
-.fi
-T}
-.SP
-\fR(.,.)\fBdelete d T{
-Removes lines from the buffer
-and prints the current line after the deletion.
-T} T{
-.nf
-\fR:\fB13,15d
-\fRNew current line is printed
-\*c
-.fi
-T}
-.TE
-.sp 0.5v
-.TS
-ltw(1.0i) lt2w(0.40i)fB ltw(3.0i) ltw(1.8i).
-T{
-\fBedit \fIfile\fP
-.br
-\fBedit! \fIfile\fP
-T} T{
-e
-.br
-e!
-T} T{
-.fi
-\fRClears the editor buffer and then
-copies into it the named \fIfile\fR,
-which becomes the current file.
-This is a way of shifting to a different
-file
-without leaving the editor.
-The editor issues a warning
-message if this command is used before
-saving changes
-made to the file already in the buffer;
-using the form \fBe!\fR overrides this protective mechanism.
-T} T{
-.nf
-\fR:\fBe ch10\fR
-No write since last change
-:\fBe! ch10\fR
-"ch10" 3 lines, 62 characters
-\*c
-.fi
-T}
-.SP
-\fBfile \fIname\fR f T{
-\fRIf followed by a \fIname\fR, renames
-the current file to \fIname\fR.
-If used without \fIname\fR, prints
-the name of the current file.
-T} T{
-.nf
-\fR:\fBf ch9
-\fR"ch9" [Modified] 3 lines ...
-:\fBf
-\fR"ch9" [Modified] 3 lines ...
-\*c
-.fi
-T}
-.SP
-(1,$)\fBglobal g \fBglobal/\fIpattern\fB/\fIcommands T{
-.nf
-:\fBg/nonsense/d
-\fR\*c
-.fi
-T}
-\fR(1,$)\fBglobal! g!\fR or \fBv T{
-Searches the entire buffer (unless a smaller
-range is specified by line-number prefixes) and
-executes \fIcommands\fR on every line with
-an expression matching \fIpattern\fR.
-The second form, abbreviated
-either \fBg!\fR or \fBv\fR,
-executes \fIcommands\fR on lines that \fIdo
-not\fR contain the expression \fIpattern\fR.
-T} \^
-.SP
-\fR(.)\fBinsert i T{
-Inserts new lines of text immediately before the specified line.
-Differs from
-.I append
-only in that text is placed before, rather than after, the indicated line.
-In other words, \fB1i\fR has the same effect as \fB0a\fR.
-T} T{
-.nf
-:\fB1i
-These lines of text will
-be added prior to line 1.
-\&.
-\fR:
-.fi
-T} \^
-.SP
-\fR(.,.+1)\fBjoin j T{
-Join lines together, adjusting white space (spaces
-and tabs) as necessary.
-T} T{
-.nf
-:\fB2,5j\fR
-Resulting line is printed
-:
-.fi
-T} \^
-.TE
-.bp
-.TS
-cp10 cp10 cp10 cp10
-ltw(1.0i) lt2w(0.40i)fB ltw(3.0i) ltw(1.8i).
-Name Abbr Description Examples
-.sp 1.75
-\fR(.,.)\fBlist l T{
-\fRPrints lines in a more
-unambiguous way than the \fIprint\fR
-command does. The end of a line,
-for example, is marked with a ``$'',
-and tabs printed as ``^I''.
-T} T{
-.nf
-:\fB9l
-\fRThis is line 9$
-\*c
-.fi
-T}
-.TE
-.sp 0.5v
-.TS
-ltw(1.0i) lt2w(0.40i)fB ltw(3.0i) ltw(1.8i).
-\fR(.,.)\fBmove \fIaddr\fB m T{
-\fRMoves the specified lines
-to a position after the line
-indicated by \fIaddr\fR.
-T} T{
-.nf
-\fR:\fB12,15m 25\fR
-New current line is printed
-\*c
-.fi
-T}
-.SP
-\fR(.,.)\fBnumber nu T{
-Prints each line preceded
-by its buffer line number.
-T} T{
-.nf
-\fR:\fBnu
-\0\0\fR10\0 This is line 10
-\*c
-.fi
-T}
-.SP
-\fR(.)\fBopen o T{
-Too involved to discuss here,
-but if you enter open mode
-accidentally, press
-the \s-2ESC\s0 key followed by
-\fBq\fR to
-get back into normal editor
-command mode.
-\fIEdit\fP is designed to
-prevent accidental use of
-the open command.
-T}
-.SP
-\fBpreserve pre T{
-Saves a copy of the current buffer contents as though the system had
-just crashed. This is for use in an emergency when a
-.I write
-command has failed and you don't know how else to save your work.\(dg
-T} T{
-.nf
-:\fBpreserve\fR
-File preserved.
-:
-.fi
-T}
-.SP
-\fR(.,.)\fBprint p Prints the text of line(s). T{
-.nf
-:\fB+2,+3p\fR
-The second and third lines
-after the current line
-:
-.fi
-T}
-.TE
-.FS
-\(dg Seek assistance from a consultant as soon as possible
-after saving a file with the
-.I preserve
-command, because the file is saved on system storage space for only one week.
-.FE
-.SP
-.nf
-.TS
-ltw(1.0i) lt2w(0.40i)fB ltw(3.0i) ltw(1.8i).
-T{
-.nf
-\fBquit
-quit!
-.fi
-T} T{
-.nf
-q
-q!
-T} T{
-.fi
-\fREnds the editing session.
-You will receive a
-warning if you have changed the buffer
-since last writing its contents
-to the file. In this event you
-must either type \fBw\fR to write,
-or type \fBq!\fR to exit from
-the editor without saving your changes.
-T} T{
-.nf
-\fR:\fBq
-\fRNo write since last change
-:\fBq!
-\fR%
-.fi
-T}
-.SP
-\fR(.)\fBread \fIfile\fP r T{
-.fi
-\fRPlaces a copy of \fIfile\fR in the
-buffer after the specified line.
-Address 0 is permissible and causes
-the copy of \fIfile\fR to be placed
-at the beginning of the buffer.
-The \fIread\fP command does not
-erase any text already in the buffer.
-If no line number is specified,
-\fIfile\fR is placed after the
-current line.
-T} T{
-.nf
-\fR:\fB0r newfile
-\fR"newfile" 5 lines, 86 characters
-\*c
-.fi
-T}
-.SP
-\fBrecover \fIfile\fP rec T{
-.fi
-Retrieves a copy of the editor buffer
-after a system crash, editor crash,
-phone line disconnection, or
-\fIpreserve\fR command.
-T}
-.SP
-\fR(.,.)\fBsubstitute s T{
-.nf
-\fBsubstitute/\fIpattern\fB/\fIreplacement\fB/
-substitute/\fIpattern\fB/\fIreplacement\fB/gc
-.fi
-\fRReplaces the first occurrence of \fIpattern\fR
-on a line
-with \fIreplacement\fP.
-Including a \fBg\fR after the command
-changes all occurrences of \fIpattern\fP
-on the line.
-The \fBc\fR option allows the user to
-confirm each substitution before it is
-made; see the manual for details.
-T} T{
-.nf
-:\fB3p
-\fRLine 3 contains a misstake
-:\fBs/misstake/mistake/
-\fRLine 3 contains a mistake
-\*c
-.fi
-T}
-.TE
-.bp
-.TS
-cp10 cp10 cp10 cp10
-ltw(1.0i) lt2w(0.40i)fB ltw(3.0i) ltw(1.8i).
-Name Abbr Description Examples
-.sp 1.75
-\fBundo u T{
-.fi
-\fRReverses the changes made in
-the buffer by the last buffer-editing
-command.
-Note that this example contains
-a notification about the number of
-lines affected.
-T} T{
-.nf
-\fR:\fB1,15d
-\fR15 lines deleted
-new line number 1 is printed
-:\fBu
-\fR15 more lines in file ...
-old line number 1 is printed
-\*c
-.fi
-T}
-.SP
-\fR(1,$)\fBwrite \fIfile\fR w T{
-.fi
-\fRCopies data from the buffer onto
-a permanent file. If no \fIfile\fR
-is named, the current filename
-is used.
-The file is automatically created
-if it does not yet exist.
-A response containing the number of
-lines and characters in the file
-indicates that the write
-has been completed successfully.
-The editor's built-in protections
-against overwriting existing files
-will in some circumstances
-inhibit a write.
-The form \fBw!\fR forces the
-write, confirming that
-an existing file is to be overwritten.
-T} T{
-.nf
-\fR:\fBw
-\fR"file7" 64 lines, 1122 characters
-:\fBw file8
-\fR"file8" File exists ...
-:\fBw! file8
-\fR"file8" 64 lines, 1122 characters
-\*c
-.fi
-T}
-\fR(1,$)\fBwrite! \fIfile\fP w! \^ \^
-.TE
-.sp 0.5v
-.TS
-ltw(1.0i) lt2w(0.40i)fB ltw(3.0i) ltw(1.8i).
-\fR(.)\fBz \fIcount\fP z T{
-.fi
-\fRPrints a screen full of text starting
-with the line indicated;
-or, if \fIcount\fR is specified,
-prints that number of lines.
-Variants of the \fIz\fR command
-are described in the manual.
-T}
-.SP
-\fB!\fIcommand T{
-.fi
-Executes the remainder of the line
-after \fB!\fR as a \*U command.
-The buffer is unchanged by this, and
-control is returned to the editor when
-the execution of \fIcommand\fR is complete.
-T} T{
-.nf
-\fR:\fB!date
-\fRFri Jun 9 12:15:11 PDT 1978
-!
-\*c
-.fi
-T}
-.SP
-\fRcontrol-d T{
-.fi
-Prints the next \fIscroll\fR of text,
-normally half of a screen. See the
-manual for details of the \fIscroll\fR
-option.
-T}
-.SP
-\fR(.+1)<cr> T{
-.fi
-An address alone followed by a carriage
-return causes the line to be printed.
-A carriage return by itself prints the
-line following the current line.
-T} T{
-.nf
-:\fR<cr>
-the line after the current line
-\*c
-.fi
-T}
-.TE
-.sp 0.5v
-.TS
-ltw(1.0i) lt2w(0.40i)fB ltw(3.0i) ltw(1.8i).
-\fB/\fIpattern\fB/ T{
-.fi
-\fRSearches for the next line in which
-\fIpattern\fR occurs and prints it.
-T} T{
-.nf
-\fR:\fB/This pattern/
-\fRThis pattern next occurs here.
-\*c
-.fi
-T}
-.SP
-\fB// T{
-Repeats the most recent search.
-T} T{
-.nf
-\fR:\fB//
-\fRThis pattern also occurs here.
-\*c
-.fi
-T}
-.SP
-\fB?\fIpattern\fB? T{
-Searches in the reverse direction
-for \fIpattern\fP.
-T}
-.SP
-\fB?? T{
-Repeats the most recent search,
-moving in the reverse direction
-through the buffer.
-T}
-.TE
-
diff --git a/usr.bin/vi/USD.doc/vi.man/Makefile b/usr.bin/vi/USD.doc/vi.man/Makefile
deleted file mode 100644
index fd89b8e3169..00000000000
--- a/usr.bin/vi/USD.doc/vi.man/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-# @(#)Makefile 8.5 (Berkeley) 7/16/94
-
-SRCS= vi.1
-DOCS= vi.0 vi.0.ps
-
-all: ${DOCS}
-
-vi.0: vi.1
- groff -man -Tascii < vi.1 > $@
-vi.0.ps: vi.1
- groff -man < vi.1 > $@
-
-clean:
- rm -f ${DOCS}
diff --git a/usr.bin/vi/USD.doc/vi.man/vi.1 b/usr.bin/vi/USD.doc/vi.man/vi.1
deleted file mode 100644
index 25f2a2ce0f3..00000000000
--- a/usr.bin/vi/USD.doc/vi.man/vi.1
+++ /dev/null
@@ -1,1294 +0,0 @@
-.\" Copyright (c) 1994
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)vi.1 8.12 (Berkeley) 7/15/94
-.\"
-.Dd "July 15, 1994"
-.Dt EX/VI 1
-.Os
-.Sh NAME
-.Nm ex, vi, view
-.Nd text editors
-.Sh SYNOPSIS
-.Nm \&ex
-.Op Fl eFRrsv
-.Op Fl c Ar cmd
-.Op Fl t Ar tag
-.Op Fl w Ar size
-.\".Op Fl X Ar \&aw
-.Op Ar "file ..."
-.Nm \&vi
-.Op Fl eFRrv
-.Op Fl c Ar cmd
-.Op Fl t Ar tag
-.Op Fl w Ar size
-.\".Op Fl X Ar \&aw
-.Op Ar "file ..."
-.Nm view
-.Op Fl eFRrv
-.Op Fl c Ar cmd
-.Op Fl t Ar tag
-.Op Fl w Ar size
-.\".Op Fl X Ar \&aw
-.Op Ar "file ..."
-.Sh DESCRIPTION
-.Nm \&Vi
-is a screen oriented text editor.
-.Nm \&Ex
-is a line-oriented text editor.
-.Nm \&Ex
-and
-.Nm \&vi
-are different interfaces to the same program,
-and it is possible to switch back and forth during an edit session.
-.Nm View
-is the equivalent of using the
-.Fl R
-(read-only) option of
-.Nm \&vi .
-.Pp
-This manual page is the one provided with the
-.Nm nex/nvi
-versions of the
-.Nm ex/vi
-text editors.
-.Nm Nex/nvi
-are intended as bug-for-bug compatible replacements for the original
-Fourth Berkeley Software Distribution (4BSD)
-.Nm \&ex
-and
-.Nm \&vi
-programs.
-For the rest of this manual page,
-.Nm nex/nvi
-is used only when it's necessary to distinguish it from the historic
-implementations of
-.Nm ex/vi .
-.Pp
-This manual page is intended for users already familiar with
-.Nm ex/vi .
-Anyone else should almost certainly read a good tutorial on the
-editor before this manual page.
-If you're in an unfamiliar environment, and you absolutely have to
-get work done immediately, read the section after the options
-description, entitled
-.Dq "Fast Startup" .
-It's probably enough to get you going.
-.Pp
-The following options are available:
-.Bl -tag -width Ds
-.It Fl c
-Execute
-.Ar cmd
-immediately after starting the edit session.
-Particularly useful for initial positioning in the file, however
-.Ar cmd
-is not limited to positioning commands.
-This is the POSIX 1003.2 interface for the historic
-.Dq "+cmd"
-syntax.
-.Nm Nex/nvi
-supports both the old and new syntax.
-.It Fl e
-Start editing in ex mode, as if the command name were
-.Nm \&ex .
-.It Fl F
-Don't copy the entire file when first starting to edit.
-(The default is to make a copy in case someone else modifies
-the file during your edit session.)
-.It Fl R
-Start editing in read-only mode, as if the command name was
-.Nm view ,
-or the readonly option was set.
-.It Fl r
-Recover the specified files, or, if no files are specified,
-list the files that could be recovered.
-If no recoverable files by the specified name exist,
-the file is edited as if the
-.Fl r
-option had not been specified.
-.It Fl s
-Enter batch mode; applicable only to
-.Nm \&ex
-edit sessions.
-Batch mode is useful when running
-.Nm \&ex
-scripts.
-Prompts, informative messages and other user oriented message
-are turned off,
-and no startup files or environmental variables are read.
-This is the POSIX 1003.2 interface for the historic
-.Dq \&\-
-argument.
-.Nm \&Nex/nvi
-supports both the old and new syntax.
-.It Fl t
-Start editing at the specified tag.
-(See
-.Xr ctags 1 ).
-.It Fl w
-Set the initial window size to the specified number of lines.
-.It Fl v
-Start editing in vi mode, as if the command name was
-.Nm \&vi
-or
-.Nm view .
-.It Fl X
-Reserved for X11 interfaces.
-.Em "No X11 support is currently implemented."
-.El
-.Pp
-Command input for
-.Nm ex/vi
-is read from the standard input.
-In the
-.Nm \&vi
-interface, it is an error if standard input is not a terminal.
-In the
-.Nm \&ex
-interface, if standard input is not a terminal,
-.Nm \&ex
-will read commands from it regardless, however, the session will be a
-batch mode session, exactly as if the
-.Fl s
-option had been specified.
-.Pp
-.Nm Ex/vi
-exits 0 on success, and greater than 0 if an error occurs.
-.Sh FAST STARTUP
-This section will tell you the minimum amount that you need to
-do simple editing tasks using
-.Nm \&vi .
-If you've never used any screen editor before, you're likely to have
-problems even with this simple introduction.
-In that case you should find someone that already knows
-.Nm \&vi
-and have them walk you through this section.
-.Pp
-.Nm \&Vi
-is a screen editor.
-This means that it takes up almost the entire screen, displaying part
-of the file on each screen line, except for the last line of the screen.
-The last line of the screen is used for you to give commands to
-.Nm \&vi ,
-and for
-.Nm \&vi
-to give information to you.
-.Pp
-The other fact that you need to understand is that
-.Nm \&vi
-is a modeful editor, i.e. you are either entering text or you
-are executing commands, and you have to be in the right mode
-to do one or the other.
-You will be in command mode when you first start editing a file.
-There are commands that switch you into input mode.
-There is only one key that takes you out of input mode,
-and that is the <escape> key.
-(Key names are written using less-than and greater-than signs, e.g.
-<escape> means the
-.Dq escape
-key, usually labeled
-.Dq esc
-on your terminal's keyboard.)
-If you're ever confused as to which mode you're in,
-keep entering the <escape> key until
-.Nm \&vi
-beeps at you.
-(Generally,
-.Nm \&vi
-will beep at you if you try and do something that's not allowed.
-It will also display error messages.)
-.Pp
-To start editing a file, enter the command
-.Dq Li "vi file_name<carriage-return>" .
-The command you should enter as soon as you start editing is
-.Dq Li ":set verbose showmode<carriage-return>" .
-This will make the editor give you verbose error messages and display
-the current mode at the bottom of the screen.
-.Pp
-The commands to move around the file are:
-.Bl -tag -width XXXX -compact
-.It Sy h
-Move the cursor left one character.
-.It Sy j
-Move the cursor down one line.
-.It Sy k
-Move the cursor up one line.
-.It Sy l
-Move the cursor right one character.
-.It Sy <cursor-arrows>
-The cursor arrow keys should work, too.
-.It Sy /text<carriage-return>
-Search for the string
-.Dq text
-in the file, and move the cursor to its first character.
-.El
-.Pp
-The commands to enter new text are:
-.Bl -tag -width XXXX -compact
-.It Sy a
-Append new text,
-.Em after
-the cursor.
-.It Sy i
-Insert new text,
-.Em before
-the cursor.
-.It Sy o
-Open a new line below the line the cursor is on, and start
-entering text.
-.It Sy O
-Open a new line above the line the cursor is on, and start
-entering text.
-.It Sy <escape>
-Once you've entered input mode using the one of the
-.Sy \&a ,
-.Sy \&i ,
-.Sy \&O ,
-or
-.Sy \&o
-commands, use
-.Sy <escape>
-to quit entering text and return to command mode.
-.El
-.Pp
-The commands to copy text are:
-.Bl -tag -width XXXX -compact
-.It Sy yy
-Copy the line the cursor is on.
-.It Sy p
-Append the copied line after the line the cursor is on.
-.El
-.Pp
-The commands to delete text are:
-.Bl -tag -width XXXX -compact
-.It Sy dd
-Delete the line the cursor is on.
-.It Sy x
-Delete the character the cursor is on.
-.El
-.Pp
-The commands to write the file are:
-.Bl -tag -width XXXX -compact
-.It Sy :w<carriage-return>
-Write the file back to the file with the name that you originally used
-as an argument on the
-.Nm \&vi
-command line.
-.It Sy :w file_name<carriage-return>
-Write the file back to the file with the name
-.Dq file_name .
-.El
-.Pp
-The commands to quit editing and exit the editor are:
-.Bl -tag -width XXXX -compact
-.It Sy :q<carriage-return>
-Quit editing and leave vi (if you've modified the file, but not
-saved your changes,
-.Nm \&vi
-will refuse to quit).
-.It Sy :q!<carriage-return>
-Quit, discarding any modifications that you may have made.
-.El
-.Pp
-One final caution.
-Unusual characters can take up more than one column on the screen,
-and long lines can take up more than a single screen line.
-The above commands work on
-.Dq physical
-characters and lines, i.e. they affect the entire line no matter
-how many screen lines it takes up and the entire character no matter
-how many screen columns it takes up.
-.Sh VI COMMANDS
-The following section describes the commands available in the command
-mode of the
-.Nm \&vi
-editor.
-In each entry below, the tag line is a usage synopsis for the command
-character.
-.sp
-.Bl -tag -width "XXXX" -compact
-.It Sy "[count] <control-A>"
-Search forward
-.Li count
-times for the current word.
-.It Sy "[count] <control-B>"
-Page backwards
-.Li count
-screens.
-.It Sy "[count] <control-D>"
-Scroll forward
-.Li count
-lines.
-.It Sy "[count] <control-E>"
-Scroll forward
-.Li count
-lines, leaving the current line and column as is, if possible.
-.It Sy "[count] <control-F>"
-Page forward
-.Li count
-screens.
-.It Sy "<control-G>"
-Display the file information.
-.It Sy "<control-H>"
-.It Sy "[count] h"
-Move the cursor back
-.Li count
-characters in the current line.
-.It Sy "[count] <control-J>"
-.It Sy "[count] <control-N>"
-.It Sy "[count] j"
-Move the cursor down
-.Li count
-lines without changing the current column.
-.It Sy "<control-L>"
-.It Sy "<control-R>"
-Repaint the screen.
-.It Sy "[count] <control-M>"
-.It Sy "[count] +"
-Move the cursor down
-.Li count
-lines to the first nonblank character of that line.
-.It Sy "[count] <control-P>"
-.It Sy "[count] k"
-Move the cursor up
-.Li count
-lines, without changing the current column.
-.It Sy "<control-T>"
-Return to the most recent tag context.
-.It Sy "<control-U>"
-Scroll backwards
-.Li count
-lines.
-.It Sy "<control-W>"
-Switch to the next lower screen in the window, or, to the first
-screen if there are no lower screens in the window.
-.It Sy "<control-Y>"
-Scroll backwards
-.Li count
-lines, leaving the current line and column as is, if possible.
-.It Sy "<control-Z>"
-Suspend the current editor session.
-.It Sy "<escape>"
-Execute
-.Nm \&ex
-commands or cancel partial commands.
-.It Sy "<control-]>"
-Push a tag reference onto the tag stack.
-.It Sy "<control-^>"
-Switch to the most recently edited file.
-.It Sy "[count] <space>"
-.It Sy "[count] l"
-Move the cursor forward
-.Li count
-characters without changing the current line.
-.It Sy "[count] ! motion shell-argument(s)"
-Replace text with results from a shell command.
-.It Sy "[count] # +|-|#"
-Increment or decrement the cursor number.
-.It Sy "[count] $"
-Move the cursor to the end of a line.
-.It Sy "%"
-Move to the matching character.
-.It Sy "&"
-Repeat the previous substitution command on the current line.
-.It Sy "'<character>"
-.It Sy "`<character>"
-Return to a context marked by the character
-.Li <character> .
-.It Sy "[count] ("
-Back up
-.Li count
-sentences.
-.It Sy "[count] )"
-Move forward
-.Li count
-sentences.
-.It Sy "[count] ,"
-Reverse find character
-.Li count
-times.
-.It Sy "[count] -"
-Move to first nonblank of the previous line,
-.Li count
-times.
-.It Sy "[count] ."
-Repeat the last
-.Nm \&vi
-command that modified text.
-.It Sy "/RE<carriage-return>"
-.It Sy "/RE/ [offset]<carriage-return>"
-.It Sy "?RE<carriage-return>"
-.It Sy "?RE? [offset]<carriage-return>"
-.It Sy "N"
-.It Sy "n"
-Search forward or backward for a regular expression.
-.It Sy "0"
-Move to the first character in the current line.
-.It Sy ":"
-Execute an ex command.
-.It Sy "[count] ;"
-Repeat the last character find
-.Li count
-times.
-.It Sy "[count] < motion"
-.It Sy "[count] > motion"
-Shift lines left or right.
-.It Sy "@ buffer"
-Execute a named buffer.
-.It Sy "[count] A"
-Enter input mode, appending the text after the end of the line.
-.It Sy "[count] B"
-Move backwards
-.Li count
-bigwords.
-.It Sy "[buffer] [count] C"
-Change text from the current position to the end-of-line.
-.It Sy "[buffer] D"
-Delete text from the current position to the end-of-line.
-.It Sy "[count] E"
-Move forward
-.Li count
-end-of-bigwords.
-.It Sy "[count] F <character>"
-Search
-.Li count
-times backward through the current line for
-.Li <character> .
-.It Sy "[count] G"
-Move to line
-.Li count ,
-or the last line of the file if
-.Li count
-not specified.
-.It Sy "[count] H"
-Move to the screen line
-.Li "count - 1"
-lines below the top of the screen.
-.It Sy "[count] I"
-Enter input mode, inserting the text at the beginning of the line.
-.It Sy "[count] J"
-Join lines.
-.It Sy "[count] L"
-Move to the screen line
-.Li "count - 1"
-lines above the bottom of the screen.
-.It Sy " M"
-Move to the screen line in the middle of the screen.
-.It Sy "[count] O"
-Enter input mode, appending text in a new line above the current line.
-.It Sy "[buffer] P"
-Insert text from a buffer.
-.It Sy "Q"
-Exit
-.Nm \&vi
-(or visual) mode and switch to
-.Nm \&ex
-mode.
-.It Sy "[count] R"
-Enter input mode, replacing the characters in the current line.
-.It Sy "[buffer] [count] S"
-Substitute
-.Li count
-lines.
-.It Sy "[count] T <character>"
-Search backwards,
-.Li count
-times,
-through the current line for the character
-.Em after
-the specified
-.Li <character> .
-.It Sy "U"
-Restore the current line to its state before the cursor last
-moved to it.
-.It Sy "[count] W"
-Move forward
-.Li count
-bigwords.
-.It Sy "[buffer] [count] X"
-Delete
-.Li count
-characters before the cursor.
-.It Sy "[buffer] [count] Y"
-Copy (or
-.Dq yank )
-.Li count
-lines into the specified buffer.
-.It Sy "ZZ"
-Write the file and exit
-.Nm \&vi .
-.It Sy "[count] [["
-Back up
-.Li count
-section boundaries.
-.It Sy "[count] ]]"
-Move forward
-.Li count
-section boundaries.
-.It Sy "\&^"
-Move to first nonblank character on the current line.
-.It Sy "[count] _"
-Move down
-.Li "count - 1"
-lines, to the first nonblank character.
-.It Sy "[count] a"
-Enter input mode, appending the text after the cursor.
-.It Sy "[count] b"
-Move backwards
-.Li count
-words.
-.It Sy "[buffer] [count] c motion"
-Change a region of text.
-.It Sy "[buffer] [count] d motion"
-Delete a region of text.
-.It Sy "[count] e"
-Move forward
-.Li count
-end-of-words.
-.It Sy "[count] f<character>"
-Search forward,
-.Li count
-times, through the rest of the current line for
-.Li <character> .
-.It Sy "[count] i"
-Enter input mode, inserting the text before the cursor.
-.It Sy "m <character>"
-Save the current context (line and column) as
-.Li <character> .
-.It Sy "[count] o"
-Enter input mode, appending text in a new line under the current line.
-.It Sy "[buffer] p"
-Append text from a buffer.
-.It Sy "[count] r <character>
-Replace
-.Li count
-characters.
-.It Sy "[buffer] [count] s"
-Substitute
-.Li count
-characters in the current line starting with the current character.
-.It Sy "[count] t <character>"
-Search forward,
-.Li count
-times, through the current line for the character immediately
-.Em before
-.Li <character> .
-.It Sy "u"
-Undo the last change made to the file.
-.It Sy "[count] w"
-Move forward
-.Li count
-words.
-.It Sy "[buffer] [count] x"
-Delete
-.Li count
-characters.
-.It Sy "[buffer] [count] y motion"
-Copy (or
-.Dq yank )
-a text region specified by the
-.Li count
-and motion into a buffer.
-.It Sy "[count1] z [count2] -|.|+|^|<carriage-return>"
-Redraw, optionally repositioning and resizing the screen.
-.It Sy "[count] {"
-Move backward
-.Li count
-paragraphs.
-.It Sy "[count] |"
-Move to a specific
-.Em column
-position on the current line.
-.It Sy "[count] }"
-Move forward
-.Li count
-paragraphs.
-.It Sy "[count] ~"
-Reverse the case of the next
-.Li count
-character(s).
-.It Sy "[count] ~ motion"
-Reverse the case of the characters in a text region specified by the
-.Li count
-and
-.Li motion .
-.It Sy "<interrupt>"
-Interrupt the current operation.
-.El
-.Sh VI TEXT INPUT COMMANDS
-The following section describes the commands available in the text
-input mode of the
-.Nm \&vi
-editor.
-.Pp
-.Bl -tag -width "XXXX" -compact
-.It Sy "<nul>"
-Replay the previous input.
-.It Sy "<control-D>"
-Erase the previous autoindent character.
-.It Sy "^<control-D>"
-Erase all of the autoindent characters, and reset the autoindent level.
-.It Sy "0<control-D>"
-Erase all of the autoindent characters.
-.It Sy "<control-T>"
-Insert sufficient
-.Li <tab>
-and
-.Li <space>
-characters to move the cursor forward to a column immediately
-after the next column which is an even multiple of the
-.Sy shiftwidth
-option.
-.It Sy "<erase>
-.It Sy "<control-H>"
-Erase the last character.
-.It Sy "<literal next>"
-Quote the next character.
-.It Sy "<escape>
-Resolve all text input into the file, and return to command mode.
-.It Sy "<line erase>
-Erase the current line.
-.It Sy "<control-W>"
-.It Sy "<word erase>
-Erase the last word.
-The definition of word is dependent on the
-.Sy altwerase
-and
-.Sy ttywerase
-options.
-.It Sy "<control-X>[0-9A-Fa-f]*"
-Insert a character with the specified hexadecimal value into the text.
-.It Sy "<interrupt>"
-Interrupt text input mode, returning to command mode.
-.El
-.Sh EX COMMANDS
-The following section describes the commands available in the
-.Nm \&ex
-editor.
-In each entry below, the tag line is a usage synopsis for the command.
-.sp
-.Bl -tag -width "XXXX" -compact
-.It Sy "<end-of-file>"
-Scroll the screen.
-.It Sy "! argument(s)"
-.It Sy "[range]! argument(s)"
-Execute a shell command, or filter lines through a shell command.
-.It Sy \&"
-A comment.
-.It Sy "[range] nu[mber] [count] [flags]"
-.It Sy "[range] # [count] [flags]"
-Display the selected lines, each preceded with its line number.
-.It Sy "@ buffer"
-.It Sy "* buffer"
-Execute a buffer.
-.It Sy "[range] d[elete] [buffer] [count] [flags]"
-Delete the lines from the file.
-.It Sy "di[splay] b[uffers] | s[creens] | t[ags]"
-Display buffers, screens or tags.
-.It Sy "e[dit][!] [+cmd] [file]"
-.It Sy "ex[!] [+cmd] [file]"
-Edit a different file.
-.It Sy "exu[sage] [command]"
-Display usage for an
-.Nm \&ex
-command.
-.It Sy "f[ile] [file]"
-Display and optionally change the file name.
-.It Sy "fg [name]"
-.Nm \&Vi
-mode only.
-Foreground the specified screen.
-.It Sy "[range] g[lobal] /pattern/ [commands]"
-.It Sy "[range] v /pattern/ [commands]
-Apply commands to lines matching (or not matching) a pattern.
-.It Sy "he[lp]"
-Display a help message.
-.It Sy "[line] i[nsert][!]"
-The input text is inserted before the specified line.
-.It Sy "[range] j[oin][!] [count] [flags]"
-Join lines of text together.
-.It Sy "[range] l[ist] [count] [flags]"
-Display the lines unambiguously.
-.It Sy "map[!] [lhs rhs]"
-Define or display maps (for
-.Nm \&vi
-only).
-.It Sy "[line] ma[rk] <character>"
-.It Sy "[line] k <character>"
-Mark the line with the mark
-.Li <character> .
-.It Sy "[range] m[ove] line"
-Move the specified lines after the target line.
-.It Sy "mk[exrc][!] file"
-Write the abbreviations, editor options and maps to the specified
-file.
-.It Sy "n[ext][!] [file ...]"
-Edit the next file from the argument list.
-.It Sy "[line] o[pen] /pattern/ [flags]"
-Enter open mode.
-.It Sy "pre[serve]"
-Save the file in a form that can later be recovered using the
-.Nm \&ex
-.Fl r
-option.
-.It Sy "prev[ious][!]"
-Edit the previous file from the argument list.
-.It Sy "[range] p[rint] [count] [flags]"
-Display the specified lines.
-.It Sy "[line] pu[t] [buffer]"
-Append buffer contents to the current line.
-.It Sy "q[uit][!]"
-End the editing session.
-.It Sy "[line] r[ead][!] [file]"
-Read a file.
-.It Sy "rec[over] file"
-Recover
-.Li file
-if it was previously saved.
-.It Sy "res[ize] [+|-]size"
-.Nm \&Vi
-mode only.
-Grow or shrink the current screen.
-.It Sy "rew[ind][!]"
-Rewind the argument list.
-.It Sy "se[t] [option[=[value]] ...] [nooption ...] [option? ...] [all]"
-Display or set editor options.
-.It Sy "sh[ell]"
-Run a shell program.
-.It Sy "so[urce] file"
-Read and execute
-.Nm \&ex
-commands from a file.
-.It Sy "sp[lit] [file ...]"
-.Nm \&Vi
-mode only.
-Split the screen.
-.It Sy "[range] s[ubstitute] [/pattern/replace/] [options] [count] [flags]"
-.It Sy "[range] & [options] [count] [flags]"
-.It Sy "[range] ~ [options] [count] [flags]"
-Make substitutions.
-.It Sy "su[spend][!]"
-.It Sy "st[op][!]"
-.It Sy <suspend>
-Suspend the edit session.
-.It Sy "ta[g][!] tagstring"
-Edit the file containing the specified tag.
-.It Sy "tagp[op][!] [file | number]"
-Pop to the specified tag in the tags stack.
-.It Sy "unm[ap][!] lhs"
-Unmap a mapped string.
-.It Sy "ve[rsion]"
-Display the version of the
-.Nm \&ex/vi
-editor.
-.It Sy "[line] vi[sual] [type] [count] [flags]"
-.Nm \&Ex
-mode only.
-Enter
-.Nm \&vi .
-.It Sy "vi[sual][!] [+cmd] [file]"
-.Nm \&Vi
-mode only.
-Edit a new file.
-.It Sy "viu[sage] [command]"
-Display usage for a
-.Nm \&vi
-command.
-.It Sy "[range] w[rite][!] [>>] [file]"
-.It Sy "[range] w[rite] [!] [file]"
-.It Sy "[range] wn[!] [>>] [file]"
-.It Sy "[range] wq[!] [>>] [file]"
-Write the file.
-.It Sy "[range] x[it][!] [file]"
-Write the file if it has been modified.
-.It Sy "[range] ya[nk] [buffer] [count]"
-Copy the specified lines to a buffer.
-.It Sy "[line] z [type] [count] [flags]"
-Adjust the window.
-.El
-.Sh SET OPTIONS
-There are a large number of options that may be set (or unset) to
-change the editor's behavior.
-This section describes the options, their abbreviations and their
-default values.
-.Pp
-In each entry below, the first part of the tag line is the full name
-of the option, followed by any equivalent abbreviations.
-The part in square brackets is the default value of the option.
-Most of the options are boolean, i.e. they are either on or off,
-and do not have an associated value.
-.Pp
-Options apply to both
-.Nm \&ex
-and
-.Nm \&vi
-modes, unless otherwise specified.
-.sp
-.Bl -tag -width "XXXX" -compact
-.It Sy "altwerase [off]"
-.Nm \&Vi
-only.
-Select an alternate word erase algorithm.
-.It Sy "autoindent, ai [off]"
-Automatically indent new lines.
-.It Sy "autoprint, ap [off]"
-.Nm \&Ex
-only.
-Display the current line automatically.
-.It Sy "autowrite, aw [off]"
-Write modified files automatically when changing files.
-.It Sy "beautify, bf [off]"
-Discard control characters.
-.It Sy "cdpath [environment variable CDPATH, or current directory]"
-The directory paths used as path prefixes for the
-.Sy cd
-command.
-.It Sy "columns, co [80]"
-Set the number of columns in the screen.
-.It Sy "comment [off]"
-.Nm \&Vi
-only.
-Skip leading comments in files.
-.It Sy "directory, dir [environment variable TMPDIR, or /tmp]"
-The directory where temporary files are created.
-.It Sy "edcompatible, ed [off]"
-Remember the values of the
-.Dq \&c
-and
-.Dq \&g
-suffices to the
-.Sy substitute
-commands, instead of initializing them as unset for each new
-command.
-.It Sy "errorbells, eb [off]"
-.Nm \&Ex
-only.
-Announce error messages with a bell.
-.It Sy "exrc, ex [off]"
-Never read startup files in the local directory.
-.It Sy "extended [off]"
-Regular expressions are extended (i.e.
-.Xr egrep 1
-style) expressions.
-.It Sy "flash [on]"
-Flash the screen instead of beeping the keyboard on error.
-.It Sy "hardtabs, ht [8]"
-Set the spacing between hardware tab settings.
-.It Sy "ignorecase, ic [off]"
-Ignore case differences in regular expressions.
-.It Sy "keytime [6]"
-The 10th's of a second
-.Nm ex/vi
-waits for a subsequent key to complete a key mapping.
-.It Sy "leftright [off]"
-.Nm \&Vi
-only.
-Do left-right scrolling.
-.It Sy "lines, li [24]"
-.Nm \&Vi
-only.
-Set the number of lines in the screen.
-.It Sy "lisp [off]"
-.Nm \&Vi
-only.
-Modify various search commands and options to work with Lisp.
-.Pp
-.Em "This option is not yet implemented."
-.It Sy "list [off]"
-Display lines in an unambiguous fashion.
-.It Sy "magic [on]"
-Treat certain characters specially in regular expressions.
-.It Sy "matchtime [7]"
-.Nm \&Vi
-only.
-The 10th's of a second
-.Nm ex/vi
-pauses on the matching character when the
-.Sy showmatch
-option is set.
-.It Sy "mesg [on]"
-Permit messages from other users.
-.It Sy "modelines, modeline [off]"
-Read the first and last few lines of each file for
-.Nm ex
-commands.
-.Pp
-.Em "This option will never be implemented."
-.It Sy "number, nu [off]"
-Precede each line displayed with its current line number.
-.It Sy "octal [off]"
-Display unknown characters as octal numbers, instead of the default
-hexadecimal.
-.It Sy "open [on]"
-.Nm \&Ex
-only.
-If this option is not set, the
-.Sy open
-and
-.Sy visual
-commands are disallowed.
-.It Sy "optimize, opt [on]"
-.Nm \&Vi
-only.
-Optimize text throughput to dumb terminals.
-.Pp
-.Em "This option is not yet implemented."
-.It Sy "paragraphs, para [IPLPPPQPP LIpplpipbp]"
-.Nm \&Vi
-only.
-Define additional paragraph boundaries for the
-.Sy \&{
-and
-.Sy \&}
-commands.
-.It Sy "prompt [on]"
-.Nm \&Ex
-only.
-Display a command prompt.
-.It Sy "readonly, ro [off]"
-Mark the file as read-only.
-.It Sy "recdir [/var/tmp/vi.recover]"
-The directory where recovery files are stored.
-.It Sy "redraw, re [off]"
-.Nm \&Vi
-only.
-Simulate an intelligent terminal on a dumb one.
-.Pp
-.Em "This option is not yet implemented."
-.It Sy "remap [on]"
-Remap keys until resolved.
-.It Sy "report [5]"
-Set the number of lines about which the editor reports changes
-or yanks.
-.It Sy "ruler [off]"
-.Nm \&Vi
-only.
-Display a row/column ruler on the colon command line.
-.It Sy "scroll, scr [window / 2]"
-Set the number of lines scrolled.
-.It Sy "sections, sect [NHSHH HUnhsh]"
-.Nm \&Vi
-only.
-Define additional section boundaries for the
-.Sy \&[[
-and
-.Sy \&]]
-commands.
-.It Sy "shell, sh [environment variable SHELL, or /bin/sh]"
-Select the shell used by the editor.
-.It Sy "shiftwidth, sw [8]"
-Set the autoindent and shift command indentation width.
-.It Sy "showdirty [off]"
-.Nm \&Vi
-only.
-Display an asterisk on the colon command line if the file has been modified.
-.It Sy "showmatch, sm [off]"
-.Nm \&Vi
-only.
-Note matching
-.Dq \&{
-and
-.Dq \&(
-for
-.Dq \&}
-and
-.Dq \&)
-characters.
-.It Sy "showmode [off]"
-.Nm \&Vi
-only.
-Display the current editor mode (command or input).
-.It Sy "sidescroll [16]"
-.Nm \&Vi
-only.
-Set the amount a left-right scroll will shift.
-.It Sy "slowopen, slow [off]"
-Delay display updating during text input.
-.Pp
-.Em "This option is not yet implemented."
-.It Sy "sourceany [off]"
-Read startup files not owned by the current user.
-.Pp
-.Em "This option will never be implemented."
-.It Sy "tabstop, ts [8]"
-This option sets tab widths for the editor display.
-.It Sy "taglength, tl [0]"
-Set the number of significant characters in tag names.
-.It Sy "tags, tag [tags /var/db/libc.tags /sys/kern/tags]"
-Set the list of tags files.
-.It Sy "term, ttytype, tty [environment variable TERM]"
-Set the terminal type.
-.It Sy "terse [off]"
-This option has historically made editor messages less verbose.
-It has no effect in this implementation.
-.It Sy "tildeop"
-Modify the
-.Sy \&~
-command to take an associated motion.
-.It Sy "timeout, to [on]"
-Time out on keys which may be mapped.
-.It Sy "ttywerase [off]"
-.Nm \&Vi
-only.
-Select an alternate erase algorithm.
-.It Sy "verbose [off]"
-.NM \&Vi
-only.
-Display an error message for every error.
-.It Sy "w300 [no default]"
-.Nm \&Vi
-only.
-Set the window size if the baud rate is less than 1200 baud.
-.It Sy "w1200 [no default]"
-.Nm \&Vi
-only.
-Set the window size if the baud rate is equal to 1200 baud.
-.It Sy "w9600 [no default]"
-.Nm \&Vi
-only.
-Set the window size if the baud rate is greater than 1200 baud.
-.It Sy "warn [on]"
-.Nm \&Ex
-only.
-This option causes a warning message to the terminal if the file has
-been modified, since it was last written, before a
-.Sy \&!
-command.
-.It Sy "window, w, wi [environment variable LINES]"
-Set the window size for the screen.
-.It Sy "wrapmargin, wm [0]"
-.Nm \&Vi
-only.
-Break lines automatically when they reach the right-hand margin.
-.It Sy "wrapscan, ws [on]"
-Set searches to wrap around the end or beginning of the file.
-.It Sy "writeany, wa [off]"
-Turn off file-overwriting checks.
-.El
-.Sh ENVIRONMENTAL VARIABLES
-.Bl -tag -width "COLUMNSXX" -compact
-.It Ev COLUMNS
-The number of columns on the screen.
-This value overrides any system or terminal specific values.
-If the COLUMNS environmental variable is not set when
-.Nm ex/vi
-runs, or the
-.Sy columns
-option is explicitly reset by the user,
-.Nm ex/vi
-enters the value into the environment.
-.It Ev EXINIT
-A list of
-.Nm \&ex
-startup commands, read if the variable
-.Ev NEXINIT
-is not set.
-.It Ev HOME
-The user's home directory, used as the initial directory path
-for the startup
-.Pa $HOME/.nexrc
-and
-.Pa $HOME/.exrc
-files.
-This value is also used as the default directory for the
-.Nm \&vi
-.Sy \&cd
-command.
-.It Ev LINES
-The number of rows on the screen.
-This value overrides any system or terminal specific values.
-If the LINES environmental variable is not set when
-.Nm ex/vi
-runs, or the
-.Sy lines
-option is explicitly reset by the user,
-.Nm ex/vi
-enters the value into the environment.
-.It Ev NEXINIT
-A list of
-.Nm \&ex
-startup commands.
-.It Ev SHELL
-The user's shell of choice (see also the
-.Sy shell
-option).
-.It Ev TERM
-The user's terminal type.
-The default is the type
-.Dq unknown .
-If the TERM environmental variable is not set when
-.Nm ex/vi
-runs, or the
-.Sy term
-option is explicitly reset by the user,
-.Nm ex/vi
-enters the value into the environment.
-.It Ev TMPDIR
-The location used to stored temporary files (see also the
-.Sy directory
-option).
-.El
-.Sh ASYNCHRONOUS EVENTS
-.Bl -tag -width "SIGWINCHXX" -compact
-.It SIGALRM
-.Nm \&Vi/ex
-uses this signal for periodic backups of file modifications
-and to display
-.Dq busy
-messages when operations are likely to take a long time.
-.It SIGHUP
-.It SIGTERM
-If the current buffer has changed since it was last written in its
-entirety, the editor attempts to save the modified file so it can
-be later recovered.
-See the
-.Nm \&vi/ex
-Reference manual section entitled
-.Dq Recovery
-for more information.
-.It SIGINT
-When an interrupt occurs,
-the current operation is halted,
-and the editor returns to the command level.
-If interrupted during text input,
-the text already input is resolved into the file as if the text
-input had been normally terminated.
-.It SIGWINCH
-The screen is resized.
-See the
-.Nm \&vi/ex
-Reference manual section entitled
-.Dq "Sizing the Screen"
-for more information.
-.It SIGCONT
-.It SIGQUIT
-.It SIGTSTP
-.Nm \&Vi/ex
-ignores these signals.
-.El
-.Sh BUGS
-See the file
-.Pa nvi/docs/bugs.current
-for a list of the known bugs in this version.
-.Sh FILES
-.Bl -tag -width /var/tmp/vi.recover -compact
-.It Pa /bin/sh
-The default user shell.
-.It Pa /etc/vi.exrc
-System-wide vi startup file.
-.It Pa /tmp
-Temporary file directory.
-.It Pa /var/tmp/vi.recover
-The default recovery file directory.
-.It Pa $HOME/.nexrc
-1st choice for user's home directory startup file.
-.It Pa $HOME/.exrc
-2nd choice for user's home directory startup file.
-.It Pa .nexrc
-1st choice for local directory startup file.
-.It Pa .exrc
-2nd choice for local directory startup file.
-.El
-.Sh SEE ALSO
-.Xr ctags 1 ,
-.Xr more 1 ,
-.Xr curses 3 ,
-.Xr dbopen 3
-.sp
-The
-.Dq "Vi Quick Reference"
-card.
-.sp
-.Dq "\&An Introduction to Display Editing with Vi" ,
-found in the
-.Dq "UNIX User's Manual Supplementary Documents"
-section of both the 4.3BSD and 4.4BSD manual sets.
-This document is the closest thing available to an introduction to the
-.Nm \&vi
-screen editor.
-.sp
-.Dq "\&Ex Reference Manual (Version 3.7)" ,
-found in the
-.Dq "UNIX User's Manual Supplementary Documents"
-section of both the 4.3BSD and 4.4BSD manual sets.
-This document is the final reference for the
-.Nm \&ex
-editor, as distributed in most historic 4BSD and System V systems.
-.sp
-.Dq "Edit: A tutorial" ,
-found in the
-.Dq "UNIX User's Manual Supplementary Documents"
-section of the 4.3BSD manual set.
-This document is an introduction to a simple version of the
-.Nm \&ex
-screen editor.
-.sp
-.Dq "\&Ex/Vi Reference Manual" ,
-found in the
-.Dq "UNIX User's Manual Supplementary Documents"
-section of the 4.4BSD manual set.
-This document is the final reference for the
-.Nm \&nex/nvi
-text editors, as distributed in 4.4BSD and 4.4BSD-Lite.
-.Pp
-.Nm Roff
-source for all of these documents is distributed with
-.Nm nex/nvi
-in the
-.Pa nvi/USD.doc
-directory of the
-.Nm nex/nvi
-source code.
-.sp
-The files
-.Dq autowrite ,
-.Dq input ,
-.Dq quoting ,
-and
-.Dq structures ,
-found in the
-.Pa nvi/docs/internals
-directory of the
-.Nm nex/nvi
-source code.
-.Sh HISTORY
-The
-.Nm nex/nvi
-replacements for the
-.Nm ex/vi
-editor first appeared in 4.4BSD.
-.Sh STANDARDS
-.Nm \&Nex/nvi
-is close to IEEE Std1003.2 (``POSIX'').
-That document differs from historical
-.Nm ex/vi
-practice in several places; there are changes to be made on both sides.
diff --git a/usr.bin/vi/USD.doc/vitut/Makefile b/usr.bin/vi/USD.doc/vitut/Makefile
deleted file mode 100644
index 65c4746f58a..00000000000
--- a/usr.bin/vi/USD.doc/vitut/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 8/14/93
-
-DIR= usd/12.vi
-SRCS= vi.in vi.chars
-EXTRA= vi.apwh.ms vi.summary
-MACROS= -msU
-CLEANFILES+=summary.* viapwh.*
-
-paper.ps: ${SRCS} summary.ps viapwh.ps
- ${TBL} ${SRCS} | ${ROFF} > ${.TARGET}
-
-summary.ps: vi.summary
- ${TBL} vi.summary | ${ROFF} > ${.TARGET}
-
-viapwh.ps: vi.apwh.ms
- ${ROFF} vi.apwh.ms > ${.TARGET}
-
-.include <bsd.doc.mk>
diff --git a/usr.bin/vi/USD.doc/vitut/vi.apwh.ms b/usr.bin/vi/USD.doc/vitut/vi.apwh.ms
deleted file mode 100644
index d0b62611c70..00000000000
--- a/usr.bin/vi/USD.doc/vitut/vi.apwh.ms
+++ /dev/null
@@ -1,1079 +0,0 @@
-.\" Copyright (c) 1980, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)vi.apwh.ms 8.1 (Berkeley) 6/8/93
-.\"
-.TL
-Vi Command & Function Reference
-.AU CB 2675
-Alan P.W. Hewett
-.sp
-Revised for version 2.12 by Mark Horton
-.CB
-.NH 1
-Author's Disclaimer
-.LP
-This document does not claim to be 100% complete. There are a
-few commands listed in the original document that I was unable
-to test either because I do not speak \fBlisp\fR, because they
-required programs we don't have, or because I wasn't able to make
-them work. In these cases I left the command out. The commands
-listed in this document have been tried and are known to work.
-It is expected that prospective users of this document will read
-it once to get the flavor of everything that \fBvi\fR can do
-and then use it as a reference document. Experimentation is
-recommended. If you don't understand a command, try it and
-see what happens.
-.LP
-[Note: In revising this document, I have attempted to make it
-completely reflect version 2.12 of
-.B vi .
-It does not attempt to document the VAX version (version 3),
-but with one or two exceptions (wrapmargin, arrow keys)
-everything said about 2.12 should apply to 3.1.
-.I "Mark Horton" ]
-.NH 1
-Notation
-.LP
-\fB[option]\fR is used to denote optional parts of a command.
-Many \fBvi\fR commands have an optional count. \fB[cnt]\fR
-means that an optional number may precede the command to
-multiply or iterate the command.
-\fB{variable item}\fR is used to denote parts of the command
-which must appear, but can take a number of different values.
-\fB<character [-character]>\fR means that the character or
-one of the characters in the range described between the
-two angle brackets is to be typed.
-For example \fB<esc>\fR means
-the \fBescape\fR key is to be typed. \fB<a-z>\fR means that a
-lower case letter is to be typed. \fB^<character>\fR means that
-the character is to be typed as a \fBcontrol\fR character, that is,
-with the \fB<cntl>\fR key held down while simultaneously typing
-the specified character. In this document control characters will
-be denoted using the \fIupper case\fR character, but
-^<uppercase chr> and ^<lowercase chr> are equivalent. That is, for
-example, \fB<^D>\fR is equal to \fB<^d>\fR.
-The most common character abbreviations
-used in this list are as follows:
-.VL 8
-.IP <esc> 8
-escape, octal 033
-.IP <cr> 8
-carriage return, ^M, octal 015
-.IP <lf> 8
-linefeed ^J, octal 012
-.IP <nl> 8
-newline, ^J, octal 012 (same as linefeed)
-.IP <bs> 8
-backspace, ^H, octal 010
-.IP <tab> 8
-tab, ^I, octal 011
-.IP <bell> 8
-bell, ^G, octal 07
-.IP <ff> 8
-formfeed, ^L, octal 014
-.IP <sp> 8
-space, octal 040
-.IP <del> 8
-delete, octal 0177
-.LE
-.sp 1
-.NH 1
-Basics
-.LP
-To run \fBvi\fR the shell variable \fBTERM\fR must be defined and
-exported to your environment.
-How you do this depends on which shell you are using.
-You can tell which shell you have by the character it
-prompts you for commands with.
-The Bourne shell prompts with `$', and the C shell prompts with `%'.
-For these examples, we will suppose
-that you are using an HP 2621 terminal, whose termcap name is ``2621''.
-.NH 2
-Bourne Shell
-.LP
-To manually set your terminal type to 2621 you would type:
-.DS
-TERM=2621
-export TERM
-.DE
-.PP
-There are various ways of having this automatically or
-semi-automatically done when you log in.
-Suppose you usually dial in on a 2621.
-You want to tell this to the machine, but still have it
-work when you use a hardwired terminal.
-The recommended way, if you have the
-.B tset
-program, is to use the sequence
-.DS
-tset \-s \-d 2621 > tset$$
-\&. tset$$
-rm tset$$
-.DE
-in your .login (for csh) or the same thing using `.' instead of `source'
-in your .profile (for sh).
-The above line says that if you are dialing in you are on a 2621,
-but if you are on a hardwired terminal it figures out your terminal
-type from an on-line list.
-.NH 2
-The C Shell
-.LP
-To manually set your terminal type to 2621 you would type:
-.DS
-setenv TERM 2621
-.DE
-.PP
-There are various ways of having this automatically or
-semi-automatically done when you log in.
-Suppose you usually dial in on a 2621.
-You want to tell this to the machine, but still have it
-work when you use a hardwired terminal.
-The recommended way, if you have the
-.B tset
-program, is to use the sequence
-.DS
-tset \-s \-d 2621 > tset$$
-source tset$$
-rm tset$$
-.DE
-in your .login.*
-.FS
-* On a version 6 system
-without environments, the invocation of tset
-is simpler, just add the line ``tset \-d 2621''
-to your .login or .profile.
-.FE
-The above line says that if you are dialing in you are on a 2621,
-but if you are on a hardwired terminal it figures out your terminal
-type from an on-line list.
-.NH 1
-Normal Commands
-.LP
-\fBVi\fR is a visual editor with a window on the file. What
-you see on the screen is \fBvi\fR's current notion of
-what your file will contain,
-(at this point in the file),
-when it is written out.
-Most commands do not cause any change in the screen until the
-complete command is typed. Should you get confused while
-typing a command, you can abort the command by typing an
-<del> character. You will know you are back to command level
-when you hear a <bell>. Usually typing an <esc> will produce the
-same result. When \fBvi\fR gets an improperly formatted command
-it rings the <bell>.
-Following are the \fBvi\fR commands broken down by function.
-.NH 2
-Entry and Exit
-.LP
-To enter
-.B vi
-on a particular
-.I file ,
-type
-.DS
-\fBvi\fP \fIfile\fP
-.DE
-The file will be read in and the cursor will be placed at the beginning
-of the first line.
-The first screenfull of the file will be displayed on the terminal.
-.PP
-To get out of the editor, type
-.DS
-ZZ
-.DE
-If you are in some special mode, such as input mode
-or the middle of a multi-keystroke command, it may
-be necessary to type <esc> first.
-.NH 2
-Cursor and Page Motion
-.LP
-.VL 16
-.B NOTE:
-The arrow keys (see the next four commands)
-on certain kinds of terminals will not work with the
-PDP-11 version of vi. The control versions or the hjkl versions will
-work on any terminal. Experienced users prefer the hjkl keys because
-they are always right under their fingers. Beginners often prefer
-the arrow keys, since they do not require memorization of which hjkl
-key is which.
-The mnemonic value of hjkl is clear from looking at the keyboard of an adm3a.
-.sp
-.IP "[cnt]<bs> or [cnt]h or [cnt]\(<-" 16
-.br
-Move the cursor to the left one character. Cursor stops at the left
-margin of the page.
-If cnt is given, these commands move that many spaces.
-.IP "[cnt]^N or [cnt]j or [cnt]\(da or [cnt]<lf>" 16
-.br
-Move down one line.
-Moving off the screen scrolls the window to force a new line
-onto the screen.
-Mnemonic: \fBN\fRext
-.IP "[cnt]^P or [cnt]k or [cnt]\(ua" 16
-.br
-Move up one line.
-Moving off the top of the screen forces new text onto the screen.
-Mnemonic: \fBP\fRrevious
-.IP "[cnt]<sp> or [cnt]l or [cnt]\(->" 16
-.br
-Move to the right one character.
-Cursor will not go beyond the end of the line.
-.IP [cnt]- 16
-Move the cursor up the screen to the beginning of the next line.
-Scroll if necessary.
-.IP "[cnt]+ or [cnt]<cr>" 16
-.sp 1
-Move the cursor down the screen to the beginning of the next line.
-Scroll up if necessary.
-.IP "[cnt]$" 16
-Move the cursor to the end of the line.
-If there is a count, move to the end of the line "cnt" lines
-forward in the file.
-.IP "^" 16
-Move the cursor to the beginning of the first word on the line.
-.IP "0" 16
-Move the cursor to the left margin of the current line.
-.IP "[cnt]|" 16
-Move the cursor to the column specified by the count. The default is
-column zero.
-.IP "[cnt]w" 16
-Move the cursor to the beginning of the next word. If there
-is a count, then move forward that many words and
-position the cursor at the beginning of the word.
-Mnemonic: next-\fBw\fRord
-.IP "[cnt]W" 16
-Move the cursor to the beginning of the next word which follows
-a "white space" (<sp>,<tab>, or <nl>). Ignore other punctuation.
-.IP "[cnt]b" 16
-Move the cursor to the preceding word. Mnemonic: \fBb\fRackup-word
-.IP "[cnt]B" 16
-Move the cursor to the preceding word that is separated from the
-current word by a "white space" (<sp>,<tab>, or <nl>).
-.IP "[cnt]e" 16
-Move the cursor to the end of the current word or the end of the
-"cnt"'th word hence. Mnemonic: \fBe\fRnd-of-word
-.IP "[cnt]E" 16
-Move the cursor to the end of the current word which is delimited by
-"white space" (<sp>,<tab>, or <nl>).
-.IP "[line number]G" 16
-.br
-Move the cursor to the line specified. Of particular use are the
-sequences "1G" and "G", which move the cursor to the beginning and
-the end of the file respectively. Mnemonic: \fBG\fRo-to
-.LP
-.B NOTE:
-The next four commands (^D, ^U, ^F, ^B)
-are not true motion commands, in that they
-cannot be used as the object of commands such as delete or change.
-.IP "[cnt]^D" 16
-Move the cursor down in the file by "cnt" lines (or the last "cnt"
-if a new count isn't given. The initial default is half a page.) The
-screen is simultaneously scrolled up. Mnemonic: \fBD\fRown
-.IP "[cnt]^U" 16
-Move the cursor up in the file by "cnt" lines. The screen is simultaneously
-scrolled down. Mnemonic: \fBU\fRp
-.IP "[cnt]^F" 16
-Move the cursor to the next page. A count moves that many pages.
-Two lines of the previous page are kept on the screen for continuity if
-possible. Mnemonic: \fBF\fRorward-a-page
-.IP "[cnt]^B" 16
-Move the cursor to the previous page. Two lines of the current page
-are kept if possible. Mnemonic: \fBB\fRackup-a-page
-.IP "[cnt](" 16
-Move the cursor to the beginning of the next sentence.
-A sentence is defined as ending with a ".", "!", or "?"
-followed by two spaces or a <nl>.
-.IP "[cnt])" 16
-Move the cursor backwards to the beginning of a sentence.
-.IP "[cnt]}" 16
-Move the cursor to the beginning of the next paragraph. This command
-works best inside \fBnroff\fR documents. It understands two sets of
-\fBnroff\fR macros, \fB\-ms\fR and \fB\-mm\fR, for which the
-commands ".IP", ".LP", ".PP", ".QP", "P", as well as the nroff command ".bp"
-are considered to be paragraph delimiters.
-A blank line also delimits a paragraph.
-The \fBnroff\fR macros that it accepts as paragraph delimiters is
-adjustable. See \fBparagraphs\fR under the \fBSet Commands\fR section.
-.IP "[cnt]{" 16
-Move the cursor backwards to the beginning of a paragraph.
-.IP "]]" 16
-Move the cursor to the next "section", where a section is defined by
-two sets of \fBnroff\fR macros, \fB\-ms\fR and \fB\-mm\fR, in which
-".NH", ".SH", and ".H" delimit a section. A line beginning with a <ff><nl>
-sequence, or a line beginning with a "{" are also considered to
-be section delimiters. The last option makes it
-useful for finding the beginnings of C functions.
-The \fBnroff\fR macros that are used for section delimiters can be adjusted.
-See \fBsections\fR under the \fBSet Commands\fR section.
-.IP "[[" 16
-Move the cursor backwards to the beginning of a section.
-.IP "%" 16
-Move the cursor to the matching parenthesis
-or brace. This is very useful in C or lisp code. If the
-cursor is sitting on a \fB( ) {\fR or \fB}\fR the cursor
-is moved to the matching character at the other end of the
-section. If the cursor is not sitting on a brace or a
-parenthesis, \fBvi\fR searches forward until it finds one
-and then jumps to the match mate.
-.IP "[cnt]H" 16
-If there is no count move the cursor to the top left position on the screen.
-If there is a count, then move the cursor to the beginning of the line
-"cnt" lines from the top of the screen. Mnemonic: \fBH\fRome
-.IP "[cnt]L" 16
-If there is no count move the cursor to the beginning
-of the last line on the screen.
-If there is a count, then move the cursor to the beginning of the line
-"cnt" lines from the bottom of the screen. Mnemonic: \fBL\fRast
-.IP "M" 16
-Move the cursor to the beginning of the middle line on the screen.
-Mnemonic: \fBM\fRiddle
-.IP "m<a-z>" 16
-This command does not move the cursor, but it \fBmarks\fR the place
-in the file and the character "<a-z>" becomes the label for referring
-to this location in the file. See the next two commands. Mnemonic:
-\fBm\fRark
-.B NOTE:
-The mark command is not a motion, and cannot be used as the target
-of commands such as delete.
-.IP "\(aa<a-z>" 16
-Move the cursor to the beginning of the line that is marked with the label
-"<a-z>".
-.IP "\(ga<a-z>" 16
-Move the cursor to the exact position on the line that was marked with
-with the label "<a-z>".
-.IP "\(aa\(aa" 16
-Move the cursor back to the beginning of the line where it was before the
-last "non-relative" move. A "non-relative" move is something such as a
-search or a jump to a specific line in the file, rather than moving the
-cursor or scrolling the screen.
-.IP "\(ga\(ga" 16
-Move the cursor back to the exact spot on the line where it was located
-before the last "non-relative" move.
-.LE
-.NH 2
-Searches
-.LP
-The following commands allow you to search for items in a file.
-.VL 16
-.IP [cnt]f{chr} 16
-.sp 1
-Search forward on the line for the next or "cnt"'th occurrence of
-the character "chr". The cursor is placed \fBat\fR the character
-of interest. Mnemonic: \fBf\fRind character
-.IP [cnt]F{chr} 16
-.sp 1
-Search backwards on the line for the next or "cnt"'th occurrence of
-the character "chr". The cursor is placed \fBat\fR the character
-of interest.
-.IP [cnt]t{chr} 16
-.sp 1
-Search forward on the line for the next or "cnt"'th occurrence of
-the character "chr". The cursor is placed \fBjust preceding\fR
-the character of interest. Mnemonic: move cursor up \fBt\fRo character
-.IP [cnt]T{chr} 16
-.sp 1
-Search backwards on the line for the next or "cnt"'th occurrence of
-the character "chr". The cursor is placed \fBjust preceding\fR
-the character of interest.
-.IP "[cnt];" 16
-Repeat the last "f", "F", "t" or "T" command.
-.IP "[cnt]," 16
-Repeat the last "f", "F", "t" or "T" command, but in the opposite
-search direction. This is useful if you overshoot.
-.IP "[cnt]/[string]/<nl>" 16
-.br
-Search forward for the next occurrence of "string".
-Wrap around at the end of the file
-does occur.
-The final \fB</>\fR is not required.
-.IP "[cnt]?[string]?<nl>" 16
-.br
-Search backwards for the next occurrence of "string". If a count is
-specified, the count becomes the new window size. Wrap around at the beginning
-of the file does occur.
-The final \fB<?>\fR is not required.
-.IP n 16
-Repeat the last /[string]/ or ?[string]? search. Mnemonic: \fBn\fRext
-occurrence.
-.IP N 16
-Repeat the last /[string]/ or ?[string]? search, but in the reverse
-direction.
-.IP ":g/[string]/[editor command]<nl>" 16
-.sp 1
-Using the \fB:\fR syntax it is possible to do global searches ala the
-standard UNIX "ed" editor.
-.LE
-.NH 2
-Text Insertion
-.LP
-The following commands allow for the insertion of text. All multicharacter
-text insertions are terminated with an <esc> character.
-The last change
-can always be \fBundone\fR by typing a \fBu\fR.
-The text insert in insertion mode can contain newlines.
-.VL 16
-.IP a{text}<esc> 16
-Insert text immediately following the cursor position.
-Mnemonic: \fBa\fRppend
-.IP A{text}<esc> 16
-Insert text at the end of the current line.
-Mnemonic: \fBA\fRppend
-.IP i{text}<esc> 16
-Insert text immediately preceding the cursor position.
-Mnemonic: \fBi\fRnsert
-.IP I{text}<esc> 16
-Insert text at the beginning of the current line.
-.IP o{text}<esc> 16
-Insert a new line after the line on which the cursor appears and
-insert text there. Mnemonic: \fBo\fRpen new line
-.IP O{text}<esc> 16
-Insert a new line preceding the line on which the cursor appears
-and insert text there.
-.LE
-.NH 2
-Text Deletion
-.LP
-The following commands allow the user to delete text in various ways.
-All changes can always be \fBundone\fR by typing the \fBu\fR command.
-.VL 16
-.IP "[cnt]x" 16
-Delete the character or characters starting at the cursor position.
-.IP "[cnt]X" 16
-Delete the character or characters starting at the character preceding
-the cursor position.
-.IP "D" 16
-Deletes the remainder of the line starting at the cursor.
-Mnemonic: \fBD\fRelete the rest of line
-.IP "[cnt]d{motion}" 16
-.br
-Deletes one or more occurrences of the specified motion.
-Any motion from sections 4.1 and 4.2 can be used here.
-The d can be stuttered (e.g. [cnt]dd) to delete cnt lines.
-.LE
-.NH 2
-Text Replacement
-.LP
-The following commands allow the user to simultaneously delete and
-insert new text. All such actions can be \fBundone\fR by typing
-\fBu\fR following the command.
-.VL 16
-.IP "r<chr>" 16
-Replaces the character at the current cursor position with <chr>. This
-is a one character replacement. No <esc> is required for termination.
-Mnemonic: \fBr\fReplace character
-.IP "R{text}<esc>" 16
-Starts overlaying the characters on the screen with whatever you type.
-It does not stop until an <esc> is typed.
-.IP "[cnt]s{text}<esc>" 16
-Substitute for "cnt" characters beginning at the current cursor
-position. A "$" will appear at the position in the text where the
-"cnt"'th character appears so you will know how much you are erasing.
-Mnemonic: \fBs\fRubstitute
-.IP "[cnt]S{text}<esc>" 16
-Substitute for the entire current line (or lines). If no count is given,
-a "$" appears at the end of the current line. If a count of more than
-1 is given, all the lines to be replaced are deleted before the insertion
-begins.
-.IP "[cnt]c{motion}{text}<esc>" 16
-.br
-Change the specified "motion" by replacing it with the
-insertion text. A "$" will appear at the end of the last item
-that is being deleted unless the deletion involves whole lines.
-Motion's can be any motion from sections 4.1 or 4.2.
-Stuttering the c (e.g. [cnt]cc) changes cnt lines.
-.LE
-.NH 2
-Moving Text
-.LP
-\fBVi\fR provides a number of ways of moving chunks of text around.
-There are nine buffers into which each piece of text which is deleted
-or "yanked" is put in addition to the "undo" buffer.
-The most recent deletion or yank is in the "undo" buffer and also
-usually in buffer
-1, the next most recent in buffer 2, and so forth. Each new deletion
-pushes down all the older deletions. Deletions older than 9
-disappear. There is also
-a set of named registers, a-z, into which text can optionally
-be placed. If any delete or replacement type command is preceded
-by \fB"<a-z>\fR, that named buffer will contain the text deleted
-after the command is executed. For example, \fB"a3dd\fR will delete
-three lines starting at the current line and put them in buffer \fB"a\fR.*
-.FS
-* Referring to an upper case letter as a buffer name (A-Z) is the
-same as referring to the lower case letter, except that text placed
-in such a buffer is appended to it instead of replacing it.
-.FE
-There are two more basic commands and
-some variations useful in getting and putting text into a file.
-.VL 16
-.IP ["<a-z>][cnt]y{motion} 16
-.sp 1
-Yank the specified item or "cnt" items and put in the "undo" buffer or
-the specified buffer. The variety of "items" that can be yanked
-is the same as those that can be deleted with the "d" command or
-changed with the "c" command. In the same way that "dd" means
-delete the current line and "cc" means replace the current line,
-"yy" means yank the current line.
-.IP ["<a-z>][cnt]Y 16
-Yank the current line or the "cnt" lines starting from the current
-line. If no buffer is specified, they will go into the "undo" buffer,
-like any delete would. It is equivalent to "yy".
-Mnemonic: \fBY\fRank
-.IP ["<a-z>]p 16
-Put "undo" buffer or the specified buffer down \fBafter\fR the cursor.
-If whole lines were yanked or deleted into the buffer, then they will be
-put down on the line following the line the cursor is on. If
-something else was deleted, like a word or sentence, then it will
-be inserted immediately following the cursor.
-Mnemonic: \fBp\fRut buffer
-.IP
-It should be noted that text in the named buffers remains there when you
-start editing a new file with the \fB:e file<esc>\fR command. Since
-this is so, it is possible to copy or delete text from one file and
-carry it over to another file in the buffers.
-However, the undo buffer and the ability to undo are lost when
-changing files.
-.IP ["<a-z>]P 16
-Put "undo" buffer or the specified buffer down \fBbefore\fR the cursor.
-If whole lines where yanked or deleted into the buffer, then they will be
-put down on the line preceding the line the cursor is on. If
-something else was deleted, like a word or sentence, then it will
-be inserted immediately preceding the cursor.
-.IP [cnt]>{motion} 16
-The shift operator will right shift all the text from the line on which
-the cursor is located to the line where the \fBmotion\fR is located.
-The text is shifted by one \fBshiftwidth\fR. (See section 6.)
-\fB>>\fR means right shift the current line or lines.
-.IP [cnt]<{motion} 16
-The shift operator will left shift all the text from the line on which
-the cursor is located to the line where the \fBitem\fR is located.
-The text is shifted by one \fBshiftwidth\fR. (See section 6.)
-\fB<<\fR means left shift the current line or lines.
-Once the line has reached the left margin it is not further affected.
-.IP [cnt]={motion} 16
-Prettyprints the indicated area according to
-.B lisp
-conventions.
-The area should be a lisp s-expression.
-.LE
-.NH 2
-Miscellaneous Commands
-.LP
-\fBVi\fR has a number of miscellaneous commands that are very
-useful. They are:
-.VL 16
-.IP ZZ 16
-This is the normal way to exit from vi.
-If any changes have been made, the file is written out.
-Then you are returned to the shell.
-.IP ^L 16
-Redraw the current screen. This is useful if someone "write"s you
-while you are in "vi" or if for any reason garbage gets onto the
-screen.
-.IP ^R 16
-On dumb terminals, those not having the "delete line" function
-(the vt100 is such a terminal), \fBvi\fR saves redrawing the
-screen when you delete a line by just marking the line with an
-"@" at the beginning and blanking the line. If you want to
-actually get rid of the lines marked with "@" and see what the
-page looks like, typing a ^R will do this.
-.IP \s+4.\s0 16
-"Dot" is a particularly useful command. It repeats the last
-text modifying command. Therefore you can type a command once and
-then to another place and repeat it by just typing ".".
-.IP u 16
-Perhaps the most important command in the editor,
-u undoes the last command that changed the buffer.
-Mnemonic: \fBu\fRndo
-.IP U 16
-Undo all the text modifying commands performed on the current line
-since the last time you moved onto it.
-.IP [cnt]J 16
-Join the current line and the following line. The <nl> is deleted
-and the two lines joined, usually with a space between the
-end of the first line and the beginning of what was the second
-line. If the first line ended with a "period", then two spaces
-are inserted.
-A count joins the next cnt lines.
-Mnemonic: \fBJ\fRoin lines
-.IP Q 16
-Switch to \fBex\fR editing mode.
-In this mode \fBvi\fR will behave very much like \fBed\fR.
-The editor in this mode will operate on single lines normally and
-will not attempt to keep the "window" up to date.
-Once in this mode it is also possible to switch to the \fBopen\fR
-mode of editing. By entering the command \fB[line number]open<nl>\fR
-you enter this mode. It is similar to the normal visual mode
-except the window is only \fBone\fR line long.
-Mnemonic: \fBQ\fRuit visual mode
-.IP ^] 16
-An abbreviation for a tag command.
-The cursor should be positioned at the beginning of a word.
-That word is taken as a tag name, and the tag with that
-name is found as if it had been typed in a :tag command.
-.IP [cnt]!{motion}{UNIX\ cmd}<nl> 16
-.br
-Any UNIX filter
-(e.g. command that reads the standard input and outputs something
-to the standard output) can be sent a section of the current file and
-have the output of the command replace the original text. Useful
-examples are programs like \fBcb\fR, \fBsort\fR, and
-\fBnroff\fR. For instance, using \fBsort\fR it would be possible to
-sort a section of the current file into a new list.
-Using \fB!!\fR means take a line or lines starting at the line the
-cursor is currently on and pass them to the UNIX command.
-.B NOTE:
-To just escape to the shell for one command,
-use :!{cmd}<nl>, see section 5.
-.IP z{cnt}<nl> 16
-This resets the current window size to "cnt" lines and redraws the screen.
-.LE
-.NH 2
-Special Insert Characters
-.LP
-There are some characters that have special meanings during
-insert modes. They are:
-.VL 16
-.IP ^V 16
-During inserts, typing a ^V allows you to quote control characters
-into the file. Any character typed after the ^V will be inserted
-into the file.
-.IP [^]^D\ or\ [0]^D 16
-<^D> without any argument backs up one \fBshiftwidth\fR. This is necessary
-to remove indentation that was inserted by the \fBautoindent\fR feature.
-^<^D> temporarily removes all the autoindentation, thus placing the cursor
-at the left margin. On the next line, the previous indent level will be
-restored. This is useful for putting "labels" at the left margin.
-0<^D> says remove all autoindents and stay that way. Thus the cursor
-moves to the left margin and stays there on successive lines until
-<tab>'s are typed. As with the <tab>, the <^D> is only effective before
-any other "non-autoindent" controlling characters are typed.
-Mnemonic: \fBD\fRelete a shiftwidth
-.IP ^W 16
-If the cursor is sitting on a word, <^W> moves the cursor back to the beginning
-of the word, thus erasing the word from the insert.
-Mnemonic: erase \fBW\fRord
-.IP <bs> 16
-The backspace always serves as an erase during insert modes in addition
-to your normal "erase" character. To insert a <bs> into your file, use
-the <^V> to quote it.
-.LE
-.NH 1
-\fB:\fR Commands
-.LP
-Typing a ":" during command mode causes \fBvi\fR to put the cursor at
-the bottom on the screen in preparation for a command. In the
-":" mode, \fBvi\fR can be given most \fBed\fR commands. It is
-also from this mode that you exit from \fBvi\fR or switch to different
-files. All commands of this variety are terminated by a <nl>, <cr>,
-or <esc>.
-.VL 16
-.IP ":w[!] [file]" 16
-Causes \fBvi\fR to write out the current text to the disk. It is
-written to the file you are editing unless "file" is supplied. If
-"file" is supplied, the write is directed to that file instead. If
-that file already exists, \fBvi\fR will not perform the write unless
-the "!" is supplied indicating you
-.I really
-want to destroy the older copy of the file.
-.IP :q[!] 16
-Causes \fBvi\fR to exit. If you have modified the file you are
-looking at currently and haven't written it out, \fBvi\fR will
-refuse to exit unless the "!" is supplied.
-.IP ":e[!] [+[cmd]] [file]" 16
-.sp 1
-Start editing a new file called "file" or start editing the current
-file over again. The command ":e!" says "ignore the changes I've made
-to this file and start over from the beginning". It is useful if
-you really mess up the file. The optional "+" says instead of starting
-at the beginning, start at the "end", or,
-if "cmd" is supplied, execute "cmd" first.
-Useful cases of this are where cmd is "n" (any integer) which starts
-at line number n,
-and "/text", which searches for "text" and starts at the line where
-it is found.
-.IP "^^" 16
-Switch back to the place you were before your last tag command.
-If your last tag command stayed within the file, ^^ returns to that tag.
-If you have no recent tag command, it will return to the
-same place in the previous file that it was showing when you switched
-to the current file.
-.IP ":n[!]" 16
-Start editing the next file in the argument list. Since \fBvi\fR
-can be called with multiple file names, the ":n" command tells it to
-stop work on the current file and switch to the next file. If the
-current file was modifies, it has to be written out before the ":n"
-will work or else the "!" must be supplied, which says discard the
-changes I made to the current file.
-.IP ":n[!] file [file file ...]" 16
-.sp
-Replace the current argument list with a new list of files and start
-editing the first file in this new list.
-.IP ":r file" 16
-Read in a copy of "file" on the line after the cursor.
-.IP ":r !cmd" 16
-Execute the "cmd" and take its output and put it into the file after
-the current line.
-.IP ":!cmd" 16
-Execute any UNIX shell command.
-.IP ":ta[!] tag" 16
-.B Vi
-looks in the file named
-.B tags
-in the current directory.
-.B Tags
-is a file of lines in the format:
-.sp 1
-.ti +8
-tag filename \fBvi\fR-search-command
-.sp 1
-If \fBvi\fR finds the tag you specified in the \fB:ta\fR command,
-it stops editing the current file if necessary and if the current file is
-up to date on the disk and switches to the file specified and uses the
-search pattern specified to find the "tagged" item of interest. This
-is particularly useful when editing multi-file C programs such as the
-operating system. There is a program called \fBctags\fR which will
-generate an appropriate \fBtags\fR file for C and f77
-programs so that by saying
-\fB:ta function<nl>\fR you will be switched to that function.
-It could also be useful when editing multi-file documents, though the
-\fBtags\fR file would have to be generated manually.
-.LE
-.NH 1
-Special Arrangements for Startup
-.PP
-\fBVi\fR takes the value of \fB$TERM\fR and looks up the characteristics
-of that terminal in the file \fB/etc/termcap\fR.
-If you don't know \fBvi\fR's name for the terminal you are working
-on, look in \fB/etc/termcap\fR.
-.PP
-When \fBvi\fR starts, it attempts to read the variable EXINIT
-from your environment.*
-If that exists, it takes the values in it as the default values
-for certain of its internal constants. See the section on "Set Values"
-for further details.
-If EXINIT doesn't exist you will get all the normal defaults.
-.FS
-* On version 6 systems
-Instead of EXINIT, put the startup commands in the file .exrc
-in your home directory.
-.FE
-.PP
-Should you inadvertently hang up the phone while inside
-.B vi ,
-or should the computer crash,
-all may not be lost.
-Upon returning to the system, type:
-.DS
-vi \-r file
-.DE
-This will normally recover the file. If there is more than one
-temporary file for a specific file name, \fBvi\fR recovers the
-newest one. You can get an older version by recovering the
-file more than once.
-The command "vi -r" without a file name gives you the list of files
-that were saved in the last system crash
-(but
-.I not
-the file just saved when the phone was hung up).
-.NH 1
-Set Commands
-.LP
-\fBVi\fR has a number of internal variables and switches which can be
-set to achieve special affects.
-These options come in three forms, those that are switches, which toggle
-from off to on and back, those that require a numeric value, and those
-that require an alphanumeric string value.
-The toggle options are set by a command of the form:
-.DS
-:set option<nl>
-.DE
-and turned off with the command:
-.DS
-:set nooption<nl>
-.DE
-Commands requiring a value are set with a command of the form:
-.DS
-:set option=value<nl>
-.DE
-To display the value of a specific option type:
-.DS
-:set option?<nl>
-.DE
-To display only those that you have changed type:
-.DS
-:set<nl>
-.DE
-and to display the long table of all the settable parameters and
-their current values type:
-.DS
-:set all<nl>
-.DE
-.PP
-Most of the options have a long form and an abbreviation. Both are
-listed in the following table as well as the normal default value.
-.PP
-To arrange to have values other than the default used every time you
-enter
-.B vi ,
-place the appropriate
-.B set
-command in EXINIT in your environment, e.g.
-.DS
-EXINIT='set ai aw terse sh=/bin/csh'
-export EXINIT
-.DE
-or
-.DS
-setenv EXINIT 'set ai aw terse sh=/bin/csh'
-.DE
-for
-.B sh
-and
-.B csh ,
-respectively.
-These are usually placed in your .profile or .login.
-If you are running a system without environments (such as version 6)
-you can place the set command in the file .exrc in your home
-directory.
-.VL 16
-.IP autoindent\ ai 16
-Default: noai Type: toggle
-.br
-When in autoindent mode, vi helps you indent code by starting each
-line in the same column as the preceding line.
-Tabbing to the right with <tab> or <^T> will move this boundary to
-the right, and it can be moved to the left with <^D>.
-.IP autoprint\ ap 16
-Default: ap Type: toggle
-.br
-Causes the current line to be printed after each ex text modifying command.
-This is not of much interest in the normal \fBvi\fR visual mode.
-.IP autowrite\ aw 16
-Default: noaw type: toggle
-.br
-Autowrite causes an automatic write to be done if there are unsaved
-changes before certain commands which change files or otherwise
-interact with the outside world.
-These commands are :!, :tag, :next, :rewind, ^^, and ^].
-.IP beautify\ bf 16
-Default: nobf Type: toggle
-.br
-Causes all control characters except <tab>, <nl>, and <ff> to be discarded.
-.IP directory\ dir 16
-Default: dir=/tmp Type: string
-.br
-This is the directory in which \fBvi\fR puts its temporary file.
-.IP errorbells\ eb 16
-Default: noeb Type: toggle
-.br
-Error messages are preceded by a <bell>.
-.IP hardtabs\ ht 16
-Default: hardtabs=8 Type: numeric
-.br
-This option contains the value of hardware tabs in your terminal, or
-of software tabs expanded by the Unix system.
-.IP ignorecase\ ic 16
-Default: noic Type: toggle
-.br
-All upper case characters are mapped to lower case in regular expression
-matching.
-.IP lisp 16
-Default: nolisp Type: toggle
-.br
-Autoindent for \fBlisp\fR code. The commands \fB( ) [[\fR and \fB]]\fR
-are modified appropriately to affect s-expressions and functions.
-.IP list 16
-Default: nolist Type: toggle
-.br
-All printed lines have the <tab> and <nl> characters displayed visually.
-.IP magic 16
-Default: magic Type: toggle
-.br
-Enable the metacharacters for matching. These include \fB. * < > [string]
-[^string]\fR and \fB[<chr>-<chr>]\fR.
-.IP number\ nu 16
-Default: nonu Type: toggle
-.br
-Each line is displayed with its line number.
-.IP open 16
-Default: open Type: toggle
-.br
-When set, prevents entering open or visual modes from ex or edit.
-Not of interest from vi.
-.IP optimize\ opt 16
-Default: opt Type: toggle
-.br
-Basically of use only when using the \fBex\fR capabilities. This
-option prevents automatic <cr>s from taking place,
-and speeds up output of indented lines,
-at the expense of losing typeahead on some versions of UNIX.
-.IP paragraphs\ para 16
-Default: para=IPLPPPQPP\ bp Type: string
-.br
-Each pair of characters in the string indicate \fBnroff\fR macros
-which are to be treated as the beginning of a paragraph for the
-\fB{\fR and \fB}\fR commands. The default string is for the \fB-ms\fR
-and \fB-mm\fR macros.
-To indicate one letter \fBnroff\fR macros, such as \fB.P\fR or \fB.H\fR,
-quote a space in for the second character position. For example:
-.sp 1
-.ti +8
-:set paragraphs=P\e bp<nl>
-.sp 1
-would cause \fBvi\fR to consider \fB.P\fR and \fB.bp\fR as paragraph
-delimiters.
-.IP prompt 16
-Default: prompt Type: toggle
-.br
-In
-.B ex
-command mode the prompt character \fB:\fR will be printed when
-\fBex\fR is waiting for a command. This is not of interest from vi.
-.IP redraw 16
-Default: noredraw Type: toggle
-.br
-On dumb terminals, force the screen to always be up to date,
-by sending great amounts of output. Useful only at high speeds.
-.IP report 16
-Default: report=5 Type: numeric
-.br
-This sets the threshold for the number of lines modified. When
-more than this number of lines are modified, removed, or yanked,
-\fBvi\fR will report the number of lines changed at the bottom of
-the screen.
-.IP scroll 16
-Default: scroll={1/2 window} Type: numeric
-.br
-This is the number of lines that the screen scrolls up or down when
-using the <^U> and <^D> commands.
-.IP sections 16
-Default: sections=SHNHH HU Type: string
-.br
-Each two character pair of this string specify \fBnroff\fR macro names
-which are to be treated as the beginning of a section by the
-\fB]]\fR and \fB[[\fR commands. The default string is for the \fB-ms\fR
-and \fB-mm\fR macros.
-To enter one letter \fBnroff\fR macros, use a quoted space as the
-second character.
-See \fBparagraphs\fR for a fuller explanation.
-.IP shell\ sh 16
-Default: sh=from environment SHELL or /bin/sh Type: string
-.br
-This is the name of the \fBsh\fR to be used for "escaped" commands.
-.IP shiftwidth\ sw 16
-Default: sw=8 Type: numeric
-.br
-This is the number of spaces that a <^T> or <^D> will move over for
-indenting, and the amount < and > shift by.
-.IP showmatch\ sm 16
-Default: nosm Type: toggle
-.br
-When a \fB)\fR or \fB}\fR is typed, show the matching \fB(\fR or \fB{\fR
-by moving the cursor to it for one second if it is on the current screen.
-.IP slowopen\ slow 16
-Default: terminal dependent Type: toggle
-.br
-On terminals that are slow and unintelligent, this option prevents the
-updating of the screen some of the time to improve speed.
-.IP tabstop\ ts 16
-Default: ts=8 Type: numeric
-.br
-<tab>s are expanded to boundaries that are multiples of this value.
-.IP taglength\ tl 16
-Default: tl=0 Type: numeric
-.br
-If nonzero, tag names are only significant to this many characters.
-.IP term 16
-Default: (from environment \fBTERM\fP, else dumb) Type: string
-.br
-This is the terminal and controls the visual displays. It cannot be
-changed when in "visual" mode,
-you have to Q to command mode, type a
-set term command, and do ``vi.'' to get back into visual.
-Or exit vi, fix $TERM, and reenter.
-The definitions that drive a particular
-terminal type are found in the file \fB/etc/termcap\fR.
-.IP terse 16
-Default: terse Type: toggle
-.br
-When set, the error diagnostics are short.
-.IP warn 16
-Default: warn Type: toggle
-.br
-The user is warned if she/he tries to escape to
-the shell without writing out the current changes.
-.IP window 16
-Default: window={8 at 600 baud or less, 16 at 1200 baud, and screen
-size \- 1 at 2400 baud or more} Type: numeric
-.br
-This is the number of lines in the window whenever \fBvi\fR must redraw
-an entire screen. It is useful to make this size smaller if you are
-on a slow line.
-.IP w300,\ w1200,\ w9600
-.br
-These set window, but only within the corresponding speed ranges.
-They are useful in an EXINIT to fine tune window sizes.
-For example,
-.DS
-set w300=4 w1200=12
-.DE
-causes a 4 lines window at speed up to 600 baud, a 12 line window at 1200
-baud, and a full screen (the default) at over 1200 baud.
-.IP wrapscan\ ws 16
-Default: ws Type: toggle
-.br
-Searches will wrap around the end of the file when is option is set. When
-it is off, the search will terminate when it reaches the end or the
-beginning of the file.
-.IP wrapmargin\ wm 16
-Default: wm=0 Type: numeric
-.br
-\fBVi\fR will automatically insert a <nl> when it finds a natural
-break point (usually a <sp> between words) that occurs within
-"wm" spaces of the right margin.
-Therefore with "wm=0" the option is off. Setting it to 10 would
-mean that any time you are within 10 spaces of the right margin
-\fBvi\fR would be looking for a <sp> or <tab> which it could
-replace with a <nl>. This is convenient for people who forget
-to look at the screen while they type.
-(In version 3, wrapmargin behaves more like nroff, in that the
-boundary specified by the distance from the right edge of the screen
-is taken as the rightmost edge of the area where a break is allowed,
-instead of the leftmost edge.)
-.IP writeany\ wa 16
-Default: nowa Type: toggle
-.br
-\fBVi\fR normally makes a number of checks before it writes out a file.
-This prevents the user from inadvertently destroying a file. When the
-"writeany" option is enabled, \fBvi\fR no longer makes these checks.
-.LE
diff --git a/usr.bin/vi/USD.doc/vitut/vi.chars b/usr.bin/vi/USD.doc/vitut/vi.chars
deleted file mode 100644
index 147c4ff7f2d..00000000000
--- a/usr.bin/vi/USD.doc/vitut/vi.chars
+++ /dev/null
@@ -1,644 +0,0 @@
-.\" Copyright (c) 1980, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)vi.chars 8.1 (Berkeley) 6/8/93
-.\"
-.bd S 3
-..pn 21
-.de iP
-.IP "\fB\\$1\fR" \\$2
-..
-.SH
-Appendix: character functions
-.PP
-This appendix gives the uses the editor makes of each character. The
-characters are presented in their order in the \s-2ASCII\s0 character
-set: Control characters come first, then most special characters, then
-the digits, upper and then lower case characters.
-.PP
-For each character we tell a meaning it has as a command and any meaning it
-has during an insert.
-If it has only meaning as a command, then only this is discussed.
-Section numbers in parentheses indicate where the character is discussed;
-a `f' after the section number means that the character is mentioned
-in a footnote.
-.iP "^@" 15
-Not a command character.
-If typed as the first character of an insertion it is replaced with the
-last text inserted, and the insert terminates. Only 128 characters are
-saved from the last insert; if more characters were inserted the mechanism
-is not available.
-A \fB^@\fR cannot be part of the file due to the editor implementation
-(7.5f).
-.iP "^A" 15
-Unused.
-.iP "^B" 15
-Backward window.
-A count specifies repetition.
-Two lines of continuity are kept if possible (2.1, 6.1, 7.2).
-.iP "^C" 15
-Unused.
-.iP "^D" 15
-As a command, scrolls down a half-window of text.
-A count gives the number of (logical) lines to scroll, and is remembered
-for future \fB^D\fR and \fB^U\fR commands (2.1, 7.2).
-During an insert, backtabs over \fIautoindent\fR white space at the beginning
-of a line (6.6, 7.5); this white space cannot be backspaced over.
-.iP "^E" 15
-Exposes one more line below the current screen in the file, leaving
-the cursor where it is if possible.
-(Version 3 only.)
-.iP "^F" 15
-Forward window. A count specifies repetition.
-Two lines of continuity are kept if possible (2.1, 6.1, 7.2).
-.iP "^G" 15
-Equivalent to \fB:f\fR\s-2CR\s0, printing the current file, whether
-it has been modified, the current line number and the number of lines
-in the file, and the percentage of the way through the file that you
-are.
-.iP "^H (\fR\s-2BS\s0\fP)" 15
-Same as
-.B "left arrow" .
-(See
-.B h ).
-During an insert, eliminates the last input character, backing over it
-but not erasing it; it remains so you can see what you typed if you
-wish to type something only slightly different (3.1, 7.5).
-.iP "^I\ (\fR\s-2TAB\s0\fP)" 15
-Not a command character.
-When inserted it prints as some
-number of spaces.
-When the cursor is at a tab character it rests at the last of the spaces
-which represent the tab.
-The spacing of tabstops is controlled by the \fItabstop\fR option (4.1, 6.6).
-.iP "^J\ (\fR\s-2LF\s0\fP)" 15
-Same as
-.B "down arrow"
-(see
-.B j ).
-.iP "^K" 15
-Unused.
-.iP "^L" 15
-The \s-2ASCII\s0 formfeed character, this causes the screen to be cleared
-and redrawn. This is useful after a transmission error, if characters
-typed by a program other than the editor scramble the screen,
-or after output is stopped by an interrupt (5.4, 7.2f).
-.iP "^M\ (\fR\s-2CR\s0\fP)" 15
-A carriage return advances to the next line, at the first non-white position
-in the line. Given a count, it advances that many lines (2.3).
-During an insert, a \s-2CR\s0 causes the insert to continue onto
-another line (3.1).
-.iP "^N" 15
-Same as
-.B "down arrow"
-(see
-.B j ).
-.iP "^O" 15
-Unused.
-.iP "^P" 15
-Same as
-.B "up arrow"
-(see
-.B k ).
-.iP "^Q" 15
-Not a command character.
-In input mode,
-.B ^Q
-quotes the next character, the same as
-.B ^V ,
-except that some teletype drivers will eat the
-.B ^Q
-so that the editor never sees it.
-.iP "^R" 15
-Redraws the current screen, eliminating logical lines not corresponding
-to physical lines (lines with only a single @ character on them).
-On hardcopy terminals in \fIopen\fR mode, retypes the current line
-(5.4, 7.2, 7.8).
-.iP "^S" 15
-Unused. Some teletype drivers use
-.B ^S
-to suspend output until
-.B ^Q is pressed.
-.iP "^T" 15
-Not a command character.
-During an insert, with \fIautoindent\fR set and at the beginning of the
-line, inserts \fIshiftwidth\fR white space.
-.iP "^U" 15
-Scrolls the screen up, inverting \fB^D\fR which scrolls down. Counts work as
-they do for \fB^D\fR, and the previous scroll amount is common to both.
-On a dumb terminal, \fB^U\fR will often necessitate clearing and redrawing
-the screen further back in the file (2.1, 7.2).
-.iP "^V" 15
-Not a command character.
-In input mode, quotes the next character so that it is possible
-to insert non-printing and special characters into the file (4.2, 7.5).
-.iP "^W" 15
-Not a command character.
-During an insert, backs up as \fBb\fR would in command mode; the deleted
-characters remain on the display (see \fB^H\fR) (7.5).
-.iP "^X" 15
-Unused.
-.iP "^Y" 15
-Exposes one more line above the current screen, leaving the cursor where
-it is if possible. (No mnemonic value for this key; however, it is next
-to \fB^U\fR which scrolls up a bunch.)
-(Version 3 only.)
-.iP "^Z" 15
-If supported by the Unix system,
-stops the editor, exiting to the top level shell.
-Same as \fB:stop\fP\s-2CR\s0.
-Otherwise, unused.
-.iP "^[\ (\fR\s-2ESC\s0\fP)" 15
-Cancels a partially formed command, such as a \fBz\fR when no following
-character has yet been given; terminates inputs on the last line (read
-by commands such as \fB: /\fR and \fB?\fR); ends insertions of new text
-into the buffer.
-If an \s-2ESC\s0 is given when quiescent in command state, the editor
-rings the bell or flashes the screen. You can thus hit \s-2ESC\s0 if
-you don't know what is happening till the editor rings the bell.
-If you don't know if you are in insert mode you can type \s-2ESC\s0\fBa\fR,
-and then material to be input; the material will be inserted correctly
-whether or not you were in insert mode when you started (1.5, 3.1, 7.5).
-.iP "^\e" 15
-Unused.
-.iP "^]" 15
-Searches for the word which is after the cursor as a tag. Equivalent
-to typing \fB:ta\fR, this word, and then a \s-2CR\s0.
-Mnemonically, this command is ``go right to'' (7.3).
-.iP "^\(ua" 15
-Equivalent to \fB:e #\fR\s-2CR\s0, returning to the previous position
-in the last edited file, or editing a file which you specified if you
-got a `No write since last change diagnostic' and do not want to have
-to type the file name again (7.3).
-(You have to do a \fB:w\fR before \fB^\(ua\fR
-will work in this case. If you do not wish to write the file you should
-do \fB:e!\ #\fR\s-2CR\s0 instead.)
-.iP "^_" 15
-Unused.
-Reserved as the command character for the
-Tektronix 4025 and 4027 terminal.
-.iP "\fR\s-2SPACE\s0\fP" 15
-Same as
-.B "right arrow"
-(see
-.B l ).
-.iP "!" 15
-An operator, which processes lines from the buffer with reformatting commands.
-Follow \fB!\fR with the object to be processed, and then the command name
-terminated by \s-2CR\s0. Doubling \fB!\fR and preceding it by a count
-causes count lines to be filtered; otherwise the count
-is passed on to the object after the \fB!\fR. Thus \fB2!}\fR\fIfmt\fR\s-2CR\s0
-reformats the next two paragraphs by running them through the program
-\fIfmt\fR. If you are working on \s-2LISP\s0,
-the command \fB!%\fR\fIgrind\fR\s-2CR\s0,*
-.FS
-*Both
-.I fmt
-and
-.I grind
-are Berkeley programs and may not be present at all installations.
-.FE
-given at the beginning of a
-function, will run the text of the function through the \s-2LISP\s0 grinder
-(6.7, 7.3).
-To read a file or the output of a command into the buffer use \fB:r\fR (7.3).
-To simply execute a command use \fB:!\fR (7.3).
-.tr "
-.iP  15
-Precedes a named buffer specification. There are named buffers \fB1\-9\fR
-used for saving deleted text and named buffers \fBa\-z\fR into which you can
-place text (4.3, 6.3)
-.tr 
-.iP "#" 15
-The macro character which, when followed by a number, will substitute
-for a function key on terminals without function keys (6.9).
-In input mode,
-if this is your erase character, it will delete the last character
-you typed in input mode, and must be preceded with a \fB\e\fR to insert
-it, since it normally backs over the last input character you gave.
-.iP "$" 15
-Moves to the end of the current line. If you \fB:se list\fR\s-2CR\s0,
-then the end of each line will be shown by printing a \fB$\fR after the
-end of the displayed text in the line. Given a count, advances to the
-count'th following end of line; thus \fB2$\fR advances to the end of the
-following line.
-.iP "%" 15
-Moves to the parenthesis or brace \fB{ }\fR which balances the parenthesis
-or brace at the current cursor position.
-.iP "&" 15
-A synonym for \fB:&\fR\s-2CR\s0, by analogy with the
-.I ex
-.B &
-command.
-.iP "\(aa" 15
-When followed by a \fB\(aa\fR returns to the previous context at the
-beginning of a line. The previous context is set whenever the current
-line is moved in a non-relative way.
-When followed by a letter \fBa\fR\-\fBz\fR, returns to the line which
-was marked with this letter with a \fBm\fR command, at the first non-white
-character in the line. (2.2, 5.3).
-When used with an operator such as \fBd\fR, the operation takes place
-over complete lines; if you use \fB\(ga\fR, the operation takes place
-from the exact marked place to the current cursor position within the
-line.
-.iP "(" 15
-Retreats to the beginning of a
-sentence, or to the beginning of a \s-2LISP\s0 s-expression
-if the \fIlisp\fR option is set.
-A sentence ends at a \fB. !\fR or \fB?\fR which is followed by either
-the end of a line or by two spaces. Any number of closing \fB) ] "\fR
-and \fB\(aa\fR characters may appear after the \fB. !\fR or \fB?\fR,
-and before the spaces or end of line. Sentences also begin
-at paragraph and section boundaries
-(see \fB{\fR and \fB[[\fR below).
-A count advances that many sentences (4.2, 6.8).
-.iP ")" 15
-Advances to the beginning of a sentence.
-A count repeats the effect.
-See \fB(\fR above for the definition of a sentence (4.2, 6.8).
-.iP "*" 15
-Unused.
-.iP "+" 15
-Same as \s-2CR\s0 when used as a command.
-.iP "," 15
-Reverse of the last \fBf F t\fR or \fBT\fR command, looking the other way
-in the current line. Especially useful after hitting too many \fB;\fR
-characters. A count repeats the search.
-.iP "\-" 15
-Retreats to the previous line at the first non-white character.
-This is the inverse of \fB+\fR and \s-2RETURN\s0.
-If the line moved to is not on the screen, the screen is scrolled, or
-cleared and redrawn if this is not possible.
-If a large amount of scrolling would be required the screen is also cleared
-and redrawn, with the current line at the center (2.3).
-.iP "\&." 15
-Repeats the last command which changed the buffer. Especially useful
-when deleting words or lines; you can delete some words/lines and then
-hit \fB.\fR to delete more and more words/lines.
-Given a count, it passes it on to the command being repeated. Thus after
-a \fB2dw\fR, \fB3.\fR deletes three words (3.3, 6.3, 7.2, 7.4).
-.iP "/" 15
-Reads a string from the last line on the screen, and scans forward for
-the next occurrence of this string. The normal input editing sequences may
-be used during the input on the bottom line; an returns to command state
-without ever searching.
-The search begins when you hit \s-2CR\s0 to terminate the pattern;
-the cursor moves to the beginning of the last line to indicate that the search
-is in progress; the search may then
-be terminated with a \s-2DEL\s0 or \s-2RUB\s0, or by backspacing when
-at the beginning of the bottom line, returning the cursor to
-its initial position.
-Searches normally wrap end-around to find a string
-anywhere in the buffer.
-.IP
-When used with an operator the enclosed region is normally affected.
-By mentioning an
-offset from the line matched by the pattern you can force whole lines
-to be affected. To do this give a pattern with a closing
-a closing \fB/\fR and then an offset \fB+\fR\fIn\fR or \fB\-\fR\fIn\fR.
-.IP
-To include the character \fB/\fR in the search string, you must escape
-it with a preceding \fB\e\fR.
-A \fB\(ua\fR at the beginning of the pattern forces the match to occur
-at the beginning of a line only; this speeds the search. A \fB$\fR at
-the end of the pattern forces the match to occur at the end of a line
-only.
-More extended pattern matching is available, see section 7.4;
-unless you set \fBnomagic\fR in your \fI\&.exrc\fR file you will have
-to preceed the characters \fB. [ *\fR and \fB~\fR in the search pattern
-with a \fB\e\fR to get them to work as you would naively expect (1.5, 2,2,
-6.1, 7.2, 7.4).
-.iP "0" 15
-Moves to the first character on the current line.
-Also used, in forming numbers, after an initial \fB1\fR\-\fB9\fR.
-.iP "1\-9" 15
-Used to form numeric arguments to commands (2.3, 7.2).
-.iP ":" 15
-A prefix to a set of commands for file and option manipulation and escapes
-to the system. Input is given on the bottom line and terminated with
-an \s-2CR\s0, and the command then executed. You can return to where
-you were by hitting \s-2DEL\s0 or \s-2RUB\s0 if you hit \fB:\fR accidentally
-(see primarily 6.2 and 7.3).
-.iP ";" 15
-Repeats the last single character find which used \fBf F t\fR or \fBT\fR.
-A count iterates the basic scan (4.1).
-.iP "<" 15
-An operator which shifts lines left one \fIshiftwidth\fR, normally 8
-spaces. Like all operators, affects lines when repeated, as in
-\fB<<\fR. Counts are passed through to the basic object, thus \fB3<<\fR
-shifts three lines (6.6, 7.2).
-.iP "=" 15
-Reindents line for \s-2LISP\s0, as though they were typed in with \fIlisp\fR
-and \fIautoindent\fR set (6.8).
-.iP ">" 15
-An operator which shifts lines right one \fIshiftwidth\fR, normally 8
-spaces. Affects lines when repeated as in \fB>>\fR. Counts repeat the
-basic object (6.6, 7.2).
-.iP "?" 15
-Scans backwards, the opposite of \fB/\fR. See the \fB/\fR description
-above for details on scanning (2.2, 6.1, 7.4).
-.iP "@" 15
-A macro character (6.9). If this is your kill character, you must escape it with a \e
-to type it in during input mode, as it normally backs over the input you
-have given on the current line (3.1, 3.4, 7.5).
-.iP "A" 15
-Appends at the end of line, a synonym for \fB$a\fR (7.2).
-.iP "B" 15
-Backs up a word, where words are composed of non-blank sequences, placing
-the cursor at the beginning of the word. A count repeats the effect
-(2.4).
-.iP "C" 15
-Changes the rest of the text on the current line; a synonym for \fBc$\fR.
-.iP "D" 15
-Deletes the rest of the text on the current line; a synonym for \fBd$\fR.
-.iP "E" 15
-Moves forward to the end of a word, defined as blanks and non-blanks,
-like \fBB\fR and \fBW\fR. A count repeats the effect.
-.iP "F" 15
-Finds a single following character, backwards in the current line.
-A count repeats this search that many times (4.1).
-.iP "G" 15
-Goes to the line number given as preceding argument, or the end of the
-file if no preceding count is given. The screen is redrawn with the
-new current line in the center if necessary (7.2).
-.iP "H" 15
-.B "Home arrow" .
-Homes the cursor to the top line on the screen. If a count is given,
-then the cursor is moved to the count'th line on the screen.
-In any case the cursor is moved to the first non-white character on the
-line. If used as the target of an operator, full lines are affected
-(2.3, 3.2).
-.iP "I" 15
-Inserts at the beginning of a line; a synonym for \fB\(uai\fR.
-.iP "J" 15
-Joins together lines, supplying appropriate white space: one space between
-words, two spaces after a \fB.\fR, and no spaces at all if the first
-character of the joined on line is \fB)\fR. A count causes that many
-lines to be joined rather than the default two (6.5, 7.1f).
-.iP "K" 15
-Unused.
-.iP "L" 15
-Moves the cursor to the first non-white character of the last line on
-the screen. With a count, to the first non-white of the count'th line
-from the bottom. Operators affect whole lines when used with \fBL\fR
-(2.3).
-.iP "M" 15
-Moves the cursor to the middle line on the screen, at the first non-white
-position on the line (2.3).
-.iP "N" 15
-Scans for the next match of the last pattern given to
-\fB/\fR or \fB?\fR, but in the reverse direction; this is the reverse
-of \fBn\fR.
-.iP "O" 15
-Opens a new line above the current line and inputs text there up to an
-\s-2ESC\s0. A count can be used on dumb terminals to specify a number
-of lines to be opened; this is generally obsolete, as the \fIslowopen\fR
-option works better (3.1).
-.iP "P" 15
-Puts the last deleted text back before/above the cursor. The text goes
-back as whole lines above the cursor if it was deleted as whole lines.
-Otherwise the text is inserted between the characters before and at the
-cursor. May be preceded by a named buffer specification \fB"\fR\fIx\fR
-to retrieve the contents of the buffer; buffers \fB1\fR\-\fB9\fR contain
-deleted material, buffers \fBa\fR\-\fBz\fR are available for general
-use (6.3).
-.iP "Q" 15
-Quits from \fIvi\fR to \fIex\fR command mode. In this mode, whole lines
-form commands, ending with a \s-2RETURN\s0. You can give all the \fB:\fR
-commands; the editor supplies the \fB:\fR as a prompt (7.7).
-.iP "R" 15
-Replaces characters on the screen with characters you type (overlay fashion).
-Terminates with an \s-2ESC\s0.
-.iP "S" 15
-Changes whole lines, a synonym for \fBcc\fR. A count substitutes for
-that many lines. The lines are saved in the numeric buffers, and erased
-on the screen before the substitution begins.
-.iP "T" 15
-Takes a single following character, locates the character before the
-cursor in the current line, and places the cursor just after that character.
-A count repeats the effect. Most useful with operators such as \fBd\fR
-(4.1).
-.iP "U" 15
-Restores the current line to its state before you started changing it
-(3.5).
-.iP "V" 15
-Unused.
-.iP "W" 15
-Moves forward to the beginning of a word in the current line,
-where words are defined as sequences of blank/non-blank characters.
-A count repeats the effect (2.4).
-.iP "X" 15
-Deletes the character before the cursor. A count repeats the effect,
-but only characters on the current line are deleted.
-.iP "Y" 15
-Yanks a copy of the current line into the unnamed buffer, to be put back
-by a later \fBp\fR or \fBP\fR; a very useful synonym for \fByy\fR.
-A count yanks that many lines. May be preceded by a buffer name to put
-lines in that buffer (7.4).
-.iP "ZZ" 15
-Exits the editor.
-(Same as \fB:x\fP\s-2CR\s0.)
-If any changes have been made, the buffer is written out to the current file.
-Then the editor quits.
-.iP "[[" 15
-Backs up to the previous section boundary. A section begins at each
-macro in the \fIsections\fR option,
-normally a `.NH' or `.SH' and also at lines which which start
-with a formfeed \fB^L\fR. Lines beginning with \fB{\fR also stop \fB[[\fR;
-this makes it useful for looking backwards, a function at a time, in C
-programs. If the option \fIlisp\fR is set, stops at each \fB(\fR at the
-beginning of a line, and is thus useful for moving backwards at the top
-level \s-2LISP\s0 objects. (4.2, 6.1, 6.6, 7.2).
-.iP "\e" 15
-Unused.
-.iP "]]" 15
-Forward to a section boundary, see \fB[[\fR for a definition (4.2, 6.1,
-6.6, 7.2).
-.iP "\(ua" 15
-Moves to the first non-white position on the current line (4.4).
-.iP "_" 15
-Unused.
-.iP "\(ga" 15
-When followed by a \fB\(ga\fR returns to the previous context.
-The previous context is set whenever the current
-line is moved in a non-relative way.
-When followed by a letter \fBa\fR\-\fBz\fR, returns to the position which
-was marked with this letter with a \fBm\fR command.
-When used with an operator such as \fBd\fR, the operation takes place
-from the exact marked place to the current position within the line;
-if you use \fB\(aa\fR, the operation takes place over complete lines
-(2.2, 5.3).
-.iP "a" 15
-Appends arbitrary text after the current cursor position; the insert
-can continue onto multiple lines by using \s-2RETURN\s0 within the insert.
-A count causes the inserted text to be replicated, but only if the inserted
-text is all on one line.
-The insertion terminates with an \s-2ESC\s0 (3.1, 7.2).
-.iP "b" 15
-Backs up to the beginning of a word in the current line. A word is a
-sequence of alphanumerics, or a sequence of special characters.
-A count repeats the effect (2.4).
-.iP "c" 15
-An operator which changes the following object, replacing it with the
-following input text up to an \s-2ESC\s0. If more than part of a single
-line is affected, the text which is changed away is saved in the numeric named
-buffers. If only part of the current line is affected, then the last
-character to be changed away is marked with a \fB$\fR.
-A count causes that many objects to be affected, thus both
-\fB3c)\fR and \fBc3)\fR change the following three sentences (7.4).
-.iP "d" 15
-An operator which deletes the following object. If more than part of
-a line is affected, the text is saved in the numeric buffers.
-A count causes that many objects to be affected; thus \fB3dw\fR is the
-same as \fBd3w\fR (3.3, 3.4, 4.1, 7.4).
-.iP "e" 15
-Advances to the end of the next word, defined as for \fBb\fR and \fBw\fR.
-A count repeats the effect (2.4, 3.1).
-.iP "f" 15
-Finds the first instance of the next character following the cursor on
-the current line. A count repeats the find (4.1).
-.iP "g" 15
-Unused.
-.sp
-Arrow keys
-.B h ,
-.B j ,
-.B k ,
-.B l ,
-and
-.B H .
-.iP "h" 15
-.B "Left arrow" .
-Moves the cursor one character to the left.
-Like the other arrow keys, either
-.B h ,
-the
-.B "left arrow"
-key, or one of the synonyms (\fB^H\fP) has the same effect.
-On v2 editors, arrow keys on certain kinds of terminals
-(those which send escape sequences, such as vt52, c100, or hp)
-cannot be used.
-A count repeats the effect (3.1, 7.5).
-.iP "i" 15
-Inserts text before the cursor, otherwise like \fBa\fR (7.2).
-.iP "j" 15
-.B "Down arrow" .
-Moves the cursor one line down in the same column.
-If the position does not exist,
-.I vi
-comes as close as possible to the same column.
-Synonyms include
-.B ^J
-(linefeed) and
-.B ^N .
-.iP "k" 15
-.B "Up arrow" .
-Moves the cursor one line up.
-.B ^P
-is a synonym.
-.iP "l" 15
-.B "Right arrow" .
-Moves the cursor one character to the right.
-\s-2SPACE\s0 is a synonym.
-.iP "m" 15
-Marks the current position of the cursor in the mark register which is
-specified by the next character \fBa\fR\-\fBz\fR. Return to this position
-or use with an operator using \fB\(ga\fR or \fB\(aa\fR (5.3).
-.iP "n" 15
-Repeats the last \fB/\fR or \fB?\fR scanning commands (2.2).
-.iP "o" 15
-Opens new lines below the current line; otherwise like \fBO\fR (3.1).
-.iP "p" 15
-Puts text after/below the cursor; otherwise like \fBP\fR (6.3).
-.iP "q" 15
-Unused.
-.iP "r" 15
-Replaces the single character at the cursor with a single character you
-type. The new character may be a \s-2RETURN\s0; this is the easiest
-way to split lines. A count replaces each of the following count characters
-with the single character given; see \fBR\fR above which is the more
-usually useful iteration of \fBr\fR (3.2).
-.iP "s" 15
-Changes the single character under the cursor to the text which follows
-up to an \s-2ESC\s0; given a count, that many characters from the current
-line are changed. The last character to be changed is marked with \fB$\fR
-as in \fBc\fR (3.2).
-.iP "t" 15
-Advances the cursor upto the character before the next character typed.
-Most useful with operators such as \fBd\fR and \fBc\fR to delete the
-characters up to a following character. You can use \fB.\fR to delete
-more if this doesn't delete enough the first time (4.1).
-.iP "u" 15
-Undoes the last change made to the current buffer. If repeated, will
-alternate between these two states, thus is its own inverse. When used
-after an insert which inserted text on more than one line, the lines are
-saved in the numeric named buffers (3.5).
-.iP "v" 15
-Unused.
-.iP "w" 15
-Advances to the beginning of the next word, as defined by \fBb\fR (2.4).
-.iP "x" 15
-Deletes the single character under the cursor. With a count deletes
-deletes that many characters forward from the cursor position, but only
-on the current line (6.5).
-.iP "y" 15
-An operator, yanks the following object into the unnamed temporary buffer.
-If preceded by a named buffer specification, \fB"\fR\fIx\fR, the text
-is placed in that buffer also. Text can be recovered by a later \fBp\fR
-or \fBP\fR (7.4).
-.iP "z" 15
-Redraws the screen with the current line placed as specified by the following
-character: \s-2RETURN\s0 specifies the top of the screen, \fB.\fR the
-center of the screen, and \fB\-\fR at the bottom of the screen.
-A count may be given after the \fBz\fR and before the following character
-to specify the new screen size for the redraw.
-A count before the \fBz\fR gives the number of the line to place in the
-center of the screen instead of the default current line. (5.4)
-.iP "{" 15
-Retreats to the beginning of the beginning of the preceding paragraph.
-A paragraph begins at each macro in the \fIparagraphs\fR option, normally
-`.IP', `.LP', `.PP', `.QP' and `.bp'.
-A paragraph also begins after a completely
-empty line, and at each section boundary (see \fB[[\fR above) (4.2, 6.8,
-7.6).
-.iP "|" 15
-Places the cursor on the character in the column specified
-by the count (7.1, 7.2).
-.iP "}" 15
-Advances to the beginning of the next paragraph. See \fB{\fR for the
-definition of paragraph (4.2, 6.8, 7.6).
-.iP "~" 15
-Unused.
-.iP "^?\ (\s-2\fRDEL\fP\s0)" 15
-Interrupts the editor, returning it to command accepting state (1.5,
-7.5)
-.bp
-\&.
diff --git a/usr.bin/vi/USD.doc/vitut/vi.in b/usr.bin/vi/USD.doc/vitut/vi.in
deleted file mode 100644
index 3bdfeb95b65..00000000000
--- a/usr.bin/vi/USD.doc/vitut/vi.in
+++ /dev/null
@@ -1,2064 +0,0 @@
-.\" Copyright (c) 1980, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)vi.in 8.1 (Berkeley) 6/8/93
-.\"
-.EH 'USD:12-%''An Introduction to Display Editing with Vi'
-.OH 'An Introduction to Display Editing with Vi''USD:12-%'
-.bd S 3
-.if t .ds dg \(dg
-.if n .ds dg +
-.if t .ds dd \(dd
-.if n .ds dd ++
-.\".RP
-.TL
-An Introduction to Display Editing with Vi
-.AU
-William Joy
-.AU
-Mark Horton
-.AI
-Computer Science Division
-Department of Electrical Engineering and Computer Science
-University of California, Berkeley
-Berkeley, Ca. 94720
-.AB
-.PP
-.I Vi
-(visual) is a display oriented interactive text editor.
-When using
-.I vi
-the screen of your terminal acts as a window into the file which you
-are editing. Changes which you make to the file are reflected
-in what you see.
-.PP
-Using
-.I vi
-you can insert new text any place in the file quite easily.
-Most of the commands to
-.I vi
-move the cursor around in the file.
-There are commands to move the cursor
-forward and backward in units of characters, words,
-sentences and paragraphs.
-A small set of operators, like
-.B d
-for delete and
-.B c
-for change, are combined with the motion commands to form operations
-such as delete word or change paragraph, in a simple and natural way.
-This regularity and the mnemonic assignment of commands to keys makes the
-editor command set easy to remember and to use.
-.PP
-.I Vi
-will work on a large number of display terminals,
-and new terminals are easily driven after editing a terminal description file.
-While it is advantageous to have an intelligent terminal which can locally
-insert and delete lines and characters from the display, the editor will
-function quite well on dumb terminals over slow phone lines.
-The editor makes allowance for the low bandwidth in these situations
-and uses smaller window sizes and
-different display updating algorithms to make best use of the
-limited speed available.
-.PP
-It is also possible to use the command set of
-.I vi
-on hardcopy terminals, storage tubes and ``glass tty's'' using a one line
-editing window; thus
-.I vi's
-command set is available on all terminals.
-The full command set of the more traditional, line
-oriented editor
-.I ex
-is available within
-.I vi;
-it is quite simple to switch between the two modes of editing.
-.AE
-.NH 1
-Getting started
-.PP
-.FS
-The financial support of an \s-2IBM\s0 Graduate Fellowship and the
-National Science Foundation under grants MCS74-07644-A03 and MCS78-07291
-is gratefully acknowledged.
-.FE
-This document provides a quick introduction to
-.I vi.
-(Pronounced \fIvee-eye\fP.)
-You should be running
-.I vi
-on a file you are familiar with while you are reading this.
-The first part of this document (sections 1 through 5)
-describes the basics of using
-.I vi.
-Some topics of special interest are presented in section 6, and
-some nitty-gritty details of how the editor functions are saved for section
-7 to avoid cluttering the presentation here.
-.PP
-There is also a short appendix here, which gives for each character the
-special meanings which this character has in \fIvi\fR. Attached to
-this document should be a quick reference card.
-This card summarizes the commands of
-.I vi
-in a very compact format. You should have the card handy while you are
-learning
-.I vi.
-.NH 2
-Specifying terminal type
-.PP
-Before you can start
-.I vi
-you must tell the system what kind of terminal you are using.
-Here is a (necessarily incomplete) list of terminal type codes.
-If your terminal does not appear here, you should consult with one of
-the staff members on your system to find out the code for your terminal.
-If your terminal does not have a code, one can be assigned and a description
-for the terminal can be created.
-.LP
-.TS
-center;
-ab ab ab
-a a a.
-Code Full name Type
-_
-2621 Hewlett-Packard 2621A/P Intelligent
-2645 Hewlett-Packard 264x Intelligent
-act4 Microterm ACT-IV Dumb
-act5 Microterm ACT-V Dumb
-adm3a Lear Siegler ADM-3a Dumb
-adm31 Lear Siegler ADM-31 Intelligent
-c100 Human Design Concept 100 Intelligent
-dm1520 Datamedia 1520 Dumb
-dm2500 Datamedia 2500 Intelligent
-dm3025 Datamedia 3025 Intelligent
-fox Perkin-Elmer Fox Dumb
-h1500 Hazeltine 1500 Intelligent
-h19 Heathkit h19 Intelligent
-i100 Infoton 100 Intelligent
-mime Imitating a smart act4 Intelligent
-t1061 Teleray 1061 Intelligent
-vt52 Dec VT-52 Dumb
-.TE
-.PP
-Suppose for example that you have a Hewlett-Packard HP2621A
-terminal. The code used by the system for this terminal is `2621'.
-In this case you can use one of the following commands to tell the system
-the type of your terminal:
-.DS
-% \fBsetenv TERM\fP 2621
-.DE
-This command works with the
-.I csh
-shell.
-If you are using the standard Bourne shell
-.I sh
-then you should give the commands
-.DS
-$ \fBTERM=\fP2621
-$ \fBexport TERM\fP
-.DE
-.PP
-If you want to arrange to have your terminal type set up automatically
-when you log in, you can use the
-.I tset
-program.
-If you dial in on a
-.I mime ,
-but often use hardwired ports, a typical line for your
-.I .login
-file (if you use csh) would be
-.DS
-\fBsetenv TERM \(gatset\fP \- \-d mime\(ga
-.DE
-or for your
-.I .profile
-file (if you use sh)
-.DS
-\fBTERM=\(gatse\fPt \- \-d mime\(ga
-.DE
-.I Tset
-knows which terminals are hardwired to each port
-and needs only to be told that when you dial in you
-are probably on a
-.I mime .
-.I Tset
-is usually used to change the erase and kill characters, too.
-.NH 2
-Editing a file
-.PP
-After telling the system which kind of terminal you have, you should
-make a copy of a file you are familiar with, and run
-.I vi
-on this file, giving the command
-.DS
-% \fBvi\fR \fIname\fR
-.DE
-replacing \fIname\fR with the name of the copy file you just created.
-The screen should clear and the text of your file should appear on the
-screen. If something else happens refer to the footnote.\*(dd
-.FS
-\*(dd If you gave the system an incorrect terminal type code then the
-editor may have just made a mess out of your screen. This happens when
-it sends control codes for one kind of terminal to some other
-kind of terminal. In this case hit
-the keys \fB:q\fR (colon and the q key) and then hit the \s-2RETURN\s0 key.
-This should get you back to the command level interpreter.
-Figure out what you did wrong (ask someone else if necessary) and try again.
- Another thing which can go wrong is that you typed the wrong file name and
-the editor just printed an error diagnostic. In this case you should
-follow the above procedure for getting out of the editor, and try again
-this time spelling the file name correctly.
- If the editor doesn't seem to respond to the commands which you type
-here, try sending an interrupt to it by hitting the \s-2DEL\s0 or \s-2RUB\s0
-key on your terminal, and then hitting the \fB:q\fR command again followed
-by a carriage return.
-.sp
-.FE
-.NH 2
-The editor's copy: the buffer
-.PP
-The editor does not directly modify the file which you are editing.
-Rather, the editor makes a copy of this file, in a place called the
-.I buffer,
-and remembers the file's
-name. You do not affect the contents of the file unless and until you
-write the changes you make back into the original file.
-.NH 2
-Notational conventions
-.PP
-In our examples, input which must be typed as is will be presented in
-\fBbold face\fR. Text which should be replaced with appropriate input
-will be given in \fIitalics\fR. We will represent special characters
-in \s-2SMALL CAPITALS\s0.
-.NH 2
-Arrow keys
-.PP
-The editor command set is independent of the terminal
-you are using. On most terminals with cursor positioning keys, these keys
-will also work within the editor.
-If you don't have cursor positioning keys, or even if you do, you can use
-the \fBh j k\fR and \fBl\fR keys as cursor positioning
-keys (these are labelled with arrows on an
-.I adm3a).*
-.PP
-(Particular note for the HP2621: on this terminal the function keys
-must be \fIshifted\fR (ick) to send to the machine, otherwise they
-only act locally. Unshifted use will leave the cursor positioned
-incorrectly.)
-.FS
-* As we will see later,
-.I h
-moves back to the left (like control-h which is a backspace),
-.I j
-moves down (in the same column),
-.I k
-moves up (in the same column),
-and
-.I l
-moves to the right.
-.FE
-.NH 2
-Special characters: \s-2ESC\s0, \s-2CR\s0 and \s-2DEL\s0
-.PP
-Several of these special characters are very important, so be sure to
-find them right now. Look on your keyboard for a key labelled \s-2ESC\s0
-or \s-2ALT\s0. It should be near the upper left corner of your terminal.
-Try hitting this key a few times. The editor will ring the bell
-to indicate that it is in a quiescent state.\*(dd
-.FS
-\*(dd On smart terminals where it is possible, the editor will quietly
-flash the screen rather than ringing the bell.
-.FE
-Partially formed commands are cancelled by \s-2ESC\s0, and when you insert
-text in the file you end the text insertion
-with \s-2ESC\s0. This key is a fairly
-harmless one to hit, so you can just hit it if you don't know
-what is going on until the editor rings the bell.
-.PP
-The \s-2CR\s0 or \s-2RETURN\s0 key is important because it is used
-to terminate certain commands.
-It is usually at the right side of the keyboard,
-and is the same command used at the end of each shell command.
-.PP
-Another very useful key is the \s-2DEL\s0 or \s-2RUB\s0 key, which generates
-an interrupt, telling the editor to stop what it is doing.
-It is a forceful way of making the editor listen
-to you, or to return it to the quiescent state if you don't know or don't
-like what is going on. Try hitting the `/' key on your terminal. This
-key is used when you want to specify a string to be searched for. The
-cursor should now be positioned at the bottom line of the terminal after
-a `/' printed as a prompt. You can get the cursor back to the current
-position by hitting the \s-2DEL\s0 or \s-2RUB\s0 key; try this now.*
-.FS
-* Backspacing over the `/' will also cancel the search.
-.FE
-From now on we will simply refer to hitting the \s-2DEL\s0 or \s-2RUB\s0
-key as ``sending an interrupt.''**
-.FS
-** On some systems, this interruptibility comes at a price: you cannot type
-ahead when the editor is computing with the cursor on the bottom line.
-.FE
-.PP
-The editor often echoes your commands on the last line of the terminal.
-If the cursor is on the first position of this last line, then the editor
-is performing a computation, such as computing a new position in the
-file after a search or running a command to reformat part of the buffer.
-When this is happening you can stop the editor by
-sending an interrupt.
-.NH 2
-Getting out of the editor
-.PP
-After you have worked with this introduction for a while, and you wish
-to do something else, you can give the command \fBZZ\fP
-to the editor.
-This will write the contents of the editor's buffer back into
-the file you are editing, if you made any changes, and then quit from
-the editor. You can also end an editor
-session by giving the command \fB:q!\fR\s-2CR\s0;\*(dg
-.FS
-\*(dg All commands which read from the last display line can also be
-terminated with a \s-2ESC\s0 as well as an \s-2CR\s0.
-.FE
-this is a dangerous but occasionally essential
-command which ends the editor session and discards all your changes.
-You need to know about this command in case you change the editor's
-copy of a file you wish only to look at. Be very careful
-not to give this command when you really want to save
-the changes you have made.
-.NH 1
-Moving around in the file
-.NH 2
-Scrolling and paging
-.PP
-The editor has a number of commands for moving around in the file.
-The most useful of these is generated by hitting the control and D keys
-at the same time, a control-D or `^D'. We will use this two character
-notation for referring to these control keys from now on. You may have
-a key labelled `^' on your terminal. This key will be represented as `\(ua'
-in this document; `^' is exclusively used as part of the `^x' notation
-for control characters.\*(dd
-.FS
-\*(dd If you don't have a `^' key on your terminal
-then there is probably a key labelled `\(ua'; in any case these characters
-are one and the same.
-.FE
-.PP
-As you know now if you tried hitting \fB^D\fR, this command scrolls down in
-the file. The \fBD\fR thus stands for down. Many editor commands are mnemonic
-and this makes them much easier to remember. For instance the command
-to scroll up is \fB^U\fR. Many dumb terminals can't scroll up at all, in which
-case hitting \fB^U\fR clears the screen and refreshes it
-with a line which is farther back in the file at the top.
-.PP
-If you want to see more of the file below where you are, you can
-hit \fB^E\fR to expose one more line at the bottom of the screen,
-leaving the cursor where it is.
-The command \fB^Y\fR (which is hopelessly non-mnemonic, but next to \fB^U\fR
-on the keyboard) exposes one more line at the top of the screen.
-.PP
-There are other ways to move around in the file; the keys \fB^F\fR and \fB^B\fR
-move forward and backward a page,
-keeping a couple of lines of continuity between screens
-so that it is possible to read through a file using these rather than
-\fB^D\fR and \fB^U\fR if you wish.
-.PP
-Notice the difference between scrolling and paging. If you are trying
-to read the text in a file, hitting \fB^F\fR to move forward a page
-will leave you only a little context to look back at. Scrolling on the
-other hand leaves more context, and happens more smoothly. You can continue
-to read the text as scrolling is taking place.
-.NH 2
-Searching, goto, and previous context
-.PP
-Another way to position yourself in the file is by giving the editor a string
-to search for. Type the character \fB/\fR followed by a string of characters
-terminated by \s-2CR\s0. The editor will position the cursor
-at the next occurrence of this string.
-Try hitting \fBn\fR to then go to the next occurrence of this string.
-The character \fB?\fR will search backwards from where you are, and is
-otherwise like \fB/\fR.\*(dg
-.FS
-\*(dg These searches will normally wrap around the end of the file, and thus
-find the string even if it is not on a line in the direction you search
-provided it is anywhere else in the file. You can disable this wraparound
-in scans by giving the command \fB:se nowrapscan\fR\s-2CR\s0,
-or more briefly \fB:se nows\fR\s-2CR\s0.
-.FE
-.PP
-If the search string you give the editor is not present in the
-file the editor will print
-a diagnostic on the last line of the screen, and the cursor will be returned
-to its initial position.
-.PP
-If you wish the search to match only at the beginning of a line, begin
-the search string with an \fB\(ua\fR. To match only at the end of
-a line, end the search string with a \fB$\fR.
-Thus \fB/\(uasearch\fR\s-2CR\s0 will search for the word `search' at
-the beginning of a line, and \fB/last$\fR\s-2CR\s0 searches for the
-word `last' at the end of a line.*
-.FS
-*Actually, the string you give to search for here can be a
-.I "regular expression"
-in the sense of the editors
-.I ex (1)
-and
-.I ed (1).
-If you don't wish to learn about this yet, you can disable this more
-general facility by doing
-\fB:se\ nomagic\fR\s-2CR\s0;
-by putting this command in
-EXINIT
-in your environment, you can have this always be in effect (more
-about
-.I EXINIT
-later.)
-.FE
-.PP
-The command \fBG\fR, when preceded by a number will position the cursor
-at that line in the file.
-Thus \fB1G\fR will move the cursor to
-the first line of the file. If you give \fBG\fR no count, then it moves
-to the end of the file.
-.PP
-If you are near the end of the file, and the last line is not at the bottom
-of the screen, the editor will place only the character `~' on each remaining
-line. This indicates that the last line in the file is on the screen;
-that is, the `~' lines are past the end of the file.
-.PP
-You can find out the state of the file you are editing by typing a \fB^G\fR.
-The editor will show you the name of the file you are editing, the number
-of the current line, the number of lines in the buffer, and the percentage
-of the way through the buffer which you are.
-Try doing this now, and remember the number of the line you are on.
-Give a \fBG\fR command to get to the end and then another \fBG\fR command
-to get back where you were.
-.PP
-You can also get back to a previous position by using the command
-\fB\(ga\(ga\fR (two back quotes).
-This is often more convenient than \fBG\fR because it requires no advance
-preparation.
-Try giving a \fBG\fR or a search with \fB/\fR or \fB?\fR and then a
-\fB\(ga\(ga\fR to get back to where you were. If you accidentally hit
-\fBn\fR or any command which moves you far away from a context of interest, you
-can quickly get back by hitting \fB\(ga\(ga\fR.
-.NH 2
-Moving around on the screen
-.PP
-Now try just moving the cursor around on the screen.
-If your terminal has arrow keys (4 or 5 keys with arrows
-going in each direction) try them and convince yourself
-that they work.
-If you don't have working arrow keys, you can always use
-.B h ,
-.B j ,
-.B k ,
-and
-.B l .
-Experienced users of
-.I vi
-prefer these keys to arrow keys,
-because they are usually right underneath their fingers.
-.PP
-Hit the \fB+\fR key. Each time you do, notice that the cursor
-advances to the next line in the file, at the first non-white position
-on the line. The \fB\-\fR key is like \fB+\fR but goes the other way.
-.PP
-These are very common keys for moving up and down lines in the file.
-Notice that if you go off the bottom or top with these keys then the
-screen will scroll down (and up if possible) to bring a line at a time
-into view. The \s-2RETURN\s0 key has the same effect as the \fB+\fR
-key.
-.PP
-.I Vi
-also has commands to take you to the top, middle and bottom of the screen.
-\fBH\fR will take you to the top (home) line on the screen.
-Try preceding it with a
-number as in \fB3H\fR.
-This will take you to the third line on the screen.
-Many
-.I vi
-commands take preceding numbers and do interesting things with them.
-Try \fBM\fR,
-which takes you to the middle line on the screen,
-and \fBL\fR,
-which takes you to the last line on the screen.
-\fBL\fR also takes counts, thus
-\fB5L\fR will take you to the fifth line from the bottom.
-.NH 2
-Moving within a line
-.PP
-Now try picking a word on some line on the screen, not the
-first word on the line.
-move the cursor using \s-2RETURN\s0 and \fB\-\fR to be on the line where
-the word is.
-Try hitting the \fBw\fR key. This will advance the cursor to the
-next word on the line.
-Try hitting the \fBb\fR key to back up words
-in the line.
-Also try the \fBe\fR key which advances you to the end of the current
-word rather than to the beginning of the next word.
-Also try \s-2SPACE\s0 (the space bar) which moves right one character
-and the \s-2BS\s0 (backspace or \fB^H\fR) key which moves left one character.
-The key \fBh\fR works as \fB^H\fR does and is useful if you don't have
-a \s-2BS\s0 key.
-(Also, as noted just above, \fBl\fR will move to the right.)
-.PP
-If the line had punctuation in it you may have noticed that
-that the \fBw\fR and \fBb\fR
-keys stopped at each group of punctuation. You can also go back and
-forwards words without stopping at punctuation by using \fBW\fR and \fBB\fR
-rather than the lower case equivalents. Think of these as bigger words.
-Try these on a few lines with punctuation to see how they differ from
-the lower case \fBw\fR and \fBb\fR.
-.PP
-The word keys wrap around the end of line,
-rather than stopping at the end. Try moving to a word on a line below
-where you are by repeatedly hitting \fBw\fR.
-.NH 2
-Summary
-.IP
-.TS
-lw(.50i)b a.
-\fR\s-2SPACE\s0\fP advance the cursor one position
-^B backwards to previous page
-^D scrolls down in the file
-^E exposes another line at the bottom
-^F forward to next page
-^G tell what is going on
-^H backspace the cursor
-^N next line, same column
-^P previous line, same column
-^U scrolls up in the file
-^Y exposes another line at the top
-+ next line, at the beginning
-\- previous line, at the beginning
-/ scan for a following string forwards
-? scan backwards
-B back a word, ignoring punctuation
-G go to specified line, last default
-H home screen line
-M middle screen line
-L last screen line
-W forward a word, ignoring punctuation
-b back a word
-e end of current word
-n scan for next instance of \fB/\fR or \fB?\fR pattern
-w word after this word
-.TE
-.NH 2
-View
-.PP
-If you want to use the editor to look at a file,
-rather than to make changes,
-invoke it as
-.I view
-instead of
-.I vi .
-This will set the
-.I readonly
-option which will prevent you from
-accidently overwriting the file.
-.NH 1
-Making simple changes
-.NH 2
-Inserting
-.PP
-One of the most useful commands is the
-\fBi\fR (insert) command.
-After you type \fBi\fR, everything you type until you hit \s-2ESC\s0
-is inserted into the file.
-Try this now; position yourself to some word in the file and try inserting
-text before this word.
-If you are on an dumb terminal it will seem, for a minute,
-that some of the characters in your line have been overwritten, but they will
-reappear when you hit \s-2ESC\s0.
-.PP
-Now try finding a word which can, but does not, end in an `s'.
-Position yourself at this word and type \fBe\fR (move to end of word), then
-\fBa\fR for append and then `s\s-2ESC\s0' to terminate the textual insert.
-This sequence of commands can be used to easily pluralize a word.
-.PP
-Try inserting and appending a few times to make sure you understand how
-this works; \fBi\fR placing text to the left of the cursor, \fBa\fR to
-the right.
-.PP
-It is often the case that you want to add new lines to the file you are
-editing, before or after some specific line in the file. Find a line
-where this makes sense and then give the command \fBo\fR to create a
-new line after the line you are on, or the command \fBO\fR to create
-a new line before the line you are on. After you create a new line in
-this way, text you type up to an \s-2ESC\s0 is inserted on the new line.
-.PP
-Many related editor commands
-are invoked by the same letter key and differ only in that one is given
-by a lower
-case key and the other is given by
-an upper case key. In these cases, the
-upper case key often differs from the lower case key in its sense of
-direction, with
-the upper case key working backward and/or up, while the lower case
-key moves forward and/or down.
-.PP
-Whenever you are typing in text, you can give many lines of input or
-just a few characters.
-To type in more than one line of text,
-hit a \s-2RETURN\s0 at the middle of your input. A new line will be created
-for text, and you can continue to type. If you are on a slow
-and dumb terminal the editor may choose to wait to redraw the
-tail of the screen, and will let you type over the existing screen lines.
-This avoids the lengthy delay which would occur if the editor attempted
-to keep the tail of the screen always up to date. The tail of the screen will
-be fixed up, and the missing lines will reappear, when you hit \s-2ESC\s0.
-.PP
-While you are inserting new text, you can use the characters you normally use
-at the system command level (usually \fB^H\fR or \fB#\fR) to backspace
-over the last
-character which you typed, and the character which you use to kill input lines
-(usually \fB@\fR, \fB^X\fR, or \fB^U\fR)
-to erase the input you have typed on the current line.\*(dg
-.FS
-\*(dg In fact, the character \fB^H\fR (backspace) always works to erase the
-last input character here, regardless of what your erase character is.
-.FE
-The character \fB^W\fR
-will erase a whole word and leave you after the space after the previous
-word; it is useful for quickly backing up in an insert.
-.PP
-Notice that when you backspace during an insertion the characters you
-backspace over are not erased; the cursor moves backwards, and the characters
-remain on the display. This is often useful if you are planning to type
-in something similar. In any case the characters disappear when when
-you hit \s-2ESC\s0; if you want to get rid of them immediately, hit an
-\s-2ESC\s0 and then \fBa\fR again.
-.PP
-Notice also that you can't erase characters which you didn't insert, and that
-you can't backspace around the end of a line. If you need to back up
-to the previous line to make a correction, just hit \s-2ESC\s0 and move
-the cursor back to the previous line. After making the correction you
-can return to where you were and use the insert or append command again.
-.NH 2
-Making small corrections
-.PP
-You can make small corrections in existing text quite easily.
-Find a single character which is wrong or just pick any character.
-Use the arrow keys to find the character, or
-get near the character with the word motion keys and then either
-backspace (hit the \s-2BS\s0 key or \fB^H\fR or even just \fBh\fR) or
-\s-2SPACE\s0 (using the space bar)
-until the cursor is on the character which is wrong.
-If the character is not needed then hit the \fBx\fP key; this deletes
-the character from the file. It is analogous to the way you \fBx\fP
-out characters when you make mistakes on a typewriter (except it's not
-as messy).
-.PP
-If the character
-is incorrect, you can replace it with the correct character by giving
-the command \fBr\fR\fIc\fR,
-where \fIc\fR is replaced by the correct character.
-Finally if the character which is incorrect should be replaced
-by more than one character, give the command \fBs\fR which substitutes
-a string of characters, ending with \s-2ESC\s0, for it.
-If there are a small number of characters
-which are wrong you can precede \fBs\fR with a count of the number of
-characters to be replaced. Counts are also useful with \fBx\fR to specify
-the number of characters to be deleted.
-.NH 2
-More corrections: operators
-.PP
-You already know almost enough to make changes at a higher level.
-All you need to know now is that the
-.B d
-key acts as a delete operator. Try the command
-.B dw
-to delete a word.
-Try hitting \fB.\fR a few times. Notice that this repeats the effect
-of the \fBdw\fR. The command \fB.\fR repeats the last command which
-made a change. You can remember it by analogy with an ellipsis `\fB...\fR'.
-.PP
-Now try
-\fBdb\fR.
-This deletes a word backwards, namely the preceding word.
-Try
-\fBd\fR\s-2SPACE\s0. This deletes a single character, and is equivalent
-to the \fBx\fR command.
-.PP
-Another very useful operator is
-.B c
-or change. The command
-.B cw
-thus changes the text of a single word.
-You follow it by the replacement text ending with an \s-2ESC\s0.
-Find a word which you can change to another, and try this
-now.
-Notice that the end of the text to be changed was marked with the character
-`$' so that you can see this as you are typing in the new material.
-.NH 2
-Operating on lines
-.PP
-It is often the case that you want to operate on lines.
-Find a line which you want to delete, and type
-\fBdd\fR,
-the
-.B d
-operator twice. This will delete the line.
-If you are on a dumb terminal, the editor may just erase the line on
-the screen, replacing it with a line with only an @ on it. This line
-does not correspond to any line in your file, but only acts as a place
-holder. It helps to avoid a lengthy redraw of the rest of the screen
-which would be necessary to close up the hole created by the deletion
-on a terminal without a delete line capability.
-.PP
-Try repeating the
-.B c
-operator twice; this will change a whole line, erasing its previous contents and
-replacing them with text you type up to an \s-2ESC\s0.\*(dg
-.FS
-\*(dg The command \fBS\fR is a convenient synonym for for \fBcc\fR, by
-analogy with \fBs\fR. Think of \fBS\fR as a substitute on lines, while
-\fBs\fR is a substitute on characters.
-.FE
-.PP
-You can delete or change more than one line by preceding the
-.B dd
-or
-.B cc
-with a count, i.e. \fB5dd\fR deletes 5 lines.
-You can also give a command like \fBdL\fR to delete all the lines up to
-and including
-the last line on the screen, or \fBd3L\fR to delete through the third from
-the bottom line. Try some commands like this now.*
-.FS
-* One subtle point here involves using the \fB/\fR search after a \fBd\fR.
-This will normally delete characters from the current position to the
-point of the match. If what is desired is to delete whole lines
-including the two points, give the pattern as \fB/pat/+0\fR, a line address.
-.FE
-Notice that the editor lets you know when you change a large number of
-lines so that you can see the extent of the change.
-The editor will also always tell you when a change you make affects text which
-you cannot see.
-.NH 2
-Undoing
-.PP
-Now suppose that the last change which you made was incorrect;
-you could use the insert, delete and append commands to put the correct
-material back. However, since it is often the case that we regret a
-change or make a change incorrectly, the editor provides a
-.B u
-(undo) command to reverse the last change which you made.
-Try this a few times, and give it twice in a row to notice that an
-.B u
-also undoes a
-.B u.
-.PP
-The undo command lets you reverse only a single change. After you make
-a number of changes to a line, you may decide that you would rather have
-the original state of the line back. The
-.B U
-command restores the current line to the state before you started changing
-it.
-.PP
-You can recover text which you delete, even if
-undo will not bring it back; see the section on recovering lost text
-below.
-.NH 2
-Summary
-.IP
-.TS
-lw(.50i)b a.
-\fR\s-2SPACE\s0\fP advance the cursor one position
-^H backspace the cursor
-^W erase a word during an insert
-\fRerase\fP your erase (usually ^H or #), erases a character during an insert
-\fRkill\fP your kill (usually @, ^X, or ^U), kills the insert on this line
-\&\fB.\fP repeats the changing command
-O opens and inputs new lines, above the current
-U undoes the changes you made to the current line
-a appends text after the cursor
-c changes the object you specify to the following text
-d deletes the object you specify
-i inserts text before the cursor
-o opens and inputs new lines, below the current
-u undoes the last change
-.TE
-.NH 1
-Moving about; rearranging and duplicating text
-.NH 2
-Low level character motions
-.PP
-Now move the cursor to a line where there is a punctuation or a bracketing
-character such as a parenthesis or a comma or period. Try the command
-\fBf\fR\fIx\fR where \fIx\fR is this character. This command finds
-the next \fIx\fR character to the right of the cursor in the current
-line. Try then hitting a \fB;\fR, which finds the next instance of the
-same character. By using the \fBf\fR command and then a sequence of
-\fB;\fR's you can often
-get to a particular place in a line much faster than with a sequence
-of word motions or \s-2SPACE\s0s.
-There is also a \fBF\fR command, which is like \fBf\fR, but searches
-backward. The \fB;\fR command repeats \fBF\fR also.
-.PP
-When you are operating on the text in a line it is often desirable to
-deal with the characters up to, but not including, the first instance of
-a character. Try \fBdf\fR\fIx\fR for some \fIx\fR now and
-notice that the \fIx\fR character is deleted. Undo this with \fBu\fR
-and then try \fBdt\fR\fIx\fR; the \fBt\fR here stands for to, i.e.
-delete up to the next \fIx\fR, but not the \fIx\fR. The command \fBT\fR
-is the reverse of \fBt\fR.
-.PP
-When working with the text of a single line, an \fB\(ua\fR moves the
-cursor to the first non-white position on the line, and a
-\fB$\fR moves it to the end of the line. Thus \fB$a\fR will append new
-text at the end of the current line.
-.PP
-Your file may have tab (\fB^I\fR) characters in it. These
-characters are represented as a number of spaces expanding to a tab stop,
-where tab stops are every 8 positions.*
-.FS
-* This is settable by a command of the form \fB:se ts=\fR\fIx\fR\s-2CR\s0,
-where \fIx\fR is 4 to set tabstops every four columns. This has
-effect on the screen representation within the editor.
-.FE
-When the cursor is at a tab, it sits on the last of the several spaces
-which represent that tab. Try moving the cursor back and forth over
-tabs so you understand how this works.
-.PP
-On rare occasions, your file may have nonprinting characters in it.
-These characters are displayed in the same way they are represented in
-this document, that is with a two character code, the first character
-of which is `^'. On the screen non-printing characters resemble a `^'
-character adjacent to another, but spacing or backspacing over the character
-will reveal that the two characters are, like the spaces representing
-a tab character, a single character.
-.PP
-The editor sometimes discards control characters,
-depending on the character and the setting of the
-.I beautify
-option,
-if you attempt to insert them in your file.
-You can get a control character in the file by beginning
-an insert and then typing a \fB^V\fR before the control
-character. The
-\fB^V\fR quotes the following character, causing it to be
-inserted directly into the file.
-.PP
-.NH 2
-Higher level text objects
-.PP
-In working with a document it is often advantageous to work in terms
-of sentences, paragraphs, and sections. The operations \fB(\fR and \fB)\fR
-move to the beginning of the previous and next sentences respectively.
-Thus the command \fBd)\fR will delete the rest of the current sentence;
-likewise \fBd(\fR will delete the previous sentence if you are at the
-beginning of the current sentence, or the current sentence up to where
-you are if you are not at the beginning of the current sentence.
-.PP
-A sentence is defined to end at a `.', `!' or `?' which is followed by
-either the end of a line, or by two spaces. Any number of closing `)',
-`]', `"' and `\(aa' characters may appear after the `.', `!' or `?' before
-the spaces or end of line.
-.PP
-The operations \fB{\fR and \fB}\fR move over paragraphs and the operations
-\fB[[\fR and \fB]]\fR move over sections.\*(dg
-.FS
-\*(dg The \fB[[\fR and \fB]]\fR operations
-require the operation character to be doubled because they can move the
-cursor far from where it currently is. While it is easy to get back
-with the command \fB\(ga\(ga\fP,
-these commands would still be frustrating
-if they were easy to hit accidentally.
-.FE
-.PP
-A paragraph begins after each empty line, and also
-at each of a set of paragraph macros, specified by the pairs of characters
-in the definition of the string valued option \fIparagraphs\fR.
-The default setting for this option defines the paragraph macros of the
-\fI\-ms\fR and \fI\-mm\fR macro packages, i.e. the `.IP', `.LP', `.PP'
-and `.QP', `.P' and `.LI' macros.\*(dd
-.FS
-\*(dd You can easily change or extend this set of macros by assigning a
-different string to the \fIparagraphs\fR option in your EXINIT.
-See section 6.2 for details.
-The `.bp' directive is also considered to start a paragraph.
-.FE
-Each paragraph boundary is also a sentence boundary. The sentence
-and paragraph commands can
-be given counts to operate over groups of sentences and paragraphs.
-.PP
-Sections in the editor begin after each macro in the \fIsections\fR option,
-normally `.NH', `.SH', `.H' and `.HU', and each line with a formfeed \fB^L\fR
-in the first column.
-Section boundaries are always line and paragraph boundaries also.
-.PP
-Try experimenting with the sentence and paragraph commands until you are
-sure how they work. If you have a large document, try looking through
-it using the section commands.
-The section commands interpret a preceding count as a different window size in
-which to redraw the screen at the new location, and this window size
-is the base size for newly drawn windows until another size is specified.
-This is very useful
-if you are on a slow terminal and are looking for a particular section.
-You can give the first section command a small count to then see each successive
-section heading in a small window.
-.NH 2
-Rearranging and duplicating text
-.PP
-The editor has a single unnamed buffer where the last deleted or
-changed away text is saved, and a set of named buffers \fBa\fR\-\fBz\fR
-which you can use to save copies of text and to move text around in
-your file and between files.
-.PP
-The operator
-.B y
-yanks a copy of the object which follows into the unnamed buffer.
-If preceded by a buffer name, \fB"\fR\fIx\fR\|\fBy\fR, where
-\fIx\fR here is replaced by a letter \fBa\-z\fR, it places the text in the named
-buffer. The text can then be put back in the file with the commands
-.B p
-and
-.B P;
-\fBp\fR puts the text after or below the cursor, while \fBP\fR puts the text
-before or above the cursor.
-.PP
-If the text which you
-yank forms a part of a line, or is an object such as a sentence which
-partially spans more than one line, then when you put the text back,
-it will be placed after the cursor (or before if you
-use \fBP\fR). If the yanked text forms whole lines, they will be put
-back as whole lines, without changing the current line. In this case,
-the put acts much like a \fBo\fR or \fBO\fR command.
-.PP
-Try the command \fBYP\fR. This makes a copy of the current line and
-leaves you on this copy, which is placed before the current line.
-The command \fBY\fR is a convenient abbreviation for \fByy\fR.
-The command \fBYp\fR will also make a copy of the current line, and place
-it after the current line. You can give \fBY\fR a count of lines to
-yank, and thus duplicate several lines; try \fB3YP\fR.
-.PP
-To move text within the buffer, you need to delete it in one place, and
-put it back in another. You can precede a delete operation by the
-name of a buffer in which the text is to be stored as in \fB"a5dd\fR
-deleting 5 lines into the named buffer \fIa\fR. You can then move the
-cursor to the eventual resting place of the these lines and do a \fB"ap\fR
-or \fB"aP\fR to put them back.
-In fact, you can switch and edit another file before you put the lines
-back, by giving a command of the form \fB:e \fR\fIname\fR\s-2CR\s0 where
-\fIname\fR is the name of the other file you want to edit. You will
-have to write back the contents of the current editor buffer (or discard
-them) if you have made changes before the editor will let you switch
-to the other file.
-An ordinary delete command saves the text in the unnamed buffer,
-so that an ordinary put can move it elsewhere.
-However, the unnamed buffer is lost when you change files,
-so to move text from one file to another you should use an unnamed buffer.
-.NH 2
-Summary.
-.IP
-.TS
-lw(.50i)b a.
-\(ua first non-white on line
-$ end of line
-) forward sentence
-} forward paragraph
-]] forward section
-( backward sentence
-{ backward paragraph
-[[ backward section
-f\fIx\fR find \fIx\fR forward in line
-p put text back, after cursor or below current line
-y yank operator, for copies and moves
-t\fIx\fR up to \fIx\fR forward, for operators
-F\fIx\fR f backward in line
-P put text back, before cursor or above current line
-T\fIx\fR t backward in line
-.TE
-.NH 1
-High level commands
-.NH 2
-Writing, quitting, editing new files
-.PP
-So far we have seen how to enter
-.I vi
-and to write out our file using either
-\fBZZ\fR or \fB:w\fR\s-2CR\s0. The first exits from
-the editor,
-(writing if changes were made),
-the second writes and stays in the editor.
-.PP
-If you have changed the editor's copy of the file but do not wish to
-save your changes, either because you messed up the file or decided that the
-changes are not an improvement to the file, then you can give the command
-\fB:q!\fR\s-2CR\s0 to quit from the editor without writing the changes.
-You can also reedit the same file (starting over) by giving the command
-\fB:e!\fR\s-2CR\s0. These commands should be used only rarely, and with
-caution, as it is not possible to recover the changes you have made after
-you discard them in this manner.
-.PP
-You can edit a different file without leaving the editor by giving the
-command \fB:e\fR\ \fIname\fR\s-2CR\s0. If you have not written out
-your file before you try to do this, then the editor will tell you this,
-and delay editing the other file. You can then give the command
-\fB:w\fR\s-2CR\s0 to save your work and then the \fB:e\fR\ \fIname\fR\s-2CR\s0
-command again, or carefully give the command \fB:e!\fR\ \fIname\fR\s-2CR\s0,
-which edits the other file discarding the changes you have made to the
-current file.
-To have the editor automatically save changes,
-include
-.I "set autowrite"
-in your EXINIT,
-and use \fB:n\fP instead of \fB:e\fP.
-.NH 2
-Escaping to a shell
-.PP
-You can get to a shell to execute a single command by giving a
-.I vi
-command of the form \fB:!\fIcmd\fR\s-2CR\s0.
-The system will run the single command
-.I cmd
-and when the command finishes, the editor will ask you to hit a \s-2RETURN\s0
-to continue. When you have finished looking at the output on the screen,
-you should hit \s-2RETURN\s0 and the editor will clear the screen and
-redraw it. You can then continue editing.
-You can also give another \fB:\fR command when it asks you for a \s-2RETURN\s0;
-in this case the screen will not be redrawn.
-.PP
-If you wish to execute more than one command in the shell, then you can
-give the command \fB:sh\fR\s-2CR\s0.
-This will give you a new shell, and when you finish with the shell, ending
-it by typing a \fB^D\fR, the editor will clear the screen and continue.
-.PP
-On systems which support it, \fB^Z\fP will suspend the editor
-and return to the (top level) shell.
-When the editor is resumed, the screen will be redrawn.
-.NH 2
-Marking and returning
-.PP
-The command \fB\(ga\(ga\fR returned to the previous place
-after a motion of the cursor by a command such as \fB/\fR, \fB?\fR or
-\fBG\fR. You can also mark lines in the file with single letter tags
-and return to these marks later by naming the tags. Try marking the
-current line with the command \fBm\fR\fIx\fR, where you should pick some
-letter for \fIx\fR, say `a'. Then move the cursor to a different line
-(any way you like) and hit \fB\(gaa\fR. The cursor will return to the
-place which you marked.
-Marks last only until you edit another file.
-.PP
-When using operators such as
-.B d
-and referring to marked lines, it is often desirable to delete whole lines
-rather than deleting to the exact position in the line marked by \fBm\fR.
-In this case you can use the form \fB\(aa\fR\fIx\fR rather than
-\fB\(ga\fR\fIx\fR. Used without an operator, \fB\(aa\fR\fIx\fR will move to
-the first non-white character of the marked line; similarly \fB\(aa\(aa\fR
-moves to the first non-white character of the line containing the previous
-context mark \fB\(ga\(ga\fR.
-.NH 2
-Adjusting the screen
-.PP
-If the screen image is messed up because of a transmission error to your
-terminal, or because some program other than the editor wrote output
-to your terminal, you can hit a \fB^L\fR, the \s-2ASCII\s0 form-feed
-character, to cause the screen to be refreshed.
-.PP
-On a dumb terminal, if there are @ lines in the middle of the screen
-as a result of line deletion, you may get rid of these lines by typing
-\fB^R\fR to cause the editor to retype the screen, closing up these holes.
-.PP
-Finally, if you wish to place a certain line on the screen at the top
-middle or bottom of the screen, you can position the cursor to that line,
-and then give a \fBz\fR command.
-You should follow the \fBz\fR command with a \s-2RETURN\s0 if you want
-the line to appear at the top of the window, a \fB.\fR if you want it
-at the center, or a \fB\-\fR if you want it at the bottom.
-.NH 1
-Special topics
-.NH 2
-Editing on slow terminals
-.PP
-When you are on a slow terminal, it is important to limit the amount
-of output which is generated to your screen so that you will not suffer
-long delays, waiting for the screen to be refreshed. We have already
-pointed out how the editor optimizes the updating of the screen during
-insertions on dumb terminals to limit the delays, and how the editor erases
-lines to @ when they are deleted on dumb terminals.
-.PP
-The use of the slow terminal insertion mode is controlled by the
-.I slowopen
-option. You can force the editor to use this mode even on faster terminals
-by giving the command \fB:se slow\fR\s-2CR\s0. If your system is sluggish
-this helps lessen the amount of output coming to your terminal.
-You can disable this option by \fB:se noslow\fR\s-2CR\s0.
-.PP
-The editor can simulate an intelligent terminal on a dumb one. Try
-giving the command \fB:se redraw\fR\s-2CR\s0. This simulation generates
-a great deal of output and is generally tolerable only on lightly loaded
-systems and fast terminals. You can disable this by giving the command
- \fB:se noredraw\fR\s-2CR\s0.
-.PP
-The editor also makes editing more pleasant at low speed by starting
-editing in a small window, and letting the window expand as you edit.
-This works particularly well on intelligent terminals. The editor can
-expand the window easily when you insert in the middle of the screen
-on these terminals. If possible, try the editor on an intelligent terminal
-to see how this works.
-.PP
-You can control the size of the window which is redrawn each time the
-screen is cleared by giving window sizes as argument to the commands
-which cause large screen motions:
-.DS
-.B ": / ? [[ ]] \(ga \(aa"
-.DE
-Thus if you are searching for a particular instance of a common string
-in a file you can precede the first search command by a small number,
-say 3, and the editor will draw three line windows around each instance
-of the string which it locates.
-.PP
-You can easily expand or contract the window, placing the current line
-as you choose, by giving a number on a \fBz\fR command, after the \fBz\fR
-and before the following \s-2RETURN\s0, \fB.\fR or \fB\-\fR. Thus the
-command \fBz5.\fR redraws the screen with the current line in the center
-of a five line window.\*(dg
-.FS
-\*(dg Note that the command \fB5z.\fR has an entirely different effect,
-placing line 5 in the center of a new window.
-.FE
-.PP
-If the editor is redrawing or otherwise updating large portions of the
-display, you can interrupt this updating by hitting a \s-2DEL\s0 or \s-2RUB\s0
-as usual. If you do this you may partially confuse the editor about
-what is displayed on the screen. You can still edit the text on
-the screen if you wish; clear up the confusion
-by hitting a \fB^L\fR; or move or search again, ignoring the
-current state of the display.
-.PP
-See section 7.8 on \fIopen\fR mode for another way to use the
-.I vi
-command set on slow terminals.
-.NH 2
-Options, set, and editor startup files
-.PP
-The editor has a set of options, some of which have been mentioned above.
-The most useful options are given in the following table.
-.KF
-.TS
-lb lb lb lb
-l l l a.
-Name Default Description
-_
-autoindent noai Supply indentation automatically
-autowrite noaw Automatic write before \fB:n\fR, \fB:ta\fR, \fB^\(ua\fR, \fB!\fR
-ignorecase noic Ignore case in searching
-lisp nolisp \fB( { ) }\fR commands deal with S-expressions
-list nolist Tabs print as ^I; end of lines marked with $
-magic nomagic The characters . [ and * are special in scans
-number nonu Lines are displayed prefixed with line numbers
-paragraphs para=IPLPPPQPbpP LI Macro names which start paragraphs
-redraw nore Simulate a smart terminal on a dumb one
-sections sect=NHSHH HU Macro names which start new sections
-shiftwidth sw=8 Shift distance for <, > and input \fB^D\fP and \fB^T\fR
-showmatch nosm Show matching \fB(\fP or \fB{\fP as \fB)\fP or \fB}\fR is typed
-slowopen slow Postpone display updates during inserts
-term dumb The kind of terminal you are using.
-.TE
-.KE
-.PP
-The options are of three kinds: numeric options, string options, and
-toggle options. You can set numeric and string options by a statement
-of the form
-.DS
-\fBset\fR \fIopt\fR\fB=\fR\fIval\fR
-.DE
-and toggle options can be set or unset by statements of one of the forms
-.DS
-\fBset\fR \fIopt\fR
-\fBset\fR \fBno\fR\fIopt\fR
-.DE
-These statements can be placed in your EXINIT in your environment,
-or given while you are running
-.I vi
-by preceding them with a \fB:\fR and following them with a \s-2CR\s0.
-.PP
-You can get a list of all options which you have changed by the
-command \fB:set\fR\s-2CR\s0, or the value of a single option by the
-command \fB:set\fR \fIopt\fR\fB?\fR\s-2CR\s0.
-A list of all possible options and their values is generated by
-\fB:set all\fP\s-2CR\s0.
-Set can be abbreviated \fBse\fP.
-Multiple options can be placed on one line, e.g.
-\fB:se ai aw nu\fP\s-2CR\s0.
-.PP
-Options set by the \fBset\fP command only last
-while you stay in the editor.
-It is common to want to have certain options set whenever you
-use the editor.
-This can be accomplished by creating a list of \fIex\fP commands\*(dg
-.FS
-\*(dg
-All commands which start with
-.B :
-are \fIex\fP commands.
-.FE
-which are to be run every time you start up \fIex\fP, \fIedit\fP,
-or \fIvi\fP.
-A typical list includes a \fBset\fP command, and possibly a few
-\fBmap\fP commands.
-Since it is advisable to get these commands on one line, they can
-be separated with the | character, for example:
-.DS
-\fBset\fP ai aw terse|\fBmap\fP @ dd|\fBmap\fP # x
-.DE
-which sets the options \fIautoindent\fP, \fIautowrite\fP, \fIterse\fP,
-(the
-.B set
-command),
-makes @ delete a line,
-(the first
-.B map ),
-and makes # delete a character,
-(the second
-.B map ).
-(See section 6.9 for a description of the \fBmap\fP command)
-This string should be placed in the variable EXINIT in your environment.
-If you use the shell \fIcsh\fP,
-put this line in the file
-.I .login
-in your home directory:
-.DS
-setenv EXINIT \(aa\fBset\fP ai aw terse|\fBmap\fP @ dd|\fBmap\fP # x\(aa
-.DE
-If you use the standard shell \fIsh\fP,
-put these lines in the file
-.I .profile
-in your home directory:
-.DS
-EXINIT=\(aa\fBset\fP ai aw terse|\fBmap\fP @ dd|\fBmap\fP # x\(aa
-export EXINIT
-.DE
-Of course, the particulars of the line would depend on which options
-you wanted to set.
-.NH 2
-Recovering lost lines
-.PP
-You might have a serious problem if you delete a number of lines and then
-regret that they were deleted. Despair not, the editor saves the last
-9 deleted blocks of text in a set of numbered registers 1\-9.
-You can get the \fIn\fR'th previous deleted text back in your file by
-the command
-"\fR\fIn\fR\|\fBp\fR.
-The "\fR here says that a buffer name is to follow,
-\fIn\fR is the number of the buffer you wish to try
-(use the number 1 for now),
-and
-.B p
-is the put command, which puts text in the buffer after the cursor.
-If this doesn't bring back the text you wanted, hit
-.B u
-to undo this and then
-\fB\&.\fR
-(period)
-to repeat the put command.
-In general the
-\fB\&.\fR
-command will repeat the last change you made.
-As a special case, when the last command refers to a numbered text buffer,
-the \fB.\fR command increments the number of the buffer before repeating
-the command. Thus a sequence of the form
-.DS
-\fB"1pu.u.u.\fR
-.DE
-will, if repeated long enough, show you all the deleted text which has
-been saved for you.
-You can omit the
-.B u
-commands here to gather up all this text in the buffer, or stop after any
-\fB\&.\fR command to keep just the then recovered text.
-The command
-.B P
-can also be used rather than
-.B p
-to put the recovered text before rather than after the cursor.
-.NH 2
-Recovering lost files
-.PP
-If the system crashes, you can recover the work you were doing
-to within a few changes. You will normally receive mail when you next
-login giving you the name of the file which has been saved for you.
-You should then change to the directory where you were when the system
-crashed and give a command of the form:
-.DS
-% \fBvi \-r\fR \fIname\fR
-.DE
-replacing \fIname\fR with the name of the file which you were editing.
-This will recover your work to a point near where you left off.\*(dg
-.FS
-\*(dg In rare cases, some of the lines of the file may be lost. The
-editor will give you the numbers of these lines and the text of the lines
-will be replaced by the string `LOST'. These lines will almost always
-be among the last few which you changed. You can either choose to discard
-the changes which you made (if they are easy to remake) or to replace
-the few lost lines by hand.
-.FE
-.PP
-You can get a listing of the files which are saved for you by giving
-the command:
-.DS
-% \fBvi \-r\fR
-.DE
-If there is more than one instance of a particular file saved, the editor
-gives you the newest instance each time you recover it. You can thus
-get an older saved copy back by first recovering the newer copies.
-.PP
-For this feature to work,
-.I vi
-must be correctly installed by a super user on your system,
-and the
-.I mail
-program must exist to receive mail.
-The invocation ``\fIvi -r\fP'' will not always list all saved files,
-but they can be recovered even if they are not listed.
-.NH 2
-Continuous text input
-.PP
-When you are typing in large amounts of text it is convenient to have
-lines broken near the right margin automatically. You can cause this
-to happen by giving the command
-\fB:se wm=10\fR\s-2CR\s0.
-This causes all lines to be broken at a space at least 10 columns
-from the right hand edge of the screen.
-.PP
-If the editor breaks an input line and you wish to put it back together
-you can tell it to join the lines with \fBJ\fR. You can give \fBJ\fR
-a count of the number of lines to be joined as in \fB3J\fR to join 3
-lines. The editor supplies white space, if appropriate,
-at the juncture of the joined
-lines, and leaves the cursor at this white space.
-You can kill the white space with \fBx\fR if you don't want it.
-.NH 2
-Features for editing programs
-.PP
-The editor has a number of commands for editing programs.
-The thing that most distinguishes editing of programs from editing of text
-is the desirability of maintaining an indented structure to the body of
-the program. The editor has a
-.I autoindent
-facility for helping you generate correctly indented programs.
-.PP
-To enable this facility you can give the command \fB:se ai\fR\s-2CR\s0.
-Now try opening a new line with \fBo\fR and type some characters on the
-line after a few tabs. If you now start another line, notice that the
-editor supplies white space at the beginning of the line to line it up
-with the previous line. You cannot backspace over this indentation,
-but you can use \fB^D\fR key to backtab over the supplied indentation.
-.PP
-Each time you type \fB^D\fR you back up one position, normally to an
-8 column boundary. This amount is settable; the editor has an option
-called
-.I shiftwidth
-which you can set to change this value.
-Try giving the command \fB:se sw=4\fR\s-2CR\s0
-and then experimenting with autoindent again.
-.PP
-For shifting lines in the program left and right, there are operators
-.B <
-and
-.B >.
-These shift the lines you specify right or left by one
-.I shiftwidth.
-Try
-.B <<
-and
-.B >>
-which shift one line left or right, and
-.B <L
-and
-.B >L
-shifting the rest of the display left and right.
-.PP
-If you have a complicated expression and wish to see how the parentheses
-match, put the cursor at a left or right parenthesis and hit \fB%\fR.
-This will show you the matching parenthesis.
-This works also for braces { and }, and brackets [ and ].
-.PP
-If you are editing C programs, you can use the \fB[[\fR and \fB]]\fR keys
-to advance or retreat to a line starting with a \fB{\fR, i.e. a function
-declaration at a time. When \fB]]\fR is used with an operator it stops
-after a line which starts with \fB}\fR; this is sometimes useful with
-\fBy]]\fR.
-.NH 2
-Filtering portions of the buffer
-.PP
-You can run system commands over portions of the buffer using the operator
-\fB!\fR.
-You can use this to sort lines in the buffer, or to reformat portions
-of the buffer with a pretty-printer.
-Try typing in a list of random words, one per line and ending them
-with a blank line. Back up to the beginning of the list, and then give
-the command \fB!}sort\fR\s-2CR\s0. This says to sort the next paragraph
-of material, and the blank line ends a paragraph.
-.NH 2
-Commands for editing \s-2LISP\s0
-.PP
-If you are editing a \s-2LISP\s0 program you should set the option
-.I lisp
-by doing
-\fB:se\ lisp\fR\s-2CR\s0.
-This changes the \fB(\fR and \fB)\fR commands to move backward and forward
-over s-expressions.
-The \fB{\fR and \fB}\fR commands are like \fB(\fR and \fB)\fR but don't
-stop at atoms. These can be used to skip to the next list, or through
-a comment quickly.
-.PP
-The
-.I autoindent
-option works differently for \s-2LISP\s0, supplying indent to align at
-the first argument to the last open list. If there is no such argument
-then the indent is two spaces more than the last level.
-.PP
-There is another option which is useful for typing in \s-2LISP\s0, the
-.I showmatch
-option.
-Try setting it with
-\fB:se sm\fR\s-2CR\s0
-and then try typing a `(' some words and then a `)'. Notice that the
-cursor shows the position of the `(' which matches the `)' briefly.
-This happens only if the matching `(' is on the screen, and the cursor
-stays there for at most one second.
-.PP
-The editor also has an operator to realign existing lines as though they
-had been typed in with
-.I lisp
-and
-.I autoindent
-set. This is the \fB=\fR operator.
-Try the command \fB=%\fR at the beginning of a function. This will realign
-all the lines of the function declaration.
-.PP
-When you are editing \s-2LISP\s0,, the \fB[[\fR and \fR]]\fR advance
-and retreat to lines beginning with a \fB(\fR, and are useful for dealing
-with entire function definitions.
-.NH 2
-Macros
-.PP
-.I Vi
-has a parameterless macro facility, which lets you set it up so that
-when you hit a single keystroke, the editor will act as though
-you had hit some longer sequence of keys. You can set this up if
-you find yourself typing the same sequence of commands repeatedly.
-.PP
-Briefly, there are two flavors of macros:
-.IP a)
-Ones where you put the macro body in a buffer register, say \fIx\fR.
-You can then type \fB@x\fR to invoke the macro. The \fB@\fR may be followed
-by another \fB@\fR to repeat the last macro.
-.IP b)
-You can use the
-.I map
-command from
-.I vi
-(typically in your
-.I EXINIT )
-with a command of the form:
-.DS
-:map \fIlhs\fR \fIrhs\fR\s-2CR\f0
-.DE
-mapping
-.I lhs
-into
-.I rhs.
-There are restrictions:
-.I lhs
-should be one keystroke (either 1 character or one function key)
-since it must be entered within one second
-(unless
-.I notimeout
-is set, in which case you can type it as slowly as you wish,
-and
-.I vi
-will wait for you to finish it before it echoes anything).
-The
-.I lhs
-can be no longer than 10 characters, the
-.I rhs
-no longer than 100.
-To get a space, tab or newline into
-.I lhs
-or
-.I rhs
-you should escape them with a \fB^V\fR.
-(It may be necessary to double the \fB^V\fR if the map
-command is given inside
-.I vi,
-rather than in
-.I ex.)
-Spaces and tabs inside the
-.I rhs
-need not be escaped.
-.PP
-Thus to make the \fBq\fR key write and exit the editor, you can give
-the command
-.DS
-:map q :wq\fB^V^V\fP\s-2CR CR\s0
-.DE
-which means that whenever you type \fBq\fR, it will be as though you
-had typed the four characters \fB:wq\fR\s-2CR\s0.
-A \fB^V\fR's is needed because without it the \s-2CR\s0 would end the
-\fB:\fR command, rather than becoming part of the
-.I map
-definition.
-There are two
-.B ^V 's
-because from within
-.I vi ,
-two
-.B ^V 's
-must be typed to get one.
-The first \s-2CR\s0 is part of the
-.I rhs ,
-the second terminates the : command.
-.PP
-Macros can be deleted with
-.DS
-unmap lhs
-.DE
-.PP
-If the
-.I lhs
-of a macro is ``#0'' through ``#9'', this maps the particular function key
-instead of the 2 character ``#'' sequence. So that terminals without
-function keys can access such definitions, the form ``#x'' will mean function
-key
-.I x
-on all terminals (and need not be typed within one second.)
-The character ``#'' can be changed by using a macro in the usual way:
-.DS
-:map \fB^V^V^I\fP #
-.DE
-to use tab, for example. (This won't affect the
-.I map
-command, which still uses
-.B #,
-but just the invocation from visual mode.
-.PP
-The undo command reverses an entire macro call as a unit,
-if it made any changes.
-.PP
-Placing a `!' after the word
-.B map
-causes the mapping to apply
-to input mode, rather than command mode.
-Thus, to arrange for \fB^T\fP to be the same as 4 spaces in input mode,
-you can type:
-.DS
-:map \fB^T\fP \fB^V\fP\o'b/'\o'b/'\o'b/'\o'b/'
-.DE
-where
-.B \o'b/'
-is a blank.
-The \fB^V\fP is necessary to prevent the blanks from being taken as
-white space between the
-.I lhs
-and
-.I rhs .
-.NH
-Word Abbreviations
-.PP
-A feature similar to macros in input mode is word abbreviation.
-This allows you to type a short word and have it expanded into
-a longer word or words.
-The commands are
-.B :abbreviate
-and
-.B :unabbreviate
-(\fB:ab\fP
-and
-.B :una )
-and have the same syntax as
-.B :map .
-For example:
-.DS
-:ab eecs Electrical Engineering and Computer Sciences
-.DE
-causes the word `eecs' to always be changed into the
-phrase `Electrical Engineering and Computer Sciences'.
-Word abbreviation is different from macros in that
-only whole words are affected.
-If `eecs' were typed as part of a larger word, it would
-be left alone.
-Also, the partial word is echoed as it is typed.
-There is no need for an abbreviation to be a single keystroke,
-as it should be with a macro.
-.NH 2
-Abbreviations
-.PP
-The editor has a number of short
-commands which abbreviate longer commands which we
-have introduced here. You can find these commands easily
-on the quick reference card.
-They often save a bit of typing and you can learn them as convenient.
-.NH 1
-Nitty-gritty details
-.NH 2
-Line representation in the display
-.PP
-The editor folds long logical lines onto many physical lines in the display.
-Commands which advance lines advance logical lines and will skip
-over all the segments of a line in one motion. The command \fB|\fR moves
-the cursor to a specific column, and may be useful for getting near the
-middle of a long line to split it in half. Try \fB80|\fR on a line which
-is more than 80 columns long.\*(dg
-.FS
-\*(dg You can make long lines very easily by using \fBJ\fR to join together
-short lines.
-.FE
-.PP
-The editor only puts full lines on the display; if there is not enough
-room on the display to fit a logical line, the editor leaves the physical
-line empty, placing only an @ on the line as a place holder. When you
-delete lines on a dumb terminal, the editor will often just clear the
-lines to @ to save time (rather than rewriting the rest of the screen.)
-You can always maximize the information on the screen by giving the \fB^R\fR
-command.
-.PP
-If you wish, you can have the editor place line numbers before each line
-on the display. Give the command \fB:se nu\fR\s-2CR\s0 to enable
-this, and the command \fB:se nonu\fR\s-2CR\s0 to turn it off.
-You can have tabs represented as \fB^I\fR and the ends of lines indicated
-with `$' by giving the command \fB:se list\fR\s-2CR\s0;
-\fB:se nolist\fR\s-2CR\s0 turns this off.
-.PP
-Finally, lines consisting of only the character `~' are displayed when
-the last line in the file is in the middle of the screen. These represent
-physical lines which are past the logical end of file.
-.NH 2
-Counts
-.PP
-Most
-.I vi
-commands will use a preceding count to affect their behavior in some way.
-The following table gives the common ways in which the counts are used:
-.DS
-.TS
-l lb.
-new window size : / ? [[ ]] \` \'
-scroll amount ^D ^U
-line/column number z G |
-repeat effect \fRmost of the rest\fP
-.TE
-.DE
-.PP
-The editor maintains a notion of the current default window size.
-On terminals which run at speeds greater than 1200 baud
-the editor uses the full terminal screen.
-On terminals which are slower than 1200 baud
-(most dialup lines are in this group)
-the editor uses 8 lines as the default window size.
-At 1200 baud the default is 16 lines.
-.PP
-This size is the size used when the editor clears and refills the screen
-after a search or other motion moves far from the edge of the current window.
-The commands which take a new window size as count all often cause the
-screen to be redrawn. If you anticipate this, but do not need as large
-a window as you are currently using, you may wish to change the screen
-size by specifying the new size before these commands.
-In any case, the number of lines used on the screen will expand if you
-move off the top with a \fB\-\fR or similar command or off the bottom
-with a command such as \s-2RETURN\s0 or \fB^D\fR.
-The window will revert to the last specified size the next time it is
-cleared and refilled.\*(dg
-.FS
-\*(dg But not by a \fB^L\fR which just redraws the screen as it is.
-.FE
-.PP
-The scroll commands \fB^D\fR and \fB^U\fR likewise remember the amount
-of scroll last specified, using half the basic window size initially.
-The simple insert commands use a count to specify a repetition of the
-inserted text. Thus \fB10a+\-\-\-\-\fR\s-2ESC\s0 will insert a grid-like
-string of text.
-A few commands also use a preceding count as a line or column number.
-.PP
-Except for a few commands which ignore any counts (such as \fB^R\fR),
-the rest of the editor commands use a count to indicate a simple repetition
-of their effect. Thus \fB5w\fR advances five words on the current line,
-while \fB5\fR\s-2RETURN\s0 advances five lines. A very useful instance
-of a count as a repetition is a count given to the \fB.\fR command, which
-repeats the last changing command. If you do \fBdw\fR and then \fB3.\fR,
-you will delete first one and then three words. You can then delete
-two more words with \fB2.\fR.
-.NH 2
-More file manipulation commands
-.PP
-The following table lists the file manipulation commands which you can
-use when you are in
-.I vi.
-.KF
-.DS
-.TS
-lb l.
-:w write back changes
-:wq write and quit
-:x write (if necessary) and quit (same as ZZ).
-:e \fIname\fP edit file \fIname\fR
-:e! reedit, discarding changes
-:e + \fIname\fP edit, starting at end
-:e +\fIn\fP edit, starting at line \fIn\fP
-:e # edit alternate file
-:w \fIname\fP write file \fIname\fP
-:w! \fIname\fP overwrite file \fIname\fP
-:\fIx,y\fPw \fIname\fP write lines \fIx\fP through \fIy\fP to \fIname\fP
-:r \fIname\fP read file \fIname\fP into buffer
-:r !\fIcmd\fP read output of \fIcmd\fP into buffer
-:n edit next file in argument list
-:n! edit next file, discarding changes to current
-:n \fIargs\fP specify new argument list
-:ta \fItag\fP edit file containing tag \fItag\fP, at \fItag\fP
-.TE
-.DE
-.KE
-All of these commands are followed by a \s-2CR\s0 or \s-2ESC\s0.
-The most basic commands are \fB:w\fR and \fB:e\fR.
-A normal editing session on a single file will end with a \fBZZ\fR command.
-If you are editing for a long period of time you can give \fB:w\fR commands
-occasionally after major amounts of editing, and then finish
-with a \fBZZ\fR. When you edit more than one file, you can finish
-with one with a \fB:w\fR and start editing a new file by giving a \fB:e\fR
-command,
-or set
-.I autowrite
-and use \fB:n\fP <file>.
-.PP
-If you make changes to the editor's copy of a file, but do not wish to
-write them back, then you must give an \fB!\fR after the command you
-would otherwise use; this forces the editor to discard any changes
-you have made. Use this carefully.
-.PP
-The \fB:e\fR command can be given a \fB+\fR argument to start at the
-end of the file, or a \fB+\fR\fIn\fR argument to start at line \fIn\fR\^.
-In actuality, \fIn\fR may be any editor command not containing a space,
-usefully a scan like \fB+/\fIpat\fR or \fB+?\fIpat\fR.
-In forming new names to the \fBe\fR command, you can use the character
-\fB%\fR which is replaced by the current file name, or the character
-\fB#\fR which is replaced by the alternate file name.
-The alternate file name is generally the last name you typed other than
-the current file. Thus if you try to do a \fB:e\fR and get a diagnostic
-that you haven't written the file, you can give a \fB:w\fR command and
-then a \fB:e #\fR command to redo the previous \fB:e\fR.
-.PP
-You can write part of the buffer to a file by finding out the lines
-that bound the range to be written using \fB^G\fR, and giving these
-numbers after the \fB:\fR
-and before the \fBw\fP, separated by \fB,\fR's.
-You can also mark these lines with \fBm\fR and
-then use an address of the form \fB\(aa\fR\fIx\fR\fB,\fB\(aa\fR\fIy\fR
-on the \fBw\fR command here.
-.PP
-You can read another file into the buffer after the current line by using
-the \fB:r\fR command.
-You can similarly read in the output from a command, just use \fB!\fR\fIcmd\fR
-instead of a file name.
-.PP
-If you wish to edit a set of files in succession, you can give all the
-names on the command line, and then edit each one in turn using the command
-\fB:n\fR. It is also possible to respecify the list of files to be edited
-by giving the \fB:n\fR command a list of file names, or a pattern to
-be expanded as you would have given it on the initial
-.I vi
-command.
-.PP
-If you are editing large programs, you will find the \fB:ta\fR command
-very useful. It utilizes a data base of function names and their locations,
-which can be created by programs such as
-.I ctags,
-to quickly find a function whose name you give.
-If the \fB:ta\fR command will require the editor to switch files, then
-you must \fB:w\fR or abandon any changes before switching. You can repeat
-the \fB:ta\fR command without any arguments to look for the same tag
-again.
-.NH 2
-More about searching for strings
-.PP
-When you are searching for strings in the file with \fB/\fR and \fB?\fR,
-the editor normally places you at the next or previous occurrence
-of the string. If you are using an operator such as \fBd\fR,
-\fBc\fR or \fBy\fR, then you may well wish to affect lines up to the
-line before the line containing the pattern. You can give a search of
-the form \fB/\fR\fIpat\fR\fB/\-\fR\fIn\fR to refer to the \fIn\fR'th line
-before the next line containing \fIpat\fR, or you can use \fB\+\fR instead
-of \fB\-\fR to refer to the lines after the one containing \fIpat\fR.
-If you don't give a line offset, then the editor will affect characters
-up to the match place, rather than whole lines; thus use ``+0'' to affect
-to the line which matches.
-.PP
-You can have the editor ignore the case of words in the searches it does
-by giving the command \fB:se ic\fR\s-2CR\s0.
-The command \fB:se noic\fR\s-2CR\s0 turns this off.
-.PP
-Strings given to searches may actually be regular expressions.
-If you do not want or need this facility, you should
-.DS
-set nomagic
-.DE
-in your EXINIT.
-In this case,
-only the characters \fB\(ua\fR and \fB$\fR are special in patterns.
-The character \fB\e\fR is also then special (as it is most everywhere in
-the system), and may be used to get at the
-an extended pattern matching facility.
-It is also necessary to use a \e before a
-\fB/\fR in a forward scan or a \fB?\fR in a backward scan, in any case.
-The following table gives the extended forms when \fBmagic\fR is set.
-.DS
-.TS
-bl l.
-\(ua at beginning of pattern, matches beginning of line
-$ at end of pattern, matches end of line
-\fB\&.\fR matches any character
-\e< matches the beginning of a word
-\e> matches the end of a word
-[\fIstr\fP] matches any single character in \fIstr\fP
-[\(ua\fIstr\fP] matches any single character not in \fIstr\fP
-[\fIx\fP\-\fIy\fP] matches any character between \fIx\fP and \fIy\fP
-* matches any number of the preceding pattern
-.TE
-.DE
-If you use \fBnomagic\fR mode, then
-the \fB. [\fR and \fB*\fR primitives are given with a preceding
-\e.
-.NH 2
-More about input mode
-.PP
-There are a number of characters which you can use to make corrections
-during input mode. These are summarized in the following table.
-.DS
-.TS
-lb l.
-^H deletes the last input character
-^W deletes the last input word, defined as by \fBb\fR
-erase your erase character, same as \fB^H\fP
-kill your kill character, deletes the input on this line
-\e escapes a following \fB^H\fP and your erase and kill
-\s-2ESC\s0 ends an insertion
-\s-2DEL\s0 interrupts an insertion, terminating it abnormally
-\s-2CR\s0 starts a new line
-^D backtabs over \fIautoindent\fP
-0^D kills all the \fIautoindent\fP
-\(ua^D same as \fB0^D\fP, but restores indent next line
-^V quotes the next non-printing character into the file
-.TE
-.DE
-.PP
-The most usual way of making corrections to input is by typing \fB^H\fR
-to correct a single character, or by typing one or more \fB^W\fR's to
-back over incorrect words. If you use \fB#\fR as your erase character
-in the normal system, it will work like \fB^H\fR.
-.PP
-Your system kill character, normally \fB@\fR, \fB^X\fP or \fB^U\fR,
-will erase all
-the input you have given on the current line.
-In general, you can neither
-erase input back around a line boundary nor can you erase characters
-which you did not insert with this insertion command. To make corrections
-on the previous line after a new line has been started you can hit \s-2ESC\s0
-to end the insertion, move over and make the correction, and then return
-to where you were to continue. The command \fBA\fR which appends at the
-end of the current line is often useful for continuing.
-.PP
-If you wish to type in your erase or kill character (say # or @) then
-you must precede it with a \fB\e\fR, just as you would do at the normal
-system command level. A more general way of typing non-printing characters
-into the file is to precede them with a \fB^V\fR. The \fB^V\fR echoes
-as a \fB\(ua\fR character on which the cursor rests. This indicates that
-the editor expects you to type a control character. In fact you may
-type any character and it will be inserted into the file at that point.*
-.FS
-* This is not quite true. The implementation of the editor does
-not allow the \s-2NULL\s0 (\fB^@\fR) character to appear in files. Also
-the \s-2LF\s0 (linefeed or \fB^J\fR) character is used by the editor
-to separate lines in the file, so it cannot appear in the middle of a
-line. You can insert any other character, however, if you wait for the
-editor to echo the \fB\(ua\fR before you type the character. In fact,
-the editor will treat a following letter as a request for the corresponding
-control character. This is the only way to type \fB^S\fR or \fB^Q\fP,
-since the system normally uses them to suspend and resume output
-and never gives them to the editor to process.
-.FE
-.PP
-If you are using \fIautoindent\fR you can backtab over the indent which
-it supplies by typing a \fB^D\fR. This backs up to a \fIshiftwidth\fR
-boundary.
-This only works immediately after the supplied \fIautoindent\fR.
-.PP
-When you are using \fIautoindent\fR you may wish to place a label at
-the left margin of a line. The way to do this easily is to type \fB\(ua\fR
-and then \fB^D\fR. The editor will move the cursor to the left margin
-for one line, and restore the previous indent on the next. You can also
-type a \fB0\fR followed immediately by a \fB^D\fR if you wish to kill
-all the indent and not have it come back on the next line.
-.NH 2
-Upper case only terminals
-.PP
-If your terminal has only upper case, you can still use
-.I vi
-by using the normal
-system convention for typing on such a terminal.
-Characters which you normally type are converted to lower case, and you
-can type upper case letters by preceding them with a \e.
-The characters { ~ } | \(ga are not available on such terminals, but you
-can escape them as \e( \e\(ua \e) \e! \e\(aa.
-These characters are represented on the display in the same way they
-are typed.\*(dd
-.FS
-\*(dd The \e character you give will not echo until you type another
-key.
-.FE
-.NH 2
-Vi and ex
-.PP
-.I Vi
-is actually one mode of editing within the editor
-.I ex.
-When you are running
-.I vi
-you can escape to the line oriented editor of
-.I ex
-by giving the command
-\fBQ\fR.
-All of the
-.B :
-commands which were introduced above are available in
-.I ex.
-Likewise, most
-.I ex
-commands can be invoked from
-.I vi
-using :.
-Just give them without the \fB:\fR and follow them with a \s-2CR\s0.
-.PP
-In rare instances, an internal error may occur in
-.I vi.
-In this case you will get a diagnostic and be left in the command mode of
-.I ex.
-You can then save your work and quit if you wish by giving a command
-\fBx\fR after the \fB:\fR which \fIex\fR prompts you with, or you can
-reenter \fIvi\fR by giving
-.I ex
-a
-.I vi
-command.
-.PP
-There are a number of things which you can do more easily in
-.I ex
-than in
-.I vi.
-Systematic changes in line oriented material are particularly easy.
-You can read the advanced editing documents for the editor
-.I ed
-to find out a lot more about this style of editing.
-Experienced
-users often mix their use of
-.I ex
-command mode and
-.I vi
-command mode to speed the work they are doing.
-.NH 2
-Open mode: vi on hardcopy terminals and ``glass tty's''
-\(dd
-.PP
-If you are on a hardcopy terminal or a terminal which does not have a cursor
-which can move off the bottom line, you can still use the command set of
-.I vi,
-but in a different mode.
-When you give a
-.I vi
-command, the editor will tell you that it is using
-.I open
-mode.
-This name comes from the
-.I open
-command in
-.I ex,
-which is used to get into the same mode.
-.PP
-The only difference between
-.I visual
-mode
-and
-.I open
-mode is the way in which the text is displayed.
-.PP
-In
-.I open
-mode the editor uses a single line window into the file, and moving backward
-and forward in the file causes new lines to be displayed, always below the
-current line.
-Two commands of
-.I vi
-work differently in
-.I open:
-.B z
-and
-\fB^R\fR.
-The
-.B z
-command does not take parameters, but rather draws a window of context around
-the current line and then returns you to the current line.
-.PP
-If you are on a hardcopy terminal,
-the
-.B ^R
-command will retype the current line.
-On such terminals, the editor normally uses two lines to represent the
-current line.
-The first line is a copy of the line as you started to edit it, and you work
-on the line below this line.
-When you delete characters, the editor types a number of \e's to show
-you the characters which are deleted. The editor also reprints the current
-line soon after such changes so that you can see what the line looks
-like again.
-.PP
-It is sometimes useful to use this mode on very slow terminals which
-can support
-.I vi
-in the full screen mode.
-You can do this by entering
-.I ex
-and using an
-.I open
-command.
-.LP
-.SH
-Acknowledgements
-.PP
-Bruce Englar encouraged the early development of this display editor.
-Peter Kessler helped bring sanity to version 2's command layout.
-Bill Joy wrote versions 1 and 2.0 through 2.7,
-and created the framework that users see in the present editor.
-Mark Horton added macros and other features and made the
-editor work on a large number of terminals and Unix systems.
diff --git a/usr.bin/vi/USD.doc/vitut/vi.summary b/usr.bin/vi/USD.doc/vitut/vi.summary
deleted file mode 100644
index a7d99384dc8..00000000000
--- a/usr.bin/vi/USD.doc/vitut/vi.summary
+++ /dev/null
@@ -1,468 +0,0 @@
-.\" Copyright (c) 1980, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)vi.summary 8.1 (Berkeley) 6/8/93
-.\"
-.ds CH
-.ds CF
-.de TS
-.br
-.if !\\n(1T .RT
-.ul 0
-.ti \\n(.iu
-.if t .sp 0.25
-.if n .sp
-.if \\$1H .TQ
-.nr IX 1
-..
-.nr PS 9
-.ps 9
-.nr VS 11
-.vs 11
-.nr HM .50i
-.nr FM .25i
-.nr PO 0
-.po 0
-.nr LL 3.5i
-.ll 3.5i
-.de nc
-.bp
-..
-.de h
-.LG
-.B
-\\$1
-.R
-.NL
-..
-.LG
-.LG
-.B
-.ce
-Ex Quick Reference
-.R
-.NL
-.LP
-.LP
-.h "Entering/leaving ex"
-.TS
-aw(1.4i)b aw(1.8i).
-% ex \fIname\fP edit \fIname\fP, start at end
-% ex +\fIn\fP \fIname\fP ... at line \fIn\fP
-% ex \-t \fItag\fP start at \fItag\fP
-% ex \-r list saved files
-% ex \-r \fIname\fP recover file \fIname\fP
-% ex \fIname\fP ... edit first; rest via \fB:n\fP
-% ex \-R \fIname\fP read only mode
-: x exit, saving changes
-: q! exit, discarding changes
-.TE
-.h "Ex states"
-.TS
-lw(1i) lw(2.0i).
-Command T{
-Normal and initial state. Input prompted for by \fB:\fP.
-Your kill character cancels partial command.
-T}
-Insert T{
-Entered by \fBa\fP \fBi\fP and \fBc\fP.
-Arbitrary text then terminates with line having only \fB.\fP
-character on it or abnormally with interrupt.
-T}
-Open/visual T{
-Entered by \fBopen\fP or \fBvi\fP, terminates with \fBQ\fP
-or ^\e.
-T}
-.TE
-.h "Ex commands"
-.TS
-lw(.45i) lw(.08i)b lw(.45i) lw(.08i)b lw(.45i) lw(.08i)b.
-abbrev ab next n unabbrev una
-append a number nu undo u
-args ar open o unmap unm
-change c preserve pre version ve
-copy co print p visual vi
-delete d put pu write w
-edit e quit q xit x
-file f read re yank ya
-global g recover rec \fIwindow\fP z
-insert i rewind rew \fIescape\fP !
-join j set se \fIlshift\fP <
-list l shell sh \fIprint next\fP \fRCR\fP
-map source so \fIresubst\fP &
-mark ma stop st \fIrshift\fP >
-move m substitute s \fIscroll\fP ^D
-.TE
-.h "Ex command addresses"
-.TS
-lw(.3i)b lw(0.8i) lw(.3i)b lw(0.8i).
-\fIn\fP line \fIn\fP /\fIpat\fP next with \fIpat\fP
-\&. current ?\fIpat\fP previous with \fIpat\fP
-$ last \fIx\fP-\fIn\fP \fIn\fP before \fIx\fP
-+ next \fIx\fP,\fIy\fP \fIx\fP through \fIy\fP
-\- previous \(aa\fIx\fP marked with \fIx\fP
-+\fIn\fP \fIn\fP forward \(aa\(aa previous context
-% 1,$
-.TE
-.nc
-.h "Specifying terminal type"
-.TS
-aw(1.7i)b aw(1.5i).
-% setenv TERM \fItype\fP \fIcsh\fP and all version 6
-$ TERM=\fItype\fP; export TERM \fIsh\fP in Version 7
-See also \fItset\fR(1)
-.TE
-.h "Some terminal types"
-.TS
-lw(.4i) lw(.4i) lw(.4i) lw(.4i) lw(.4i).
-2621 43 adm31 dw1 h19
-2645 733 adm3a dw2 i100
-300s 745 c100 gt40 mime
-33 act4 dm1520 gt42 owl
-37 act5 dm2500 h1500 t1061
-4014 adm3 dm3025 h1510 vt52
-.TE
-.h "Initializing options"
-.TS
-lw(.9i)b aw(1.5i).
-EXINIT place \fBset\fP's here in environment var.
-set \fIx\fP enable option
-set no\fIx\fP disable option
-set \fIx\fP=\fIval\fP give value \fIval\fP
-set show changed options
-set all show all options
-set \fIx\fP? show value of option \fIx\fP
-.TE
-.h "Useful options"
-.TS
-lw(.9i)b lw(.3i) lw(1.0i).
-autoindent ai supply indent
-autowrite aw write before changing files
-ignorecase ic in scanning
-lisp \fB( ) { }\fP are s-exp's
-list print ^I for tab, $ at end
-magic \fB. [ *\fP special in patterns
-number nu number lines
-paragraphs para macro names which start ...
-redraw simulate smart terminal
-scroll command mode lines
-sections sect macro names ...
-shiftwidth sw for \fB< >\fP, and input \fB^D\fP
-showmatch sm to \fB)\fP and \fB}\fP as typed
-slowopen slow choke updates during insert
-window visual mode lines
-wrapscan ws around end of buffer?
-wrapmargin wm automatic line splitting
-.TE
-.LP
-.h "Scanning pattern formation"
-.TS
-aw(.9i)b aw(1.0i).
-\(ua beginning of line
-$ end of line
-\fB.\fR any character
-\e< beginning of word
-\e> end of word
-[\fIstr\fP] any char in \fIstr\fP
-[\(ua\fIstr\fP] ... not in \fIstr\fP
-[\fIx\-y\fP] ... between \fIx\fP and \fIy\fP
-* any number of preceding
-.TE
-.nc
-.LP
-.LG
-.LG
-.B
-.ce
-Vi Quick Reference
-.NL
-.R
-.LP
-.LP
-.h "Entering/leaving vi"
-.TS
-aw(1.4i)b aw(1.8i).
-% vi \fIname\fP edit \fIname\fP at top
-% vi +\fIn\fP \fIname\fP ... at line \fIn\fP
-% vi + \fIname\fP ... at end
-% vi \-r list saved files
-% vi \-r \fIname\fP recover file \fIname\fP
-% vi \fIname\fP ... edit first; rest via \fB:n\fP
-% vi \-t \fItag\fP start at \fItag\fP
-% vi +/\fIpat\fP \fIname\fP search for \fIpat\fP
-% view \fIname\fP read only mode
-ZZ exit from vi, saving changes
-^Z stop vi for later resumption
-.TE
-.h "The display"
-.TS
-lw(.75i) lw(2.2i).
-Last line T{
-Error messages, echoing input to \fB: / ?\fP and \fB!\fR,
-feedback about i/o and large changes.
-T}
-@ lines On screen only, not in file.
-~ lines Lines past end of file.
-^\fIx\fP Control characters, ^? is delete.
-tabs Expand to spaces, cursor at last.
-.TE
-.LP
-.h "Vi states"
-.TS
-lw(.75i) lw(2.2i).
-Command T{
-Normal and initial state. Others return here.
-ESC (escape) cancels partial command.
-T}
-Insert T{
-Entered by \fBa i A I o O c C s S\fP \fBR\fP.
-Arbitrary text then terminates with ESC character,
-or abnormally with interrupt.
-T}
-Last line T{
-Reading input for \fB: / ?\fP or \fB!\fP; terminate
-with ESC or CR to execute, interrupt to cancel.
-T}
-.TE
-.h "Counts before vi commands"
-.TS
-lw(1.5i) lw(1.7i)b.
-line/column number z G |
-scroll amount ^D ^U
-replicate insert a i A I
-repeat effect \fRmost rest\fP
-.TE
-.h "Simple commands"
-.TS
-lw(1.5i)b lw(1.7i).
-dw delete a word
-de ... leaving punctuation
-dd delete a line
-3dd ... 3 lines
-i\fItext\fP\fRESC\fP insert text \fIabc\fP
-cw\fInew\fP\fRESC\fP change word to \fInew\fP
-ea\fIs\fP\fRESC\fP pluralize word
-xp transpose characters
-.TE
-.nc
-.h "Interrupting, cancelling"
-.TS
-aw(0.75i)b aw(1.6i).
-ESC end insert or incomplete cmd
-^? (delete or rubout) interrupts
-^L reprint screen if \fB^?\fR scrambles it
-.TE
-.h "File manipulation"
-.TS
-aw(0.75i)b aw(1.6i).
-:w write back changes
-:wq write and quit
-:q quit
-:q! quit, discard changes
-:e \fIname\fP edit file \fIname\fP
-:e! reedit, discard changes
-:e + \fIname\fP edit, starting at end
-:e +\fIn\fR edit starting at line \fIn\fR
-:e # edit alternate file
-^\(ua synonym for \fB:e #\fP
-:w \fIname\fP write file \fIname\fP
-:w! \fIname\fP overwrite file \fIname\fP
-:sh run shell, then return
-:!\fIcmd\fP run \fIcmd\fR, then return
-:n edit next file in arglist
-:n \fIargs\fP specify new arglist
-:f show current file and line
-^G synonym for \fB:f\fP
-:ta \fItag\fP to tag file entry \fItag\fP
-^] \fB:ta\fP, following word is \fItag\fP
-.TE
-.h "Positioning within file"
-.TS
-aw(0.75i)b aw(1.6i).
-^F forward screenfull
-^B backward screenfull
-^D scroll down half screen
-^U scroll up half screen
-G goto line (end default)
-/\fIpat\fR next line matching \fIpat\fR
-?\fIpat\fR prev line matching \fIpat\fR
-n repeat last \fB/\fR or \fB?\fR
-N reverse last \fB/\fR or \fB?\fR
-/\fIpat\fP/+\fIn\fP n'th line after \fIpat\fR
-?\fIpat\fP?\-\fIn\fP n'th line before \fIpat\fR
-]] next section/function
-[[ previous section/function
-% find matching \fB( ) {\fP or \fB}\fP
-.TE
-.h "Adjusting the screen"
-.TS
-aw(0.75i)b aw(1.6i).
-^L clear and redraw
-^R retype, eliminate @ lines
-z\fRCR\fP redraw, current at window top
-z\- ... at bottom
-z\|. ... at center
-/\fIpat\fP/z\- \fIpat\fP line at bottom
-z\fIn\fP\|. use \fIn\fP line window
-^E scroll window down 1 line
-^Y scroll window up 1 line
-.TE
-.nc
-.h "Marking and returning
-.TS
-aw(0.5i)b aw(2.0i).
-\(ga\(ga previous context
-\(aa\(aa ... at first non-white in line
-m\fIx\fP mark position with letter \fIx\fP
-\(ga\fIx\fP to mark \fIx\fP
-\(aa\fIx\fP ... at first non-white in line
-.TE
-.h "Line positioning"
-.TS
-aw(0.5i)b aw(2.0i).
-H home window line
-L last window line
-M middle window line
-+ next line, at first non-white
-\- previous line, at first non-white
-\fRCR\fP return, same as +
-\(da \fRor\fP j next line, same column
-\(ua \fRor\fP k previous line, same column
-.TE
-.h "Character positioning"
-.TS
-aw(0.5i)b aw(2.0i).
-\(ua first non white
-0 beginning of line
-$ end of line
-h \fRor\fP \(-> forward
-l \fRor\fP \(<- backwards
-^H same as \fB\(<-\fP
-\fRspace\fP same as \fB\(->\fP
-f\fIx\fP find \fIx\fP forward
-F\fIx\fP \fBf\fR backward
-t\fIx\fP upto \fIx\fP forward
-T\fIx\fP back upto \fIx\fP
-; repeat last \fBf F t\fP or \fBT\fP
-, inverse of \fB;\fP
-| to specified column
-% find matching \fB( { )\fP or \fB}\fR
-.TE
-.h "Words, sentences, paragraphs"
-.TS
-aw(0.5i)b aw(2.0i).
-w word forward
-b back word
-e end of word
-) to next sentence
-} to next paragraph
-( back sentence
-{ back paragraph
-W blank delimited word
-B back \fBW\fP
-E to end of \fBW\fP
-.TE
-.h "Commands for \s-2LISP\s0"
-.TS
-aw(0.5i)b aw(2.0i).
-) Forward s-expression
-} ... but don't stop at atoms
-( Back s-expression
-{ ... but don't stop at atoms
-.TE
-.nc
-.h "Corrections during insert"
-.TS
-aw(.5i)b aw(2.0i).
-^H erase last character
-^W erases last word
-\fRerase\fP your erase, same as \fB^H\fP
-\fRkill\fP your kill, erase input this line
-\e escapes \fB^H\fR, your erase and kill
-\fRESC\fP ends insertion, back to command
-^? interrupt, terminates insert
-^D backtab over \fIautoindent\fP
-\(ua^D kill \fIautoindent\fP, save for next
-0^D ... but at margin next also
-^V quote non-printing character
-.TE
-.h "Insert and replace"
-.TS
-aw(.5i)b aw(2.0i).
-a append after cursor
-i insert before
-A append at end of line
-I insert before first non-blank
-o open line below
-O open above
-r\fIx\fP replace single char with \fIx\fP
-R replace characters
-.TE
-.h "Operators (double to affect lines)"
-.TS
-aw(0.5i)b aw(2.0i).
-d delete
-c change
-< left shift
-> right shift
-! filter through command
-\&\= indent for \s-2LISP\s0
-y yank lines to buffer
-.TE
-.h "Miscellaneous operations"
-.TS
-aw(0.5i)b aw(2.0i).
-C change rest of line
-D delete rest of line
-s substitute chars
-S substitute lines
-J join lines
-x delete characters
-X ... before cursor
-Y yank lines
-.TE
-.h "Yank and put"
-.TS
-aw(0.5i)b aw(2.0i).
-p put back lines
-P put before
-"\fIx\fPp put from buffer \fIx\fP
-"\fIx\fPy yank to buffer \fIx\fP
-"\fIx\fPd delete into buffer \fIx\fP
-.TE
-.h "Undo, redo, retrieve"
-.TS
-aw(0.5i)b aw(2.0i).
-u undo last change
-U restore current line
-\fB.\fP repeat last change
-"\fId\fP\|p retrieve \fId\fP'th last delete
-.TE