xref: /original-bsd/usr.bin/ex/ex.1 (revision cd89438c)
1.\" Copyright (c) 1980, 1990 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.proprietary.roff%
5.\"
6.\"	@(#)ex.1	6.8 (Berkeley) 04/17/91
7.\"
8.Vx
9.Dd
10.Dt EX 1
11.Os BSD 4
12.Sh NAME
13.Nm ex , edit
14.Nd text editor
15.Sh SYNOPSIS
16.Nm ex
17.Op Fl
18.Op Fl v
19.Op Fl t Ar tag
20.Op Fl r
21.Oo
22.Op Cm + Ar command
23.Oo
24.Op Fl l
25.Ar name
26\&...
27.Nm edit
28.Op ex options
29.Sh DESCRIPTION
30.Nm Ex
31is the root of a family of editors:
32.Nm edit ,
33.Nm ex
34and
35.Nm vi .
36.Nm Ex
37is a superset of
38.Xr ed ,
39with the most notable extension being a display editing facility.
40Display based editing is the focus of
41.Xr vi 1 .
42.Pp
43If you have not used
44.Xr ed 1 ,
45or are a casual user, you will find that the editor
46.Nm edit
47is convenient for you.
48It avoids some of the complexities of
49.Nm ex
50used mostly by systems programmers and persons very familiar with
51.Xr ed 1 .
52.Pp
53If you have a
54.Li CRT
55terminal, you may wish to use a display
56based editor; in this case
57see
58.Xr vi  1  ,
59which is a command which focuses on the display editing portion of
60.Nm ex .
61.Sh DOCUMENTATION
62The document
63.Em Edit: A tutorial
64(USD:14) provides a comprehensive introduction to
65.Nm edit
66assuming no previous knowledge of computers or the UNIX
67system.
68.Pp
69The
70.Em Ex Reference Manual \- Version 3.7
71(USD:16)
72is a comprehensive and complete manual for the command mode features
73of
74.Nm ex ,
75but you cannot learn to use the editor by reading it.
76For an introduction to
77more advanced forms of editing using the command mode of
78.Nm ex
79see the editing documents written by Brian Kernighan for the editor
80.Xr ed 1 ;
81the material in the introductory and advanced documents works also with
82.Nm ex .
83.Pp
84.Em An Introduction to Display Editing with Vi
85(USD:15)
86introduces the display editor
87.Xr vi 1
88and provides reference material on
89.Xr vi 1 .
90In addition, the
91.Em Vi Quick Reference
92card summarizes the commands
93of
94.Xr vi 1
95in a useful, functional way, and is useful with the
96.Em Introduction .
97.Sh ENVIRONMENT
98The
99.Nm
100command uses the following environment variables.
101.Tw Fl
102.Tp Ev EXINIT
103User specified startup values for
104.Nm ex .
105.Tp Ev HOME
106Default directory to search for
107the file
108.Pa ~/.exrc
109.Tp Ev SHELL
110Shell used for
111.Em escaped
112commands (with the
113.Ic \&!
114command).
115.Tp Ev TERM
116Terminal type.
117.Tp Ev TERMCAP
118Alternate termcap file.
119.Tp
120.Sh FILES
121.Dw /usr/libexec/ex?.?preserve
122.Di L
123.Dp Pa  /usr/libexec/ex?.?strings
124error messages
125.Dp Pa  /usr/libexec/ex?.?recover
126recover command
127.Dp Pa  /usr/libexec/ex?.?preserve
128preserve command
129.Dp Pa  /usr/share/misc/termcap
130describes capabilities of terminals
131.Dp Pa  ~/.exrc
132editor startup file
133.Dc Pa /tmp/Ex
134.Ar nnnnn
135.Cx
136editor temporary
137.Dc Pa /tmp/Rx
138.Ar nnnnn
139.Cx
140named buffer temporary
141.Dp Pa /var/preserve
142preservation directory
143.Dp
144.Sh SEE ALSO
145.Xr awk 1 ,
146.Xr ed 1 ,
147.Xr grep 1 ,
148.Xr sed 1 ,
149.Xr grep 1 ,
150.Xr vi 1 ,
151.Xr termcap 5 ,
152.Xr environ 7
153.Sh HISTORY
154.Nm Ex
155appeared in 3 BSD.
156.Sh AUTHOR
157Originally written by William Joy
158.br
159Mark Horton has maintained the editor since version 2.7, adding macros,
160support for many unusual terminals,
161and other features such as word abbreviation mode.
162.Sh BUGS
163The
164.Ic undo
165command causes all marks to be lost on lines changed and then restored
166if the marked lines were changed.
167.Pp
168.Ic Undo
169never clears the buffer modified condition.
170.Pp
171The
172.Ic z
173command prints a number of logical rather than physical lines.
174More than a screen full of output may result if long lines are present.
175.Pp
176File input/output errors don't print a name if the command line
177.Sq Fl
178option is used.
179.Pp
180There is no easy way to do a single scan ignoring case.
181.Pp
182The editor does not warn if text is placed in named buffers and not used
183before exiting the editor.
184.Pp
185Null characters are discarded in input files, and cannot appear in resultant
186files.
187