4.4BSD/usr/src/usr.bin/ex/vi.1

Compare this file to the similar file:
Show the results in this format:

.\" Copyright (c) 1980, 1991, 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.1	8.1 (Berkeley) 6/18/93
.\"
.Dd June 18, 1993
.Dt VI 1
.Os BSD 3
.Sh NAME
.Nm \&vi , view
.Nd screen oriented (visual) display editor based on ex
.Sh SYNOPSIS
.Nm \&vi
.Op Fl R
.Op Fl l
.Op Fl r
.Op Fl t Ar tag
.Op Fl w Ar n
.Op Cm \&+ Ns Ar command
.Ar name ...
.Sh DESCRIPTION
.Nm \&Vi
(visual) is a display oriented text editor based on
.Xr \&ex 1 .
.Xr \&Ex
and
.Nm \&vi
run the same code; it is possible to get to
the command mode of
.Xr \&ex
from within
.Nm \&vi
and vice-versa.
.Pp
.Nm View
is the same as
.Dq "vi -R" ,
e.g. run in read-only mode.
.Pp
Available options:
.Bl -tag -width xcommandx
.It Fl R
Read only. Changes to the file may not be written out.
.It Fl l
Sets options for editing
.Tn LISP
source (options
.Ic showmatch
and
.Ic lisp ) .
.It Fl r
In the event of an editor or system crash, the
.Fl r
option will retrieve the last saved version of the
specified file, or if no file is specified,
a list of saved files is printed.
.It Fl t Ar tag
If tags are used (see
.Xr ctags 1 )
the editor is postioned at
.Ar tag .
.It Fl w Ns Ar n
The default window size is set to
.Ar n .
.It Cm \&+ Ns Ar command
Enter the file with
.Ar command.
Useful for
positioning on a string or line number.
.El
.Pp
The
.%T "Vi Quick Reference"
card and the
.%T "Introduction to Display Editing with Vi"
provide full details on using
.Nm \&vi .
.Sh ENVIRONMENT
The
.Nm
command uses the following environment variables.
.Bl -tag -width Fl
.It Ev EXINIT
User specified startup values for
.Xr \&ex
and
.Nm \&vi .
Usually specified in the file
.Pa ~/.exrc
.It Ev HOME
Default directory to search for
the file
.Pa ~/.exrc
.It Ev SHELL
Shell used for
.Em escaped
commands (with the
.Xr \&ex
.Ic \&:!
command).
.It Ev TERM
Terminal type used to lookup terminal capabilities from the
file
.Pa /usr/share/misc/termcap .
.It Ev TERMCAP
If set, specifies an alternate termcap file.
.El
.Sh FILES
.Bl -tag -width /usr/libexec/ex?.?preserve -compact
.It Pa  /usr/libexec/ex?.?strings
error messages
.It Pa  /usr/libexec/ex?.?recover
recover command
.It Pa  /usr/libexec/ex?.?preserve
preserve command
.It Pa  /usr/share/misc/termcap
describes capabilities of terminals
.It Pa  ~/.exrc
editor startup file
.It Pa /tmp/Ex Ns Em nnnnn
editor temporary
.It Pa /tmp/Rx Ns Em nnnnn
named buffer temporary
.It Pa /var/preserve
preservation directory
.El
.Sh SEE ALSO
.Xr awk 1 ,
.Xr \&ed 1 ,
.Xr grep 1 ,
.Xr sed 1 ,
.Xr grep 1 ,
.Xr \&vi 1 ,
.Xr termcap 5 ,
.Xr environ 7
.Rs
.%T "Vi Quick Reference Card"
.Re
.Rs
.%T "An Introduction to Display Editing with Vi"
.Re
.Sh BUGS
Software tabs using
.Sy \&^T
work only immediately after the
.Ic autoindent .
.Pp
Left and right shifts on intelligent terminals don't make use of
insert and delete character operations in the terminal.
.Pp
The
.Ic wrapmargin
option can be fooled since it looks at output columns when blanks are typed.
If a long word passes through the margin and onto the next line without a 
break, then the line won't be broken.
.Pp
Insert/delete within a line can be slow if tabs are present on intelligent
terminals, since the terminals need help in doing this correctly.
.Pp
Saving text on deletes in the named buffers is somewhat inefficient.
.Pp
The
.Ic source
command does not work when executed as
.Ic :source ;
there is no way to use the
.Ic :append ,
.Ic :change ,
and
.Ic :insert
commands, since it is not possible to give
more than one line of input to a
.Ic \&:
escape.  To use these
on a
.Ic :global
you must
.Ic Q
to
.Xr \&ex
command mode,
execute them, and then reenter the screen editor with
.Nm \&vi
or
.Ic open .
.Sh HISTORY
The
.Nm \&vi
command appeared in
.Bx 3.0 .