4.4BSD snapshot (revision 8.1); add 1993 to copyright
[unix-history] / usr / src / usr.bin / ex / vi.1
.\" Copyright (c) 1980, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" %sccs.include.redist.roff%
.\"
.\" @(#)vi.1 8.1 (Berkeley) %G%
.\"
.Dd
.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 .