Commit | Line | Data |
---|---|---|
eeb91390 BJ |
1 | .TH EX UCB 4/4/79 UCB |
2 | .SH NAME | |
3 | ex \- text editor | |
4 | .SH SYNOPSIS | |
5 | .B ex | |
6 | [ | |
7 | .B \- | |
8 | ] [ | |
9 | .B \-v | |
10 | ] [ | |
11 | .B \-t | |
12 | tag | |
13 | ] [ | |
14 | .B \-r | |
15 | ] [ | |
16 | \fB\+\fIlineno\fR | |
17 | ] | |
18 | name ... | |
19 | .SH DESCRIPTION | |
20 | .I Ex | |
21 | is the root of a family of editors: | |
22 | .I edit, | |
23 | .I ex | |
24 | and | |
25 | .I vi. | |
26 | .I Ex | |
27 | is a superset of | |
28 | .I ed, | |
29 | with the most notable extension being a display editing facility. | |
30 | Display based editing is the focus of | |
31 | .I vi. | |
32 | .PP | |
33 | If you have not used | |
34 | .I ed, | |
35 | or are a casual user, you will find that the editor | |
36 | .I edit | |
37 | is convenient for you. | |
38 | It avoids some of the complexities of | |
39 | .I ex | |
40 | used mostly by systems programmers and persons very familiar with | |
41 | .I ed. | |
42 | .PP | |
43 | If you have a \s-2CRT\s0 terminal, you may wish to use a display | |
44 | based editor; in this case | |
45 | see | |
46 | .IR vi (UCB), | |
47 | which is a command which focuses on the display editing portion of | |
48 | .I ex. | |
49 | .SH DOCUMENTATION | |
50 | For | |
51 | .I edit | |
52 | and | |
53 | .I ex | |
54 | see the | |
55 | .I "Ex/edit command summary \- Version 2.0." | |
56 | The document | |
57 | .I "Edit: A tutorial" | |
58 | provides a comprehensive introduction to | |
59 | .I edit | |
60 | assuming no previous knowledge of computers or the \s-2UNIX\s0 system. | |
61 | .PP | |
62 | The | |
63 | .I "Ex Reference Manual \- Version 2.0" | |
64 | is a comprehensive and complete manual for the command mode features | |
65 | of | |
66 | .I ex, | |
67 | but you cannot learn to use the editor by reading it. | |
68 | For an introduction to | |
69 | more advanced forms of editing using the command mode of | |
70 | .I ex | |
71 | see the editing documents written by Brian Kernighan for the editor | |
72 | .I ed; | |
73 | the material in the introductory and advanced documents works also with | |
74 | .I ex. | |
75 | .PP | |
76 | .I "An Introduction to Display Editing with Vi" | |
77 | introduces the display editor | |
78 | .I vi | |
79 | and provides reference material on | |
80 | .I vi. | |
81 | The | |
82 | .I "Vi Quick Reference" | |
83 | card summarizes the commands | |
84 | of | |
85 | .I vi | |
86 | in a useful, functional way, and is useful with the | |
87 | .I Introduction. | |
88 | .SH FOR ED USERS | |
89 | If you have used | |
90 | .I ed | |
91 | you will find that | |
92 | .I ex | |
93 | has a number of new features useful on CRT terminals. | |
94 | Intelligent terminals and high speed terminals are very pleasant to use | |
95 | with | |
96 | .I vi. | |
97 | Generally, the editor uses far more of the capabilities of terminals than | |
98 | .I ed | |
99 | does, and uses the terminal capability data base | |
100 | .IR termcap (UCB) | |
101 | and the type of the terminal you are using from the variable | |
102 | TERM in the environment to determine how to drive your terminal efficiently. | |
103 | The editor makes use of features such as insert and delete character and line | |
104 | in its | |
105 | .B visual | |
106 | command | |
107 | (which can be abbreviated \fBvi\fR) | |
108 | and which is the central mode of editing when using | |
109 | .IR vi (UCB). | |
110 | There is also an interline editing | |
111 | .B open | |
112 | (\fBo\fR) | |
113 | command which works on all terminals. | |
114 | .PP | |
115 | .I Ex | |
116 | contains a number of new features for easily viewing the text of the file. | |
117 | The | |
118 | .B z | |
119 | command gives easy access to windows of text. | |
120 | Hitting ^D causes the editor to scroll a half-window of text | |
121 | and is more useful for quickly stepping through a file than just hitting | |
122 | return. | |
123 | Of course, the screen oriented | |
124 | .B visual | |
125 | mode gives constant access to editing context. | |
126 | .PP | |
127 | .I Ex | |
128 | gives you more help when you make mistakes. | |
129 | The | |
130 | .B undo | |
131 | (\fBu\fR) | |
132 | command allows you to reverse any single change which goes astray. | |
133 | .I Ex | |
134 | gives you a lot of feedback, normally printing changed lines, | |
135 | and indicates when more than a few lines are affected by a command | |
136 | so that it is easy to detect when a command has affected more lines | |
137 | than it should have. | |
138 | .PP | |
139 | The editor also normally prevents overwriting existing files unless you | |
140 | edited them so that you don't accidentally clobber | |
141 | with a | |
142 | .I write | |
143 | a file other than the one you are editing. | |
144 | If the system (or editor) crashes, or you accidentally hang up the phone, | |
145 | you can use the editor | |
146 | .B recover | |
147 | command to retrieve your work. | |
148 | This will get you back to within a few lines of where you left off. | |
149 | .PP | |
150 | .I Ex | |
151 | has several features for dealing with more than one file at a time. | |
152 | You can give it a list of files on the command line | |
153 | and use the | |
154 | .B next | |
155 | (\fBn\fR) command to deal with each in turn. | |
156 | The | |
157 | .B next | |
158 | command can also be given a list of file names, or a pattern | |
159 | as used by the shell to specify a new set of files to be dealt with. | |
160 | In general, filenames in the editor may be formed with full shell | |
161 | metasyntax. | |
162 | The metacharacter `%' is also available in forming filenames and is replaced | |
163 | by the name of the current file. | |
164 | For editing large groups of related files you can use | |
165 | .I ex's | |
166 | .B tag | |
167 | command to quickly locate functions and other important points in | |
168 | any of the files. | |
169 | This is useful when working on a large program when you want to quickly | |
170 | find the definition of a particular function. | |
171 | The command | |
172 | .IR ctags (UCB) | |
173 | builds a | |
174 | .I tags | |
175 | file or a group of C programs. | |
176 | .PP | |
177 | For moving text between files and within a file the editor has a group | |
178 | of buffers, named | |
179 | .I a | |
180 | through | |
181 | .I z. | |
182 | You can place text in these | |
183 | named buffers and carry it over when you edit another file. | |
184 | .PP | |
185 | There is a command | |
186 | .B & | |
187 | in | |
188 | .I ex | |
189 | which repeats the last | |
190 | .B substitute | |
191 | command. | |
192 | In addition there is a | |
193 | confirmed substitute command. | |
194 | You give a range of substitutions to be done and the editor interactively | |
195 | asks whether each substitution is desired. | |
196 | .PP | |
197 | You can use the | |
198 | .B substitute | |
199 | command in | |
200 | .I ex | |
201 | to systematically convert the case of letters between upper and lower case. | |
202 | It is possible to ignore case | |
203 | of letters in searches and substitutions. | |
204 | .I Ex | |
205 | also allows regular expressions which match words to be constructed. | |
206 | This is convenient, for example, in searching for the word | |
207 | ``edit'' if your document also contains the word ``editor.'' | |
208 | .PP | |
209 | .I Ex | |
210 | has a set of | |
211 | .I options | |
212 | which you can set to tailor it to your liking. | |
213 | One option which is very useful is the | |
214 | .I autoindent | |
215 | option which allows the editor to automatically supply leading white | |
216 | space to align text. You can then use the ^D key as a backtab | |
217 | and space and tab forward to align new code easily. | |
218 | .PP | |
219 | Miscellaneous new useful features include an intelligent | |
220 | .B join | |
221 | (\fBj\fR) command which supplies white space between joined lines | |
222 | automatically, | |
223 | commands < and > which shift groups of lines, and the ability to filter | |
224 | portions of the buffer through commands such as | |
225 | .I sort. | |
226 | .SH FILES | |
227 | .DT | |
228 | /usr/lib/ex2.0strings error messages | |
229 | .br | |
230 | /usr/lib/ex2.0recover recover command | |
231 | .br | |
232 | /usr/lib/ex2.0preserve preserve command | |
233 | .br | |
234 | /etc/termcap describes capabilities of terminals | |
235 | .br | |
236 | ~/.exrc editor startup file | |
237 | .br | |
238 | /tmp/Ex\fInnnnn\fR editor temporary | |
239 | .br | |
240 | /tmp/Rx\fInnnnn\fR named buffer temporary | |
241 | .br | |
242 | /usr/preserve preservation directory | |
243 | .SH SEE ALSO | |
244 | awk(1), ed(1), grep(1), sed(1), edit(UCB), grep(UCB), termcap(UCB), vi(UCB) | |
245 | .SH AUTHOR | |
246 | William Joy | |
247 | .SH BUGS | |
248 | The | |
249 | .I undo | |
250 | command causes all marks to be lost on lines changed and then restored | |
251 | if the marked lines were changed. | |
252 | .PP | |
253 | .I Undo | |
254 | never clears the buffer modified condition. | |
255 | .PP | |
256 | The | |
257 | .I z | |
258 | command prints a number of logical rather than physical lines. | |
259 | More than a screen full of output may result if long lines are present. | |
260 | .PP | |
261 | File input/output errors don't print a name if the command line \fB`\-'\fR | |
262 | option is used. | |
263 | .PP | |
264 | There is no easy way to do a single scan ignoring case. | |
265 | .PP | |
266 | Because of the implementation of the arguments to | |
267 | .I next, | |
268 | only 512 bytes of argument list are allowed there. | |
269 | .PP | |
270 | The format of | |
271 | .I /etc/termcap | |
272 | and the large number of capabilities of terminals used by the editor | |
273 | cause terminal type setup to be rather slow. | |
274 | .PP | |
275 | The editor does not warn if text is placed in named buffers and not used | |
276 | before exiting the editor. | |
277 | .PP | |
278 | Null characters are discarded in input files, and cannot appear in resultant | |
279 | files. |