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