BSD 4_4_Lite2 release
[unix-history] / usr / src / usr.bin / ex / USD.doc / vitut / vi.in
index 0ed9a0e..65535eb 100644 (file)
@@ -1,35 +1,49 @@
-.\" Copyright (c) 1980 Regents of the University of California.
-.\" All rights reserved.  The Berkeley software License Agreement
-.\" specifies the terms and conditions for redistribution.
+.\" Copyright (c) 1980, 1993
+.\"    The Regents of the University of California.  All rights reserved.
 .\"
 .\"
-.\"    @(#)vi.in       4.1 (Berkeley) %G%
+.\" 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.3 (Berkeley) 5/23/94
+.\"
+.EH 'USD:11-%''An Introduction to Display Editing with Vi'
+.OH 'An Introduction to Display Editing with Vi''USD:11-%'
 .bd S 3
 .if t .ds dg \(dg
 .if n .ds dg +
 .if t .ds dd \(dd
 .if n .ds dd ++
 .bd S 3
 .if t .ds dg \(dg
 .if n .ds dg +
 .if t .ds dd \(dd
 .if n .ds dd ++
-.de v2
-\*(dd
-.FS
-\*(dd
-Not available in all v2 editors due to memory constraints.
-.FE
-..
-.de v3
-\*(dd\*(dd
-.FS
-\*(dd\*(dd
-Version 3 only.
-.FE
-..
-.RP
+.\".RP
 .TL
 An Introduction to Display Editing with Vi
 .AU
 William Joy
 .TL
 An Introduction to Display Editing with Vi
 .AU
 William Joy
-.sp
-\fI\s-2Revised for versions 3.5/2.13 by\s0\fP
+.AU
 Mark Horton
 .AI
 Computer Science Division
 Mark Horton
 .AI
 Computer Science Division
@@ -161,11 +175,12 @@ the type of your terminal:
 .DS
 % \fBsetenv TERM\fP 2621
 .DE
 .DS
 % \fBsetenv TERM\fP 2621
 .DE
-This command works with the shell
+This command works with the
 .I csh
 .I csh
-on both version 6 and 7 systems.
-If you are using the standard version 7 shell then you should give
-the commands
+shell.
+If you are using the standard Bourne shell
+.I sh
+then you should give the commands
 .DS
 $ \fBTERM=\fP2621
 $ \fBexport TERM\fP
 .DS
 $ \fBTERM=\fP2621
 $ \fBexport TERM\fP
@@ -366,15 +381,12 @@ with a line which is farther back in the file at the top.
 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.
 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.
-.v3
 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
 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
-.v2
-move forward and backward a page, keeping
-a couple of lines of continuity
-between screens
+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
 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
@@ -464,7 +476,6 @@ 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 your terminal has arrow keys (4 or 5 keys with arrows
 going in each direction) try them and convince yourself
 that they work.
-(On certain terminals using v2 editors, they won't.)
 If you don't have working arrow keys, you can always use
 .B h ,
 .B j ,
 If you don't have working arrow keys, you can always use
 .B h ,
 .B j ,
@@ -539,14 +550,14 @@ 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
 \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 (v3)
+^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
 ^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 (v3)
+^Y     exposes another line at the top
 +      next line, at the beginning
 \-     previous line, at the beginning
 /      scan for a following string forwards
 +      next line, at the beginning
 \-     previous line, at the beginning
 /      scan for a following string forwards
@@ -564,7 +575,6 @@ w   word after this word
 .TE
 .NH 2
 View
 .TE
 .NH 2
 View
-.v2
 .PP
 If you want to use the editor to look at a file,
 rather than to make changes,
 .PP
 If you want to use the editor to look at a file,
 rather than to make changes,
@@ -576,6 +586,7 @@ This will set the
 .I readonly
 option which will prevent you from
 accidently overwriting the file.
 .I readonly
 option which will prevent you from
 accidently overwriting the file.
+.sp
 .NH 1
 Making simple changes
 .NH 2
 .NH 1
 Making simple changes
 .NH 2
@@ -654,6 +665,7 @@ 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.
 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.
+.sp .5
 .NH 2
 Making small corrections
 .PP
 .NH 2
 Making small corrections
 .PP
@@ -710,6 +722,7 @@ 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.
 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.
+.sp .5
 .NH 2
 Operating on lines
 .PP
 .NH 2
 Operating on lines
 .PP
@@ -990,6 +1003,7 @@ 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
 P      put text back, before cursor or above current line
 T\fIx\fR       t backward in line
 .TE
+.ne 1i
 .NH 1
 High level commands
 .NH 2
 .NH 1
 High level commands
 .NH 2
@@ -1088,7 +1102,6 @@ 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.
 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.
-(\fBz.\fP, \fBz-\fP, and \fBz+\fP are not available on all v2 editors.)
 .NH 1
 Special topics
 .NH 2
 .NH 1
 Special topics
 .NH 2
@@ -1158,6 +1171,18 @@ 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.
 .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.
+.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
 .KF
 .TS
 lb lb lb lb
 .KF
 .TS
 lb lb lb lb
@@ -1180,18 +1205,6 @@ slowopen slow    Postpone display updates during inserts
 term   dumb    The kind of terminal you are using.
 .TE
 .KE
 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
 These statements can be placed in your EXINIT in your environment,
 or given while you are running
 .I vi
@@ -1220,7 +1233,7 @@ are \fIex\fP commands.
 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
 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 (on v3 editors).
+\fBmap\fP commands.
 Since it is advisable to get these commands on one line, they can
 be separated with the | character, for example:
 .DS
 Since it is advisable to get these commands on one line, they can
 be separated with the | character, for example:
 .DS
@@ -1236,29 +1249,23 @@ makes @ delete a line,
 and makes # delete a character,
 (the second
 .B map ).
 and makes # delete a character,
 (the second
 .B map ).
-(See section 6.9 for a description of the \fBmap\fP command,
-which only works in version 3.)
+(See section 6.9 for a description of the \fBmap\fP command)
 This string should be placed in the variable EXINIT in your environment.
 This string should be placed in the variable EXINIT in your environment.
-If you use \fIcsh\fP, put this line in the file
+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
 .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 v7 shell, put these lines in the file
+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
 .I .profile
 in your home directory:
 .DS
 EXINIT=\(aa\fBset\fP ai aw terse|\fBmap\fP @ dd|\fBmap\fP # x\(aa
 export EXINIT
 .DE
-On a version 6 system, the concept of environments is not present.
-In this case, put the line in the file
-.I .exrc
-in your home directory.
-.DS
-\fBset\fP ai aw terse|\fBmap\fP @ dd|\fBmap\fP # x
-.DE
 Of course, the particulars of the line would depend on which options
 you wanted to set.
 .NH 2
 Of course, the particulars of the line would depend on which options
 you wanted to set.
 .NH 2
@@ -1349,12 +1356,7 @@ 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
 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.*
-.FS
-* This feature is not available on some v2 editors.
-In v2 editors where it is available, the break can only occur to the
-right of the specified boundary instead of to the left.
-.FE
+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
 .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
@@ -1426,12 +1428,7 @@ 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
 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\*(dg
-.FS
-\*(dg
-The \s-2LISP\s0 features are not available on some v2 editors
-due to memory constraints.
-.FE
+Commands for editing \s-2LISP\s0
 .PP
 If you are editing a \s-2LISP\s0 program you should set the option
 .I lisp
 .PP
 If you are editing a \s-2LISP\s0 program you should set the option
 .I lisp
@@ -1472,11 +1469,7 @@ 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
 and retreat to lines beginning with a \fB(\fR, and are useful for dealing
 with entire function definitions.
 .NH 2
-Macros\*(dd
-.FS
-\*(dd
-The macro feature is available only in version 3 editors.
-.FE
+Macros
 .PP
 .I Vi
 has a parameterless macro facility, which lets you set it up so that
 .PP
 .I Vi
 has a parameterless macro facility, which lets you set it up so that
@@ -1600,7 +1593,6 @@ and
 .I rhs .
 .NH
 Word Abbreviations
 .I rhs .
 .NH
 Word Abbreviations
-.v3
 .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
 .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
@@ -1770,6 +1762,7 @@ 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.
 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.
+.ne 1i
 .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\^.
 .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\^.
@@ -1813,7 +1806,6 @@ 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.
 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.
-(The tag feature is not available in some v2 editors.)
 .NH 2
 More about searching for strings
 .PP
 .NH 2
 More about searching for strings
 .PP
@@ -1832,6 +1824,7 @@ to the line which matches.
 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.
 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.
+.ne 1i
 .PP
 Strings given to searches may actually be regular expressions.
 If you do not want or need this facility, you should
 .PP
 Strings given to searches may actually be regular expressions.
 If you do not want or need this facility, you should
@@ -1869,6 +1862,7 @@ 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.
 .PP
 There are a number of characters which you can use to make corrections
 during input mode.  These are summarized in the following table.
+.sp .5
 .DS
 .TS
 lb l.
 .DS
 .TS
 lb l.
@@ -1886,6 +1880,7 @@ kill      your kill character, deletes the input on this line
 ^V     quotes the next non-printing character into the file
 .TE
 .DE
 ^V     quotes the next non-printing character into the file
 .TE
 .DE
+.sp .5
 .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
 .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
@@ -1951,7 +1946,6 @@ are typed.\*(dd
 \*(dd The \e character you give will not echo until you type another
 key.
 .FE
 \*(dd The \e character you give will not echo until you type another
 key.
 .FE
-.v2
 .NH 2
 Vi and ex
 .PP
 .NH 2
 Vi and ex
 .PP