xref: /original-bsd/usr.bin/ex/vi.1 (revision 6c394c2f)
1.\" Copyright (c) 1980, 1991 Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.roff%
5.\"
6.\"     @(#)vi.1	6.4 (Berkeley) 07/19/92
7.\"
8.Dd
9.Dt VI 1
10.Os BSD 3
11.Sh NAME
12.Nm \&vi
13.Nd screen oriented (visual) display editor based on ex
14.Sh SYNOPSIS
15.Nm \&vi
16.Op Fl R
17.Op Fl l
18.Op Fl r
19.Op Fl t Ar tag
20.Op Fl w Ar n
21.Op Cm \&+ Ns Ar command
22.Ar name ...
23.Sh DESCRIPTION
24.Nm \&Vi
25(visual) is a display oriented text editor based on
26.Xr \&ex 1 .
27.Xr \&Ex
28and
29.Nm \&vi
30run the same code; it is possible to get to
31the command mode of
32.Xr \&ex
33from within
34.Nm \&vi
35and vice-versa.
36.Pp
37Available options:
38.Bl -tag -width xcommandx
39.It Fl R
40Read only. Changes to the file may not be written out.
41.It Fl l
42Sets options for editing
43.Tn LISP
44source (options
45.Ic showmatch
46and
47.Ic lisp ) .
48.It Fl r
49In the event of an editor or system crash, the
50.Fl r
51option will retrieve the last saved version of the
52specified file, or if no file is specified,
53a list of saved files is printed.
54.It Fl t Ar tag
55If tags are used (see
56.Xr ctags 1 )
57the editor is postioned at
58.Ar tag .
59.It Fl w Ns Ar n
60The default window size is set to
61.Ar n .
62.It Cm \&+ Ns Ar command
63Enter the file with
64.Ar command.
65Useful for
66positioning on a string or line number.
67.El
68.Pp
69The
70.%T "Vi Quick Reference"
71card and the
72.%T "Introduction to Display Editing with Vi"
73provide full details on using
74.Nm \&vi .
75.Sh ENVIRONMENT
76The
77.Nm
78command uses the following environment variables.
79.Bl -tag -width Fl
80.It Ev EXINIT
81User specified startup values for
82.Xr \&ex
83and
84.Nm \&vi .
85Usually specified in the file
86.Pa ~/.exrc
87.It Ev HOME
88Default directory to search for
89the file
90.Pa ~/.exrc
91.It Ev SHELL
92Shell used for
93.Em escaped
94commands (with the
95.Xr \&ex
96.Ic \&:!
97command).
98.It Ev TERM
99Terminal type used to lookup terminal capabilities from the
100file
101.Pa /usr/share/misc/termcap .
102.It Ev TERMCAP
103If set, specifies an alternate termcap file.
104.El
105.Sh FILES
106.Bl -tag -width /usr/libexec/ex?.?preserve -compact
107.It Pa  /usr/libexec/ex?.?strings
108error messages
109.It Pa  /usr/libexec/ex?.?recover
110recover command
111.It Pa  /usr/libexec/ex?.?preserve
112preserve command
113.It Pa  /usr/share/misc/termcap
114describes capabilities of terminals
115.It Pa  ~/.exrc
116editor startup file
117.It Pa /tmp/Ex Ns Em nnnnn
118editor temporary
119.It Pa /tmp/Rx Ns Em nnnnn
120named buffer temporary
121.It Pa /var/preserve
122preservation directory
123.El
124.Sh SEE ALSO
125.Xr awk 1 ,
126.Xr \&ed 1 ,
127.Xr grep 1 ,
128.Xr sed 1 ,
129.Xr grep 1 ,
130.Xr \&vi 1 ,
131.Xr termcap 5 ,
132.Xr environ 7
133.Rs
134.%T "Vi Quick Reference Card"
135.Re
136.Rs
137.%T "An Introduction to Display Editing with Vi"
138.Re
139.Sh BUGS
140Software tabs using
141.Sy \&^T
142work only immediately after the
143.Ic autoindent .
144.Pp
145Left and right shifts on intelligent terminals don't make use of
146insert and delete character operations in the terminal.
147.Pp
148The
149.Ic wrapmargin
150option can be fooled since it looks at output columns when blanks are typed.
151If a long word passes through the margin and onto the next line without a
152break, then the line won't be broken.
153.Pp
154Insert/delete within a line can be slow if tabs are present on intelligent
155terminals, since the terminals need help in doing this correctly.
156.Pp
157Saving text on deletes in the named buffers is somewhat inefficient.
158.Pp
159The
160.Ic source
161command does not work when executed as
162.Ic :source ;
163there is no way to use the
164.Ic :append ,
165.Ic :change ,
166and
167.Ic :insert
168commands, since it is not possible to give
169more than one line of input to a
170.Ic \&:
171escape.  To use these
172on a
173.Ic :global
174you must
175.Ic Q
176to
177.Xr \&ex
178command mode,
179execute them, and then reenter the screen editor with
180.Nm \&vi
181or
182.Ic open .
183.Sh HISTORY
184The
185.Nm \&vi
186command appeared in
187.Bx 3.0 .
188