Commit | Line | Data |
---|---|---|
2fd0a8e1 BJ |
1 | .if !\n(xx .so tmac.e |
2 | .LC | |
3 | .nf | |
4 | ( \fB.\fR , \fB.\fR ) \fBnumber\fR \fIcount\fR \fIflags\fR | |
5 | .fi | |
6 | .HP | |
7 | The | |
8 | .I number | |
9 | command prints each specified line preceded by its buffer line | |
10 | number. | |
11 | The current line is left at the last line printed. | |
12 | .LC | |
13 | .nf | |
14 | ( \fB.\fR ) \fBopen\fR \fIflags\fR | |
15 | .br | |
16 | ( \fB.\fR ) \fBopen\fR /\fIpat\|\fR/ \fIflags\fR | |
17 | .HP | |
18 | The | |
19 | .I open | |
20 | command enters intraline editing mode at each addressed line. | |
21 | If | |
22 | .I pat | |
23 | is given, | |
24 | then the cursor will be placed initially at the beginning of the | |
25 | string matched by the pattern.\u\s-2\(dg\s0\d | |
26 | .FS | |
27 | \(dg The | |
28 | .I pat | |
29 | may be delimited only by `/' characters; | |
30 | the forms `\e/' and `\e&/' are also not allowed here. | |
31 | .FE | |
32 | Further lines containing | |
33 | .I pat | |
34 | may be opened using the | |
35 | .I next | |
36 | `n' operation without leaving open. | |
37 | The current line is left at the last line opened. | |
38 | See the | |
39 | .I open | |
40 | and | |
41 | .I visual | |
42 | mode description below for more details. | |
43 | .LC | |
44 | .nf | |
45 | \fBpreserve\fR | |
46 | .fi | |
47 | .HP | |
48 | The current editor buffer is saved as though the editor had just crashed. | |
49 | This command is for use only in emergencies when a | |
50 | .I write | |
51 | command has resulted in an error and you don't know how to save your work. | |
52 | After a | |
53 | .I preserve | |
54 | you should seek help immediately. | |
55 | .LC | |
56 | .nf | |
57 | ( \fB.\fR , \fB.\fR )\|\fBprint\fR \fIcount\fR \fIflags\fR | |
58 | .fi | |
59 | .HP | |
60 | The | |
61 | .I print | |
62 | command prints the specified lines | |
63 | with non-printing characters normally escaped as `?'. | |
64 | The current line is left at the last line printed. | |
65 | .LC | |
66 | .nf | |
67 | ( \fB.\fR )\|\fBput\fR | |
68 | .fi | |
69 | .HP | |
70 | The lines removed from the editing buffer by the last command which had the | |
71 | ability to change the buffer are restored after the addressed line. | |
72 | .I Put | |
73 | can be used, e.g., after a | |
74 | .I change | |
75 | command to retrieve the lines changed away when you decide that you want | |
76 | both these and the lines you replaced them with. | |
77 | A | |
78 | .I delete | |
79 | command and a | |
80 | .I put | |
81 | command effect a | |
82 | .I move . | |
83 | Note that | |
84 | .I put | |
85 | is very similar to its | |
86 | .I open | |
87 | and | |
88 | .I visual | |
89 | mode counterpart. | |
90 | .LC | |
91 | .nf | |
92 | \fBquit\fR \fI!\fR | |
93 | .fi | |
94 | .HP | |
95 | The | |
96 | .I quit | |
97 | command causes | |
98 | .EX | |
99 | to exit. | |
100 | No automatic write of the editor buffer to a file is performed. | |
101 | However, | |
102 | .EX | |
103 | issues a warning message if the file has changed | |
104 | since the last write command was issued and it | |
105 | offers a second chance to | |
106 | .I write . | |
107 | .Ex | |
108 | will also complain if there are more files in the argument | |
109 | list. | |
110 | The variant form suppresses these complaints. | |
111 | .LC | |
112 | .nf | |
113 | ( \fB.\fR ) \fBread\fR \fIfilename\fR | |
114 | .fi | |
115 | .HP | |
116 | The | |
117 | .I read | |
118 | command places a copy of the text of the given file in the | |
119 | editing buffer after the specified line. | |
120 | If no | |
121 | .I filename | |
122 | is given the current file name is used. | |
123 | The current file name is not changed unless there is none in which | |
124 | case | |
125 | .I filename | |
126 | becomes the current name. | |
127 | The sensibility restrictions for the | |
128 | .I edit | |
129 | command apply here also. | |
130 | If the file buffer is empty and there is no current name then | |
131 | .I ex | |
132 | treats this as an | |
133 | .I edit | |
134 | command. | |
135 | .IP | |
136 | Address `0' is legal for this command and causes the file to be read at | |
137 | the beginning of the buffer. | |
138 | Statistics are given as for the | |
139 | .I edit | |
140 | command when the | |
141 | .I read | |
142 | successfully terminates. | |
143 | After a | |
144 | .I read | |
145 | the current line is the last line read. | |
146 | .LC | |
147 | .nf | |
148 | \fBrecover \fIfile\fR | |
149 | .fi | |
150 | .HP | |
151 | The command | |
152 | .I recover | |
153 | may be used to retrieve the contents of the editor buffer after a system | |
154 | crash, | |
155 | editor crash, | |
156 | or a | |
157 | .I preserve | |
158 | command. | |
159 | A | |
160 | .I recover | |
161 | also occurs implicitly when the | |
162 | .B \-r | |
163 | option is specified on the command line. | |
164 | A file name should be given to | |
165 | .I recover | |
166 | unless the file of the current name is to be recovered. | |
167 | Thus a name is always required on the command line. | |
168 | A | |
169 | .I recover | |
170 | results in the removal of the saved buffer. | |
171 | The recovered buffer contents should be checked for sensibility | |
172 | and then saved. | |
173 | It is not possible to recover from errors occurring during a | |
174 | .I recover . | |
175 | .LC | |
176 | .nf | |
177 | \fBreset\fR | |
178 | .fi | |
179 | .HP | |
180 | The | |
181 | .I reset | |
182 | command restores the default settings of all numeric and | |
183 | Boolean valued options. | |
184 | .LC | |
185 | .nf | |
186 | \fBset\fR \fIparameter\fR | |
187 | .fi | |
188 | .HP | |
189 | The | |
190 | .I set | |
191 | command may be used to interrogate and to give new values to options. | |
192 | With no arguments it prints those options whose values have been | |
193 | changed from their defaults; | |
194 | with parameter | |
195 | .I all | |
196 | it prints all of the option values | |
197 | .IP | |
198 | By giving an option name followed by a `?' | |
199 | the current value of a single option may be interrogated. | |
200 | The `?' is unnecessary unless the option is Boolean valued. | |
201 | Boolean options are given values either by the form | |
202 | `set option' to set them on or | |
203 | `set nooption' to set them off; | |
204 | string and numeric options are assigned via the form | |
205 | `set option=value'. | |
206 | More than one parameter may be given to | |
207 | .I set \|; | |
208 | they are interpreted left-to-right. | |
209 | .IP | |
210 | It is also possible to interrogate the current values of the | |
211 | current and alternate file names, and the previous | |
212 | .SM UNIX | |
213 | shell escape command by supplying the parameter `%', `\(ga', or `!' | |
214 | respectively. | |
215 | .LC | |
216 | .nf | |
217 | \fBshell\fR | |
218 | .fi | |
219 | .HP | |
220 | A new | |
221 | .I shell | |
222 | is created. | |
223 | This shell is | |
224 | .I interactive , | |
225 | like a login shell. | |
226 | When it terminates, editing resumes. | |
227 | .LC | |
228 | .nf | |
229 | \fBsource\fR \fIfile\fR | |
230 | .fi | |
231 | .HP | |
232 | The | |
233 | .I source | |
234 | command causes | |
235 | .I ex | |
236 | to read commands from the specified file. | |
237 | .I Source | |
238 | commands may be nested. | |
239 | .LC | |
240 | .nf | |
241 | ( \fB.\fR , \fB.\fR ) \fBsubstitute\fR /\fIpat\fR\|/\fIrepl\fR\|/ \fIoptions\fR \fIcount\fR \fIflags\fR | |
242 | .fi | |
243 | .HP | |
244 | On each specified line, the first instance of pattern | |
245 | .I pat | |
246 | is replaced by replacement pattern | |
247 | .I repl . | |
248 | If the | |
249 | .I global | |
250 | indicator option character `g' | |
251 | appears, then all instances are substituted; | |
252 | if the | |
253 | .I confirm | |
254 | indication character `c' appears, | |
255 | then before each substitution the line to be substituted | |
256 | is typed with the string to be substituted marked | |
257 | with `\(ua' characters. | |
258 | By typing an `y' one can cause the substitution to be performed, | |
259 | otherwise no change takes place. | |
260 | After a substitute the current line is the last line substituted. | |
261 | .IP | |
262 | See the regular expression description for an explanation of metasequences | |
263 | available in | |
264 | .I repl . | |
265 | In addition to these sequences, lines may be split by substituting | |
266 | new-line characters into them. | |
267 | The newline in | |
268 | .I repl | |
269 | must be escaped by preceding it with a `\e'. | |
270 | (If the | |
271 | .I substitute | |
272 | is within a | |
273 | .I global , | |
274 | then two escaping `\e' characters will be needed.) | |
275 | .LC | |
276 | .nf | |
277 | \fBsync\fR | |
278 | .fi | |
279 | .HP | |
280 | The | |
281 | .I sync | |
282 | command causes the contents of the editor temporary file to be | |
283 | synchronized to reflect the current state of editing. | |
284 | .I Sync | |
285 | commands are done automatically whenever there is a difference of | |
286 | 15 lines or more between the in-core buffer and the temporary. | |
287 | They are as useful as | |
288 | .I write | |
289 | commands, | |
290 | and much faster, | |
291 | for those who are worried about losing work due to an editor or system crash. | |
292 | .LC | |
293 | .nf | |
294 | ( \fB.\fR , \fB.\fR ) \fBtabulate\fR \fI!\fR \fIcount\fR \fIflags\fR | |
295 | .fi | |
296 | .HP | |
297 | The | |
298 | .I tabulate | |
299 | command causes leading white space to be converted to | |
300 | tabs on the specified lines. | |
301 | The variant causes this tabulation to occur throughout each line. | |
302 | The current line is left at the last line where a change occurred. | |
303 | .LC | |
304 | .nf | |
305 | ( \fB.\fR , \fB.\fR ) \fBtranscribe\fR \fIaddr\fR | |
306 | .fi | |
307 | .HP | |
308 | The | |
309 | .I transcribe | |
310 | command is a synonym for | |
311 | .I copy . | |
312 | .LC | |
313 | .nf | |
314 | \fBundo \fI!\fI | |
315 | .fi | |
316 | .HP | |
317 | The | |
318 | .I undo | |
319 | command reverses the changes made in the buffer by the last | |
320 | buffer editing command. | |
321 | Note that | |
322 | .I global | |
323 | commands are considered a single command for the purpose of | |
324 | .I undo | |
325 | (as are | |
326 | .I open | |
327 | and | |
328 | .I visual.) | |
329 | Also, the commands | |
330 | .I write | |
331 | and | |
332 | .I edit | |
333 | which interact with the | |
334 | .UX | |
335 | file system cannot be undone. | |
336 | .I Undo | |
337 | is its own inverse. | |
338 | After an | |
339 | .I undo | |
340 | the current line is the first line restored | |
341 | or the line before the first line deleted if no lines were restored. | |
342 | For commands with more global effect, | |
343 | such as | |
344 | .I global | |
345 | and | |
346 | .I visual | |
347 | the current line regains it pre-command value after an | |
348 | .I undo. | |
349 | .I Undo | |
350 | always marks the previous value of the current line `\fB.\fR' | |
351 | as `\'\''. | |
352 | .LC | |
353 | .nf | |
354 | ( 1 , $ ) \fBv\fR /\fIpat\fR\|/ \fIcmds\fR | |
355 | .fi | |
356 | .HP | |
357 | The | |
358 | .I v | |
359 | command is a synonym for the | |
360 | .I global | |
361 | command variant `global!'. | |
362 | .LC | |
363 | .nf | |
364 | \fBversion\fR | |
365 | .fi | |
366 | .HP | |
367 | The | |
368 | .I version | |
369 | command prints the current version number of the editor | |
370 | as well as the date the binary was created. | |
371 | .LC | |
372 | .nf | |
373 | ( \fB.\fR ) \fBvisual\fR \fItype\fR \fIflags\fR | |
374 | .fi | |
375 | .HP | |
376 | The | |
377 | .I visual | |
378 | command enters \fIvisual\fR mode at the specified line. | |
379 | .I Type | |
380 | is optional and may be `+', `\-' , `\(ua' (`^') or `\fB.\fR' | |
381 | as in the | |
382 | .I z | |
383 | command to specify the placement of the specified line on the screen. | |
384 | By default, if | |
385 | .I type | |
386 | is omitted, the specified line is placed as the first on the screen. | |
387 | After a | |
388 | .I visual , | |
389 | the current line is the last line the cursor was on when it ended. | |
390 | See the section describing | |
391 | .I visual | |
392 | and | |
393 | .I open | |
394 | for more details. | |
395 | .LC | |
396 | .nf | |
397 | ( 1 , $ ) \fBwrite\fR \fI!\fR \fIfile\fR | |
398 | .br | |
399 | ( 1 , $ ) \fBwrite\fR \fI!\fR >> \fIfile\fR | |
400 | .fi | |
401 | .HP | |
402 | The | |
403 | .I write | |
404 | command places data from the file buffer back into the file system. | |
405 | The first form of the command will write to a file only if it is | |
406 | the current file and is | |
407 | .I edited , | |
408 | if the file does not exist, | |
409 | or if the file is actually a teletype, | |
410 | .B /dev/tty | |
411 | or | |
412 | .B /dev/null . | |
413 | If the file does not exist it is created. | |
414 | The current file name is changed only if there is no current file | |
415 | name. | |
416 | The current line is unchanged by this command, and feedback is given | |
417 | as to the number of lines and characters written as for the | |
418 | .I edit | |
419 | command. | |
420 | The second form is used to write the buffer contents at the end of | |
421 | an existing file. | |
422 | For both forms, | |
423 | the variant suppresses the file existence and type checks. | |
424 | .IP | |
425 | If an error occurs while writing the current and | |
426 | .I edited | |
427 | file, | |
428 | .I ex | |
429 | considers that there has been ``No write since last change'' | |
430 | even if the buffer had not previously been modified. | |
431 | .LC | |
432 | .nf | |
433 | ( \fB.\fR , \fB.\fR ) \fBxpand\fR \fIcount\fR \fIflags\fR | |
434 | .fi | |
435 | .HP | |
436 | The | |
437 | .I xpand | |
438 | command is a synonym for | |
439 | .I expand . | |
440 | .LC | |
441 | .nf | |
442 | ( \fB.\fR , \fB.\fR )\|\fByank\fR \fIcount\fR | |
443 | .fi | |
444 | .HP | |
445 | The | |
446 | .I yank | |
447 | command causes the contents of the addressed lines to define the text | |
448 | to be placed in the buffer by a succeeding | |
449 | .I put | |
450 | command. | |
451 | The addressed lines are not affected. | |
452 | A | |
453 | .I yank | |
454 | and a | |
455 | .I put | |
456 | can be used instead of a | |
457 | .I copy | |
458 | command. | |
459 | .LC | |
460 | .nf | |
461 | ( \fB.\fR ) \fBz\fR \fItype\fR \fIcount\fR | |
462 | .fi | |
463 | .HP | |
464 | The | |
465 | .I z | |
466 | command gives access to windows of text. | |
467 | The default number of logical lines in a window | |
468 | is given by the numeric | |
469 | .I window | |
470 | option | |
471 | or may be given explicitly by the | |
472 | .I count | |
473 | after the command. | |
474 | The various types and their meanings are: | |
475 | .TS | |
476 | center; | |
477 | c l. | |
478 | \fB\&.\fR window around the current line | |
479 | \- window ending at the current line | |
480 | + window starting after the current line | |
481 | omitted window starting at the current line | |
482 | \(ua or ^ window before this window | |
483 | .TE | |
484 | In addition, the form | |
485 | \fIz\fR= | |
486 | displays a window of text with the current line in the center | |
487 | delimited by lines of `\-' characters. | |
488 | For all commands forms except | |
489 | \fIz\fR= | |
490 | the current line is left at the last line printed; | |
491 | for | |
492 | .I z= | |
493 | `\fB.\fR' addresses the bracketed line. | |
494 | .IP | |
495 | The characters `+', `^' and `\-' may be repeated for | |
496 | cumulative effect. | |
497 | On a \s-2CRT\s0 the screen is cleared before display begins unless a | |
498 | count which is less than the screen size is given. | |
499 | .LC | |
500 | .nf | |
501 | \fB!\fIcommand\fR\fR | |
502 | .fi | |
503 | .HP | |
504 | The remainder of the line after the `!' character is sent to a shell | |
505 | to be executed. | |
506 | The current line is unchanged by this command. | |
507 | Within the text of | |
508 | .I command | |
509 | the characters | |
510 | `%' and `\`' are expanded as in filenames and the character | |
511 | `!' is replaced with the text of the previous command. | |
512 | Thus, in particular, | |
513 | `!!' repeats the last such shell escape. | |
514 | If any such expansion is performed, the expanded line will be echoed. | |
515 | .IP | |
516 | If there has been ``No write'' of the buffer contents since the last | |
517 | change to the editing buffer, then a diagnostic will be produced | |
518 | before the command is executed as a warning. | |
519 | A single `!' is printed when the command completes. | |
520 | .LC | |
521 | .nf | |
522 | ( $ ) \fB=\fR | |
523 | .fi | |
524 | .HP | |
525 | The `=' command prints the line number of the | |
526 | addressed line. | |
527 | The current line is unchanged. | |
528 | .LC | |
529 | .nf | |
530 | ( \fB.\fR , \fB.\fR ) \fB>\fR \fIcount\fR \fIflags\fR | |
531 | .br | |
532 | ( \fB.\fR , \fB.\fR ) \fB<\fR \fIcount\fR \fIflags\fR | |
533 | .fi | |
534 | .HP | |
535 | The `>' right shift and `<' left shift | |
536 | commands perform intelligent shifting on the specified lines. | |
537 | The quantity of shift is determined | |
538 | by the | |
539 | .I shiftwidth | |
540 | option and the repetition of the specification character. | |
541 | Thus `>>' causes the current line to be right shifted | |
542 | two tab stops. | |
543 | Only white space is shifted; no non-white space characters are | |
544 | discarded in a left-shift.\u\s-2\(dg\s0\d | |
545 | .FS | |
546 | \(dg White space characters are blank and tab. | |
547 | .FE | |
548 | The current line becomes the last line which changed due to the | |
549 | shifting. | |
550 | .LC | |
551 | .nf | |
552 | \s-2EOF\s0 | |
553 | .fi | |
554 | .HP | |
555 | If | |
556 | .EX | |
557 | receives an end-of-file (control-d) | |
558 | from a terminal input, | |
559 | it interprets this as being a request for a scroll through the file | |
560 | and sends the next | |
561 | .I scroll | |
562 | logical lines of text, | |
563 | normally a half | |
564 | .I window . | |
565 | .LC | |
566 | .nf | |
567 | ( \fB.\fR+1 ) \s-2NL\s0 | |
568 | .br | |
569 | ( \fB.\fR+1 ) | | |
570 | .fi | |
571 | .HP | |
572 | An address alone causes the addressed line to be printed. | |
573 | A blank line alone is thus useful for stepping through text. | |
574 | .LC | |
575 | .nf | |
576 | ( \fB.\fR , \fB.\fR ) \fB:\fR \fIcount\fR \fIflags\fR | |
577 | .fi | |
578 | .HP | |
579 | The | |
580 | .I colon | |
581 | command is used to override the options | |
582 | .I number | |
583 | and | |
584 | .I list | |
585 | so as to print a line without these features while | |
586 | the options remain set. | |
587 | .LC | |
588 | .nf | |
589 | ( \fB.\fR , \fB.\fR ) \fB&\fR \fIoptions\fR \fIcount\fR \fIflags\fR | |
590 | .fi | |
591 | .HP | |
592 | The | |
593 | `&' | |
594 | command repeats the previous | |
595 | .I substitute | |
596 | command. | |
597 | .LC | |
598 | .nf | |
599 | ( \fB.\fR , \fB.\fR ) \fB\s+2~\s0\fR \fIoptions\fR \fIcount\fR \fIflags\fR | |
600 | .fi | |
601 | .HP | |
602 | The | |
603 | `\s+2~\s0' | |
604 | command replaces the previous regular expression with the previous | |
605 | replacement pattern from a substitution. | |
606 | .bp |