Commit | Line | Data |
---|---|---|
5b481769 BJ |
1 | .de ZP |
2 | .nr pd \\n()P | |
3 | .nr )P 0 | |
4 | .if \\n(.$=0 .IP | |
5 | .if \\n(.$=1 .IP "\\$1" | |
6 | .if \\n(.$>=2 .IP "\\$1" "\\$2" | |
7 | .nr )P \\n(pd | |
8 | .rm pd | |
9 | .. | |
10 | .de LC | |
11 | .br | |
12 | .sp .1i | |
13 | .ne 4 | |
14 | .LP | |
15 | .ta 4.0i | |
16 | .. | |
17 | .bd S B 3 | |
18 | .RP | |
19 | .TL | |
20 | Ex Reference Manual | |
21 | .br | |
22 | Version 3.1 \- December, 1979 | |
23 | .AU | |
24 | William Joy* | |
25 | .AI | |
26 | Computer Science Division | |
27 | Department of Electrical Engineering and Computer Science | |
28 | University of California, Berkeley | |
29 | Berkeley, Ca. 94720 | |
30 | .AB | |
31 | .I Ex | |
32 | a line oriented text editor, which supports both command and display | |
33 | oriented editing. | |
34 | This reference manual describes the command oriented part of | |
35 | .I ex; | |
36 | the display editing features of | |
37 | .I ex | |
38 | are described in | |
39 | .I "An Introduction to Display Editing with Vi." | |
40 | Other documents about the editor include the introduction | |
41 | .I "Edit: A tutorial", | |
42 | the | |
43 | .I "Ex/edit Command Summary", | |
44 | and a | |
45 | .I "Vi Quick Reference" | |
46 | card. | |
47 | .AE | |
48 | .NH 1 | |
49 | Starting ex | |
50 | .PP | |
51 | .FS | |
52 | * The financial support of an \s-2IBM\s0 Graduate Fellowship and the National | |
53 | Science Foundation under grants MCS74-07644-A03 and MCS78-07291 is gratefully | |
54 | acknowledged. | |
55 | .FE | |
56 | Each instance of the editor has a set of options, | |
57 | which can be set to tailor it to your liking. | |
58 | The command | |
59 | .I edit | |
60 | invokes a version of | |
61 | .I ex | |
62 | designed for more casual or beginning | |
63 | users by changing the default settings of some of these options. | |
64 | To simplify the description which follows we | |
65 | assume the default settings of the options. | |
66 | .PP | |
67 | When invoked, | |
68 | .I ex | |
69 | determines the terminal type from the \s-2TERM\s0 variable in the environment. | |
70 | It there is a \s-2TERMCAP\s0 variable in the environment, and the type | |
71 | of the terminal described there matches the \s-2TERM\s0 vairable, then that description | |
72 | is used. Also if the \s-2TERMCAP\s0 variable contains a pathname (beginning | |
73 | with a \fB/\fR) then the editor will seek the description of the terminal | |
74 | in that file (rather than the default /etc/termcap.) | |
75 | If there is a variable \s-2EXINIT\s0 in the environment, then the editor | |
76 | will execute the commands in that variable, otherwise | |
77 | if there is a file | |
78 | .I \&.exrc | |
79 | in your \s-2HOME\s0 directory | |
80 | .I ex | |
81 | reads commands from that file, simulating a | |
82 | .I source | |
83 | command. | |
84 | Options setting commands placed in | |
85 | \s-2EXINIT\s0 or | |
86 | .I \&.exrc | |
87 | will be executed before each editor session. | |
88 | .PP | |
89 | A command to enter | |
90 | .I ex | |
91 | has the following prototype:\(dg | |
92 | .FS | |
93 | \(dg Brackets `[' `]' surround optional parameters here. | |
94 | .FE | |
95 | .DS | |
96 | \fBex\fR [ \fB\-\fR ] [ \fB\-v\fR ] [ \fB\-t\fR \fItag\fR ] [ \fB\-r\fR ] [ \fB\-l\fR ] [ \fB\-w\fRn ] [ \fB+\fIcommand\fR ] name ... | |
97 | .DE | |
98 | The most common case edits a single file with no options, i.e.: | |
99 | .DS | |
100 | \fBex\fR name | |
101 | .DE | |
102 | The | |
103 | .B \- | |
104 | command line option | |
105 | option suppresses all interactive-user feedback | |
106 | and is useful in processing editor scripts in command files. | |
107 | The | |
108 | .B \-v | |
109 | option is equivalent to using | |
110 | .I vi | |
111 | rather than | |
112 | .I ex. | |
113 | The | |
114 | .B \-t | |
115 | option is equivalent to an initial | |
116 | .I tag | |
117 | command, editing the file containing the | |
118 | .I tag | |
119 | and positioning the editor at its definition. | |
120 | The | |
121 | .B \-r | |
122 | option is used in recovering after an editor or system crash, | |
123 | retrieving the last saved version of the named file or, | |
124 | if no file is specified, | |
125 | typing a list of saved files. | |
126 | The | |
127 | .B \-l | |
128 | option sets up for editing \s-2LISP\s0, setting the | |
129 | .I showmatch | |
130 | and | |
131 | .I lisp | |
132 | options. | |
133 | The | |
134 | .B \-w | |
135 | option sets the default window size to | |
136 | .I n, | |
137 | and is useful on dialups to start in small windows. | |
138 | .I Name | |
139 | arguments indicate files to be edited. | |
140 | An argument of the form | |
141 | \fB+\fIcommand\fR | |
142 | indicates that the editor should begin by executing the specified command. | |
143 | If | |
144 | .I command | |
145 | is omitted, then it defaults to ``$'', positioning the editor at the last | |
146 | line of the first file initially. Other useful commands here are scanning | |
147 | patterns of the form ``/pat'' or line numbers, e.g. ``+100'' starting | |
148 | at line 100. | |
149 | .NH 1 | |
150 | File manipulation | |
151 | .NH 2 | |
152 | Current file | |
153 | .PP | |
154 | .I Ex | |
155 | is normally editing the contents of a single file, | |
156 | whose name is recorded in the | |
157 | .I current | |
158 | file name. | |
159 | .I Ex | |
160 | performs all editing actions in a buffer | |
161 | (actually a temporary file) | |
162 | into which the text of the file is initially read. | |
163 | Changes made to the buffer have no effect on the file being | |
164 | edited unless and until the buffer contents are written out to the | |
165 | file with a | |
166 | .I write | |
167 | command. | |
168 | After the buffer contents are written, | |
169 | the previous contents of the written file are no longer accessible. | |
170 | When a file is edited, | |
171 | its name becomes the current file name, | |
172 | and its contents are read into the buffer. | |
173 | .PP | |
174 | The current file is almost always considered to be | |
175 | .I edited. | |
176 | This means that the contents of the buffer are logically | |
177 | connected with the current file name, | |
178 | so that writing the current buffer contents onto that file, | |
179 | even if it exists, | |
180 | is a reasonable action. | |
181 | If the current file is not | |
182 | .I edited | |
183 | then | |
184 | .I ex | |
185 | will not normally write on it if it already exists.* | |
186 | .FS | |
187 | * The | |
188 | .I file | |
189 | command will say ``[Not edited]'' if the current file is not considered | |
190 | edited. | |
191 | .FE | |
192 | .NH 2 | |
193 | Alternate file | |
194 | .PP | |
195 | Each time a new value is given to the current file name, | |
196 | the previous current file name is saved as the | |
197 | .I alternate | |
198 | file name. | |
199 | Similarly if a file is mentioned but does not become the current file, | |
200 | it is saved as the alternate file name. | |
201 | .NH 2 | |
202 | Filename expansion | |
203 | .PP | |
204 | Filenames within the editor may be specified using the normal | |
205 | shell expansion conventions. | |
206 | In addition, | |
207 | the character `%' in filenames is replaced by the | |
208 | .I current | |
209 | file name and the character | |
210 | `#' by the | |
211 | .I alternate | |
212 | file name.\(dg | |
213 | .FS | |
214 | \(dg This makes it easy to deal alternately with | |
215 | two files and eliminates the need for retyping the | |
216 | name supplied on an | |
217 | .I edit | |
218 | command after a | |
219 | .I "No write since last change" | |
220 | diagnostic is received. | |
221 | .FE | |
222 | .NH 2 | |
223 | Multiple files and named buffers | |
224 | .PP | |
225 | If more than one file is given on the command line, | |
226 | then the first file is edited as described above. | |
227 | The remaining arguments are placed with the first file in the | |
228 | .I "argument list." | |
229 | The current argument list may be displayed with the | |
230 | .I args | |
231 | command. | |
232 | The next file in the argument list may be edited with the | |
233 | .I next | |
234 | command. | |
235 | The argument list may also be respecified by specifying | |
236 | a list of names to the | |
237 | .I next | |
238 | command. | |
239 | These names are expanded, | |
240 | the resulting list of names becomes the new argument list, | |
241 | and | |
242 | .I ex | |
243 | edits the first file on the list. | |
244 | .PP | |
245 | For saving blocks of text while editing, and especially when editing | |
246 | more than one file, | |
247 | .I ex | |
248 | has a group of named buffers. | |
249 | These are similar to the normal buffer, except that only a limited number | |
250 | of operations are available on them. | |
251 | The buffers have names | |
252 | .I a | |
253 | through | |
254 | .I z.\(dd | |
255 | .FS | |
256 | \(dd It is also possible to refer to | |
257 | .I A | |
258 | through | |
259 | .I Z; | |
260 | the upper case buffers are the same as the lower but commands | |
261 | append to named buffers rather than replacing | |
262 | if upper case names are used. | |
263 | .FE | |
264 | .NH 1 | |
265 | Exceptional Conditions | |
266 | .NH 2 | |
267 | Errors and interrupts | |
268 | .PP | |
269 | When errors occur | |
270 | .I ex | |
271 | (optionally) rings the terminal bell and, in any case, prints an error | |
272 | diagnostic. If the primary input is from a file, editor processing | |
273 | will terminate. If an interrupt signal is received, | |
274 | .I ex | |
275 | prints ``Interrupt'' and returns to its command level. If the primary | |
276 | input is a file, then | |
277 | .I ex | |
278 | will exit when this occurs. | |
279 | .NH 2 | |
280 | Recovering from hangups and crashes | |
281 | .PP | |
282 | If a hangup signal is received and the buffer has been modified since | |
283 | it was last written out, or if the system crashes, either the editor | |
284 | (in the first case) or the system (after it reboots in the second) will | |
285 | attempt to preserve the buffer. The next time you log in you should be | |
286 | able to recover the work you were doing, losing at most a few lines of | |
287 | changes from the last point before the hangup or editor crash. To | |
288 | recover a file you can use the | |
289 | .B \-r | |
290 | option. If you were editing the file | |
291 | .I resume, | |
292 | then you should change | |
293 | to the directory where you were when the crash occurred, giving the command | |
294 | .DS | |
295 | \fBex \-r\fI resume\fR | |
296 | .DE | |
297 | After checking that the retrieved file is indeed ok, you can | |
298 | .I write | |
299 | it over the previous contents of that file. | |
300 | .PP | |
301 | You will normally get mail from the system telling you when a file has | |
302 | been saved after a crash. The command | |
303 | .DS | |
304 | \fBex\fR \-\fBr\fR | |
305 | .DE | |
306 | will print a list of the files which have been saved for you. | |
307 | .NH 1 | |
308 | Editing modes | |
309 | .PP | |
310 | .I Ex | |
311 | has five distinct modes. The primary mode is | |
312 | .I command | |
313 | mode. Commands are entered in command mode when a `:' prompt is | |
314 | present, and are executed each time a complete line is sent. In | |
315 | .I "text input" | |
316 | mode | |
317 | .I ex | |
318 | gathers input lines and places them in the file. The | |
319 | .I append, | |
320 | .I insert, | |
321 | and | |
322 | .I change | |
323 | commands use text input mode. | |
324 | No prompt is printed when you are in text input mode. | |
325 | This mode is left by typing a `.' alone at the beginning of a line, and | |
326 | .I command | |
327 | mode resumes. | |
328 | .PP | |
329 | The last three modes are | |
330 | .I open | |
331 | and | |
332 | .I visual | |
333 | modes, entered by the commands of the same name, and, within open and | |
334 | visual modes | |
335 | .I "text insertion" | |
336 | mode. | |
337 | .I Open | |
338 | and | |
339 | .I visual | |
340 | modes allow local editing operations to be performed on the text in the | |
341 | file. The | |
342 | .I open | |
343 | command displays one line at a time on any terminal while | |
344 | .I visual | |
345 | works on \s-2CRT\s0 terminals with random positioning cursors, using the | |
346 | screen as a (single) window for file editing changes. | |
347 | These modes are described (only) in | |
348 | .I "An Introduction to Display Editing with Vi." | |
349 | .NH | |
350 | Command structure | |
351 | .PP | |
352 | Most command names are English words, | |
353 | and initial prefixes of the words are acceptable abbreviations. | |
354 | The ambiguity of abbreviations is resolved in favor of the more commonly | |
355 | used commands.* | |
356 | .FS | |
357 | * As an example, the command | |
358 | .I substitute | |
359 | can be abbreviated `s' | |
360 | while the shortest available abbreviation for the | |
361 | .I set | |
362 | command is `se'. | |
363 | .FE | |
364 | .NH 2 | |
365 | Command parameters | |
366 | .PP | |
367 | Most commands accept prefix addresses specifying the lines in the file | |
368 | upon which they are to have effect. | |
369 | The forms of these addresses will be discussed below. | |
370 | A number of commands also may take a trailing | |
371 | .I count | |
372 | specifying the number of lines to be involved in the command.\(dg | |
373 | .FS | |
374 | \(dg Counts are rounded down if necessary. | |
375 | .FE | |
376 | Thus the command ``10p'' will print the tenth line in the buffer while | |
377 | ``delete 5'' will delete five lines from the buffer, | |
378 | starting with the current line. | |
379 | .PP | |
380 | Some commands take other information or parameters, | |
381 | this information always being given after the command name.\(dd | |
382 | .FS | |
383 | \(dd Examples would be option names in a | |
384 | .I set | |
385 | command i.e. ``set number'', | |
386 | a file name in an | |
387 | .I edit | |
388 | command, | |
389 | a regular expression in a | |
390 | .I substitute | |
391 | command, | |
392 | or a target address for a | |
393 | .I copy | |
394 | command, i.e. ``1,5 copy 25''. | |
395 | .FE | |
396 | .NH 2 | |
397 | Command variants | |
398 | .PP | |
399 | A number of commands have two distinct variants. | |
400 | The variant form of the command is invoked by placing an | |
401 | `!' immediately after the command name. | |
402 | Some of the default variants may be controlled by options; | |
403 | in this case, the `!' serves to toggle the default. | |
404 | .NH 2 | |
405 | Flags after commands | |
406 | .PP | |
407 | The characters `#', `p' and `l' may be placed after many commands.* | |
408 | .FS | |
409 | * | |
410 | A `p' or `l' must be preceded by a blank or tab | |
411 | except in the single special case `dp'. | |
412 | .FE | |
413 | In this case, the command abbreviated by these characters | |
414 | is executed after the command completes. | |
415 | Since | |
416 | .I ex | |
417 | normally prints the new current line after each change, `p' is rarely necessary. | |
418 | Any number of `+' or `\-' characters may also be given with these flags. | |
419 | If they appear, the specified offset is applied to the current line | |
420 | value before the printing command is executed. | |
421 | .NH 2 | |
422 | Multiple commands per line | |
423 | .PP | |
424 | More than one command may be placed on a line by separating each pair | |
425 | of commands by a `|' character. | |
426 | However the | |
427 | .I global | |
428 | commands, | |
429 | and the shell escape `!' | |
430 | must be the last command on a line, as they are not terminated by a `|'. | |
431 | .NH 2 | |
432 | Reporting large changes | |
433 | .PP | |
434 | Most commands which change the contents of the editor buffer give | |
435 | feedback if the scope of the change exceeds a threshold given by the | |
436 | .I report | |
437 | option. | |
438 | This feedback helps to detect undesirably large changes so that they may | |
439 | be quickly and easily reversed with an | |
440 | .I undo. | |
441 | After commands with more global effect such as | |
442 | .I global | |
443 | or | |
444 | .I visual, | |
445 | you will be informed if the net change in the number of lines | |
446 | in the buffer during this command exceeds this threshold. | |
447 | .NH 1 | |
448 | Command addressing | |
449 | .NH 2 | |
450 | Addressing primitives | |
451 | .IP \fB.\fR 20 | |
452 | The current line. | |
453 | Most commands leave the current line as the last line which they affect. | |
454 | The default address for most commands is the current line, | |
455 | thus `\fB.\fR' is rarely used alone as an address. | |
456 | .IP \fIn\fR 20 | |
457 | The \fIn\fRth line in the editor's buffer, lines being numbered | |
458 | sequentially from 1. | |
459 | .IP \fB$\fR 20 | |
460 | The last line in the buffer. | |
461 | .IP \fB%\fR 20 | |
462 | An abbreviation for ``1,$'', the entire buffer. | |
463 | .IP \fI+n\fR\ \fI\-n\fR 20 | |
464 | An offset relative to the current buffer line.\(dg | |
465 | .FS | |
466 | \(dg | |
467 | The forms `.+2' `++;2' and `++' are all equivalent; | |
468 | if the current line is line 100 they all address line 102. | |
469 | .FE | |
470 | .IP \fB/\fIpat\fR\fB/\fR\ \fB?\fIpat\fR\fB?\fR 20 | |
471 | Scan forward and backward respectively for a line containing \fIpat\fR, a | |
472 | regular expression (as defined below). The scans normally wrap around the end | |
473 | of the buffer. | |
474 | If all that is desired is to print the next line containing \fIpat\fR, then | |
475 | the trailing \fB/\fR or \fB?\fR may be omitted. | |
476 | If \fIpat\fR is omitted or explicitly empty, then the last | |
477 | regular expression specified is located.\(dd | |
478 | .FS | |
479 | \(dd The forms \fB\e/\fR and \fB\e?\fR scan | |
480 | using the last regular expression used in a scan; after a substitute | |
481 | \fB//\fR and \fB??\fR would scan using the substitute's regular expression. | |
482 | .FE | |
483 | .IP \fB\(aa\(aa\fR\ \fB\(aa\fIx\fR 20 | |
484 | Before each non-relative motion of the current line `\fB.\fR', | |
485 | the previous current line is marked with a tag, subsequently referred to as | |
486 | `\(aa\(aa'. | |
487 | This makes it easy to refer or return to this previous context. | |
488 | Marks may also be established by the | |
489 | .I mark | |
490 | command, using single lower case letters | |
491 | .I x | |
492 | and the marked lines referred to as | |
493 | `\(aa\fIx\fR'. | |
494 | .NH 2 | |
495 | Combining addressing primitives | |
496 | .PP | |
497 | Addresses to commands consist of a series of addressing primitives, | |
498 | separated by `,' or `;'. | |
499 | Such address lists are evaluated left-to-right. | |
500 | When addresses are separated by `;' the current line `\fB.\fR' | |
501 | is set to the value of the previous addressing expression | |
502 | before the next address is interpreted. | |
503 | If more addresses are given than the command requires, | |
504 | then all but the last one or two are ignored. | |
505 | If the command takes two addresses, the first addressed line must | |
506 | precede the second in the buffer.\(dg | |
507 | .FS | |
508 | \(dg Null address specifications are permitted in a list of addresses, | |
509 | the default in this case is the current line `.'; | |
510 | thus `,100' is equivalent to `\fB.\fR,100'. | |
511 | It is an error to give a prefix address to a command which expects none. | |
512 | .FE | |
513 | .NH 1 | |
514 | Command descriptions | |
515 | .PP | |
516 | The following form is a prototype for all | |
517 | .I ex | |
518 | commands: | |
519 | .DS | |
520 | \fIaddress\fR \fBcommand\fR \fI! parameters count flags\fR | |
521 | .DE | |
522 | All parts are optional; the degenerate case is the empty command which prints | |
523 | the next line in the file. For sanity with use from within | |
524 | .I visual | |
525 | mode, | |
526 | .I ex | |
527 | ignores a ``:'' preceding any command. | |
528 | .PP | |
529 | In the following command descriptions, the | |
530 | default addresses are shown in parentheses, | |
531 | which are | |
532 | .I not, | |
533 | however, | |
534 | part of the command. | |
535 | .LC | |
536 | ( \fB.\fR ) \fBappend\fR abbr: \fBa\fR | |
537 | .br | |
538 | \fItext\fR | |
539 | .br | |
540 | \&\fB.\fR | |
541 | .ZP | |
542 | Reads the input text and places it after the specified line. | |
543 | After the command, `\fB.\fR' | |
544 | addresses the last line input or the | |
545 | specified line if no lines were input. | |
546 | If address `0' is given, | |
547 | text is placed at the beginning of the buffer. | |
548 | .LC | |
549 | \fBa!\fR | |
550 | .br | |
551 | \fItext\fR | |
552 | .br | |
553 | \&\fB.\fR | |
554 | .ZP | |
555 | The variant flag to | |
556 | .I append | |
557 | toggles the setting for the | |
558 | .I autoindent | |
559 | option during the input of | |
560 | .I text. | |
561 | .LC | |
562 | \fBargs\fR | |
563 | .ZP | |
564 | The members of the argument list are printed, with the current argument | |
565 | delimited by `[' and `]'. | |
566 | ...PP | |
567 | ..\fBcd\fR \fIdirectory\fR | |
568 | ...ZP | |
569 | ..The | |
570 | ...I cd | |
571 | ..command is a synonym for | |
572 | ...I chdir. | |
573 | .LC | |
574 | ( \fB.\fR , \fB.\fR ) \fBchange\fR \fIcount\fR abbr: \fBc\fR | |
575 | .br | |
576 | \fItext\fR | |
577 | .br | |
578 | \&\fB.\fR | |
579 | .ZP | |
580 | Replaces the specified lines with the input \fItext\fR. | |
581 | The current line becomes the last line input; | |
582 | if no lines were input it is left as for a | |
583 | \fIdelete\fR. | |
584 | .LC | |
585 | \fBc!\fR | |
586 | .br | |
587 | \fItext\fR | |
588 | .br | |
589 | \&\fB.\fR | |
590 | .ZP | |
591 | The variant toggles | |
592 | .I autoindent | |
593 | during the | |
594 | .I change. | |
595 | ...LC | |
596 | ..\fBchdir\fR \fIdirectory\fR | |
597 | ...ZP | |
598 | ..The specified \fIdirectory\fR becomes the current directory. | |
599 | ..If no directory is specified, the current value of the | |
600 | ...I home | |
601 | ..option is used as the target directory. | |
602 | ..After a | |
603 | ...I chdir | |
604 | ..the current file is not considered to have been | |
605 | ..edited so that write restrictions on pre-existing files apply. | |
606 | .LC | |
607 | ( \fB.\fR , \fB.\fR )\|\fBcopy\fR \fIaddr\fR \fIflags\fR abbr: \fBco\fR | |
608 | .ZP | |
609 | A | |
610 | .I copy | |
611 | of the specified lines is placed after | |
612 | .I addr, | |
613 | which may be `0'. | |
614 | The current line | |
615 | `\fB.\fR' | |
616 | addresses the last line of the copy. | |
617 | The command | |
618 | .I t | |
619 | is a synonym for | |
620 | .I copy. | |
621 | .LC | |
622 | ( \fB.\fR , \fB.\fR )\|\fBdelete\fR \fIbuffer\fR \fIcount\fR \fIflags\fR abbr: \fBd\fR | |
623 | .ZP | |
624 | Removes the specified lines from the buffer. | |
625 | The line after the last line deleted becomes the current line; | |
626 | if the lines deleted were originally at the end, | |
627 | the new last line becomes the current line. | |
628 | If a named | |
629 | .I buffer | |
630 | is specified by giving a letter, | |
631 | then the specified lines are saved in that buffer, | |
632 | or appended to it if an upper case letter is used. | |
633 | .LC | |
634 | \fBedit\fR \fIfile\fR abbr: \fBe\fR | |
635 | .br | |
636 | \fBex\fR \fIfile\fR | |
637 | .ZP | |
638 | Used to begin an editing session on a new file. | |
639 | The editor | |
640 | first checks to see if the buffer has been modified since the last | |
641 | .I write | |
642 | command was issued. | |
643 | If it has been, | |
644 | a warning is issued and the | |
645 | command is aborted. | |
646 | The | |
647 | command otherwise deletes the entire contents of the editor buffer, | |
648 | makes the named file the current file and prints the new filename. | |
649 | After insuring that this file is sensible\(dg | |
650 | .FS | |
651 | \(dg I.e., that it is not a binary file such as a directory, | |
652 | a block or character special file other than | |
653 | .I /dev/tty, | |
654 | a terminal, | |
655 | or a binary or executable file | |
656 | (as indicated by the first word). | |
657 | .FE | |
658 | the editor reads the file into its buffer. | |
659 | .IP | |
660 | If the read of the file completes without error, | |
661 | the number of lines and characters read is typed. | |
662 | If there were any non-\s-2ASCII\s0 characters | |
663 | in the file they are stripped of their non-\s-2ASCII\s0 | |
664 | high bits, | |
665 | and any null characters in the file are discarded. | |
666 | If none of these errors occurred, the file is considered | |
667 | .I edited. | |
668 | If the last line of the input file is missing the trailing | |
669 | newline character, it will be supplied and a complaint will be issued. | |
670 | This command leaves the current line `\fB.\fR' at the last line read.\(dd | |
671 | .FS | |
672 | \(dd If executed from within | |
673 | .I open | |
674 | or | |
675 | .I visual, | |
676 | the current line is initially the first line of the file. | |
677 | .FE | |
678 | .LC | |
679 | \fBe!\fR \fIfile\fR | |
680 | .ZP | |
681 | The variant form suppresses the complaint about modifications having | |
682 | been made and not written from the editor buffer, thus | |
683 | discarding all changes which have been made before editing the new file. | |
684 | .LC | |
685 | \fBe\fR \fB+\fIn\fR \fIfile\fR | |
686 | .ZP | |
687 | Causes the editor to begin at line | |
688 | .I n | |
689 | rather than at the last line; | |
690 | \fIn\fR may also be an editor command containing no spaces, e.g.: ``+/pat''. | |
691 | .LC | |
692 | \fBfile\fR abbr: \fBf\fR | |
693 | .ZP | |
694 | Prints the current file name, | |
695 | whether it has been `[Modified]' since the last | |
696 | .I write | |
697 | command, | |
698 | the current line, | |
699 | and the number of lines in the buffer.* | |
700 | .FS | |
701 | * In the rare case that the current file is `[Not edited]' this is | |
702 | noted also; in this case you have to use the form \fBw!\fR to write to | |
703 | the file, since the editor is not sure that a \fBwrite\fR will not | |
704 | destroy a file unrelated to the current contents of the buffer. | |
705 | .FE | |
706 | .LC | |
707 | \fBfile\fR \fIfile\fR | |
708 | .ZP | |
709 | The current file name is changed to | |
710 | .I file | |
711 | which is considered | |
712 | `[Not edited]'. | |
713 | .LC | |
714 | ( 1 , $ ) \fBglobal\fR /\fIpat\|\fR/ \fIcmds\fR abbr: \fBg\fR | |
715 | .ZP | |
716 | First marks each line among those specified which matches | |
717 | the given regular expression. | |
718 | Then the given command list is executed with `\fB.\fR' initially | |
719 | set to each marked line. | |
720 | .IP | |
721 | The command list consists of the remaining commands on the current | |
722 | input line and may continue to multiple lines by ending all but the | |
723 | last such line with a `\e'. | |
724 | If | |
725 | .I cmds | |
726 | (and possibly the trailing \fB/\fR delimiter) is omitted, each line matching | |
727 | .I pat | |
728 | is printed. | |
729 | .I Append, | |
730 | .I insert, | |
731 | and | |
732 | .I change | |
733 | commands and associated input are permitted; | |
734 | the `\fB.\fR' terminating input may be omitted if it would be on the | |
735 | last line of the command list. | |
736 | .I Open | |
737 | and | |
738 | .I visual | |
739 | commands are permitted in the command list and take input from the terminal. | |
740 | .IP | |
741 | The | |
742 | .I global | |
743 | command itself may not appear in | |
744 | .I cmds. | |
745 | The | |
746 | .I undo | |
747 | command is also not permitted there, | |
748 | as | |
749 | .I undo | |
750 | instead can be used to reverse the entire | |
751 | .I global | |
752 | command. | |
753 | The options | |
754 | .I autoprint | |
755 | and | |
756 | .I autoindent | |
757 | are inhibited during a | |
758 | .I global, | |
759 | (and possibly the trailing \fB/\fR delimiter) and the value of the | |
760 | .I report | |
761 | option is temporarily infinite, | |
762 | in deference to a \fIreport\fR for the entire global. | |
763 | Finally, the context mark `\'\'' is set to the value of | |
764 | `.' before the global command begins and is not changed during a global | |
765 | command, | |
766 | except perhaps by an | |
767 | .I open | |
768 | or | |
769 | .I visual | |
770 | within the | |
771 | .I global. | |
772 | .LC | |
773 | \fBg!\fR \fB/\fIpat\fB/\fR \fIcmds\fR abbr: \fBv\fR | |
774 | .IP | |
775 | The variant form of \fIglobal\fR runs \fIcmds\fR at each line not matching | |
776 | \fIpat\fR. | |
777 | ...LC | |
778 | ..\fBhelp\fR \fItopic\fR | |
779 | ...ZP | |
780 | ..The | |
781 | ...I help | |
782 | ..command accepts keywords related to the editor and, | |
783 | ..if there is information in its data base about that | |
784 | ...I topic | |
785 | ..supplies the information. | |
786 | ..A list of topics can be had by | |
787 | ...I help\ index. | |
788 | .LC | |
789 | ( \fB.\fR )\|\fBinsert\fR abbr: \fBi\fR | |
790 | .br | |
791 | \fItext\fR | |
792 | .br | |
793 | \&\fB.\fR | |
794 | .ZP | |
795 | Places the given text before the specified line. | |
796 | The current line is left at the last line input; | |
797 | if there were none input it is left at the line before the addressed line. | |
798 | This command differs from | |
799 | .I append | |
800 | only in the placement of text. | |
801 | .KS | |
802 | .LC | |
803 | \fBi!\fR | |
804 | .br | |
805 | \fItext\fR | |
806 | .br | |
807 | \&\fB.\fR | |
808 | .ZP | |
809 | The variant toggles | |
810 | .I autoindent | |
811 | during the | |
812 | .I insert. | |
813 | .KE | |
814 | .LC | |
815 | ( \fB.\fR , \fB.\fR+1 ) \fBjoin\fR \fIcount\fR \fIflags\fR abbr: \fBj\fR | |
816 | .ZP | |
817 | Places the text from a specified range of lines | |
818 | together on one line. | |
819 | White space is adjusted at each junction to provide at least | |
820 | one blank character, two if there was a `\fB.\fR' at the end of the line, | |
821 | or none if the first following character is a `)'. | |
822 | If there is already white space at the end of the line, | |
823 | then the white space at the start of the next line will be discarded. | |
824 | .LC | |
825 | \fBj!\fR | |
826 | .ZP | |
827 | The variant causes a simpler | |
828 | .I join | |
829 | with no white space processing; the characters in the lines are simply | |
830 | concatenated. | |
831 | .LC | |
832 | ( \fB.\fR ) \fBk\fR \fIx\fR | |
833 | .ZP | |
834 | The | |
835 | .I k | |
836 | command is a synonym for | |
837 | .I mark. | |
838 | It does not require a blank or tab before the following letter. | |
839 | .LC | |
840 | ( \fB.\fR , \fB.\fR ) \fBlist\fR \fIcount\fR \fIflags\fR | |
841 | .ZP | |
842 | Prints the specified lines in a more unambiguous way: | |
843 | tabs are printed as `^I' | |
844 | and the end of each line is marked with a trailing `$'. | |
845 | The current line is left at the last line printed. | |
846 | .LC | |
847 | \fBmap\fR \fIlhs\fR \fIrhs\fR | |
848 | .ZP | |
849 | The | |
850 | .I map | |
851 | command is used to define macros for use in | |
852 | .I visual | |
853 | mode. | |
854 | .I Lhs | |
855 | should be a single character, or the sequence ``#n'', for n a digit, | |
856 | referring to function key \fIn\fR. When this character or function key | |
857 | is typed in | |
858 | .I visual | |
859 | mode, it will be as though the corresponding \fIrhs\fR had been typed. | |
860 | On terminals without function keys, you can type ``#n''. | |
861 | See section 6.9 of the ``Introduction to Display Editing with Vi'' | |
862 | for more details. | |
863 | .LC | |
864 | ( \fB.\fR ) \fBmark\fR \fIx\fR | |
865 | .ZP | |
866 | Gives the specified line mark | |
867 | .I x, | |
868 | a single lower case letter. | |
869 | The | |
870 | .I x | |
871 | must be preceded by a blank or a tab. | |
872 | The addressing form `\'x' then addresses this line. | |
873 | The current line is not affected by this command. | |
874 | .LC | |
875 | ( \fB.\fR , \fB.\fR ) \fBmove\fR \fIaddr\fR abbr: \fBm\fR | |
876 | .ZP | |
877 | The | |
878 | .I move | |
879 | command repositions the specified lines to be after | |
880 | .I addr . | |
881 | The first of the moved lines becomes the current line. | |
882 | .LC | |
883 | \fBnext\fR abbr: \fBn\fR | |
884 | .ZP | |
885 | The next file from the command line argument list is edited. | |
886 | .LC | |
887 | \fBn!\fR | |
888 | .ZP | |
889 | The variant suppresses warnings about the modifications to the buffer not | |
890 | having been written out, discarding (irretrievably) any changes which may | |
891 | have been made. | |
892 | .LC | |
893 | \fBn\fR \fIfilelist\fR | |
894 | .br | |
895 | \fBn\fR \fB+\fIcommand\fR \fIfilelist\fR | |
896 | .ZP | |
897 | The specified | |
898 | .I filelist | |
899 | is expanded and the resulting list replaces the | |
900 | current argument list; | |
901 | the first file in the new list is then edited. | |
902 | If | |
903 | .I command | |
904 | is given (it must contain no spaces), then it is executed after editing the first such file. | |
905 | .LC | |
906 | ( \fB.\fR , \fB.\fR ) \fBnumber\fR \fIcount\fR \fIflags\fR abbr: \fB#\fR or \fBnu\fR | |
907 | .ZP | |
908 | Prints each specified line preceded by its buffer line | |
909 | number. | |
910 | The current line is left at the last line printed. | |
911 | .KS | |
912 | .LC | |
913 | ( \fB.\fR ) \fBopen\fR \fIflags\fR abbr: \fBo\fR | |
914 | .br | |
915 | ( \fB.\fR ) \fBopen\fR /\fIpat\|\fR/ \fIflags\fR | |
916 | .ZP | |
917 | Enters intraline editing \fIopen\fR mode at each addressed line. | |
918 | If | |
919 | .I pat | |
920 | is given, | |
921 | then the cursor will be placed initially at the beginning of the | |
922 | string matched by the pattern. | |
923 | See | |
924 | .I "An Introduction to Display Editing with Vi" | |
925 | for more details. | |
926 | .KE | |
927 | .LC | |
928 | \fBpreserve\fR | |
929 | .ZP | |
930 | The current editor buffer is saved as though the system had just crashed. | |
931 | This command is for use only in emergencies when a | |
932 | .I write | |
933 | command has resulted in an error and you don't know how to save your work. | |
934 | After a | |
935 | .I preserve | |
936 | you should seek help. | |
937 | .LC | |
938 | ( \fB.\fR , \fB.\fR )\|\fBprint\fR \fIcount\fR abbr: \fBp\fR or \fBP\fR | |
939 | .ZP | |
940 | Prints the specified lines | |
941 | with non-printing characters printed as control characters `^\fIx\fR\|'; | |
942 | delete (octal 177) is represented as `^?'. | |
943 | The current line is left at the last line printed. | |
944 | .LC | |
945 | ( \fB.\fR )\|\fBput\fR \fIbuffer\fR abbr: \fBpu\fR | |
946 | .ZP | |
947 | Puts back | |
948 | previously | |
949 | .I deleted | |
950 | or | |
951 | .I yanked | |
952 | lines. | |
953 | Normally used with | |
954 | .I delete | |
955 | to effect movement of lines, | |
956 | or with | |
957 | .I yank | |
958 | to effect duplication of lines. | |
959 | If no | |
960 | .I buffer | |
961 | is specified, then the last | |
962 | .I deleted | |
963 | or | |
964 | .I yanked | |
965 | text is restored.* | |
966 | .FS | |
967 | * But no modifying commands may intervene between the | |
968 | .I delete | |
969 | or | |
970 | .I yank | |
971 | and the | |
972 | .I put, | |
973 | nor may lines be moved between files without using a named buffer. | |
974 | .FE | |
975 | By using a named buffer, text may be restored that was saved there at any | |
976 | previous time. | |
977 | .LC | |
978 | \fBquit\fR abbr: \fBq\fR | |
979 | .ZP | |
980 | Causes | |
981 | .I ex | |
982 | to terminate. | |
983 | No automatic write of the editor buffer to a file is performed. | |
984 | However, | |
985 | .I ex | |
986 | issues a warning message if the file has changed | |
987 | since the last | |
988 | .I write | |
989 | command was issued, and does not | |
990 | .I quit.\(dg | |
991 | .FS | |
992 | \(dg \fIEx\fR | |
993 | will also issue a diagnostic if there are more files in the argument | |
994 | list. | |
995 | .FE | |
996 | Normally, you will wish to save your changes, and you | |
997 | should give a \fIwrite\fR command; | |
998 | if you wish to discard them, use the \fBq!\fR command variant. | |
999 | .LC | |
1000 | \fBq!\fR | |
1001 | .ZP | |
1002 | Quits from the editor, discarding changes to the buffer without complaint.\(dg | |
1003 | .LC | |
1004 | ( \fB.\fR ) \fBread\fR \fIfile\fR abbr: \fBr\fR | |
1005 | .ZP | |
1006 | Places a copy of the text of the given file in the | |
1007 | editing buffer after the specified line. | |
1008 | If no | |
1009 | .I file | |
1010 | is given the current file name is used. | |
1011 | The current file name is not changed unless there is none in which | |
1012 | case | |
1013 | .I file | |
1014 | becomes the current name. | |
1015 | The sensibility restrictions for the | |
1016 | .I edit | |
1017 | command apply here also. | |
1018 | If the file buffer is empty and there is no current name then | |
1019 | .I ex | |
1020 | treats this as an | |
1021 | .I edit | |
1022 | command. | |
1023 | .IP | |
1024 | Address `0' is legal for this command and causes the file to be read at | |
1025 | the beginning of the buffer. | |
1026 | Statistics are given as for the | |
1027 | .I edit | |
1028 | command when the | |
1029 | .I read | |
1030 | successfully terminates. | |
1031 | After a | |
1032 | .I read | |
1033 | the current line is the last line read.\(dd | |
1034 | .FS | |
1035 | \(dd Within | |
1036 | .I open | |
1037 | and | |
1038 | .I visual | |
1039 | the current line is set to the first line read rather than the last. | |
1040 | .FE | |
1041 | .LC | |
1042 | ( \fB.\fR ) \fBread\fR \fB!\fR\fIcommand\fR | |
1043 | .ZP | |
1044 | Reads the output of the command | |
1045 | .I command | |
1046 | into the buffer after the specified line. | |
1047 | This is not a variant form of the command, rather a read | |
1048 | specifying a | |
1049 | .I command | |
1050 | rather than a | |
1051 | .I filename; | |
1052 | a blank or tab before the \fB!\fR is mandatory. | |
1053 | .LC | |
1054 | \fBrecover \fIfile\fR | |
1055 | .ZP | |
1056 | Recovers | |
1057 | .I file | |
1058 | from the system save area. | |
1059 | Used after a accidental hangup of the phone** | |
1060 | .FS | |
1061 | ** The system saves a copy of the file you were editing only if you | |
1062 | have made changes to the file. | |
1063 | .FE | |
1064 | or a system crash** or | |
1065 | .I preserve | |
1066 | command. | |
1067 | Except when you use | |
1068 | .I preserve | |
1069 | you will be notified by mail when a file is saved. | |
1070 | .LC | |
1071 | \fBrewind\fR abbr: \fBrew\fR | |
1072 | .ZP | |
1073 | The argument list is rewound, and the first file in the list is edited. | |
1074 | .LC | |
1075 | \fBrew!\fR | |
1076 | .ZP | |
1077 | Rewinds the argument list discarding any changes made to the current buffer. | |
1078 | .LC | |
1079 | \fBset\fR \fIparameter\fR | |
1080 | .ZP | |
1081 | With no arguments, prints those options whose values have been | |
1082 | changed from their defaults; | |
1083 | with parameter | |
1084 | .I all | |
1085 | it prints all of the option values. | |
1086 | .IP | |
1087 | Giving an option name followed by a `?' | |
1088 | causes the current value of that option to be printed. | |
1089 | The `?' is unnecessary unless the option is Boolean valued. | |
1090 | Boolean options are given values either by the form | |
1091 | `set \fIoption\fR' to turn them on or | |
1092 | `set no\fIoption\fR' to turn them off; | |
1093 | string and numeric options are assigned via the form | |
1094 | `set \fIoption\fR=value'. | |
1095 | .IP | |
1096 | More than one parameter may be given to | |
1097 | .I set \|; | |
1098 | they are interpreted left-to-right. | |
1099 | .LC | |
1100 | \fBshell\fR abbr: \fBsh\fR | |
1101 | .IP | |
1102 | A new shell is created. | |
1103 | When it terminates, editing resumes. | |
1104 | .LC | |
1105 | \fBsource\fR \fIfile\fR abbr: \fBso\fR | |
1106 | .IP | |
1107 | Reads and executes commands from the specified file. | |
1108 | .I Source | |
1109 | commands may be nested. | |
1110 | .LC | |
1111 | ( \fB.\fR , \fB.\fR ) \fBsubstitute\fR /\fIpat\fR\|/\fIrepl\fR\|/ \fIoptions\fR \fIcount\fR \fIflags\fR abbr: \fBs\fR | |
1112 | .IP | |
1113 | On each specified line, the first instance of pattern | |
1114 | .I pat | |
1115 | is replaced by replacement pattern | |
1116 | .I repl. | |
1117 | If the | |
1118 | .I global | |
1119 | indicator option character `g' | |
1120 | appears, then all instances are substituted; | |
1121 | if the | |
1122 | .I confirm | |
1123 | indication character `c' appears, | |
1124 | then before each substitution the line to be substituted | |
1125 | is typed with the string to be substituted marked | |
1126 | with `\(ua' characters. | |
1127 | By typing an `y' one can cause the substitution to be performed, | |
1128 | any other input causes no change to take place. | |
1129 | After a | |
1130 | .I substitute | |
1131 | the current line is the last line substituted. | |
1132 | .IP | |
1133 | Lines may be split by substituting | |
1134 | new-line characters into them. | |
1135 | The newline in | |
1136 | .I repl | |
1137 | must be escaped by preceding it with a `\e'.\(dg | |
1138 | .FS | |
1139 | \(dg If the | |
1140 | .I substitute | |
1141 | is within a | |
1142 | .I global, | |
1143 | then two escaping `\e' characters will be needed.) | |
1144 | .FE | |
1145 | Other metacharacters available in | |
1146 | .I pat | |
1147 | and | |
1148 | .I repl | |
1149 | are described below. | |
1150 | .LC | |
1151 | ( \fB.\fR , \fB.\fR ) \fBsubstitute\fR \fIoptions\fR \fIcount\fR \fIflags\fR abbr: \fBs\fR | |
1152 | .ZP | |
1153 | If | |
1154 | .I pat | |
1155 | and | |
1156 | .I repl | |
1157 | are omitted, then the last substitution is repeated. | |
1158 | This is a synonym for the | |
1159 | .B & | |
1160 | command. | |
1161 | .LC | |
1162 | ( \fB.\fR , \fB.\fR ) \fBt\fR \fIaddr\fR \fIflags\fR | |
1163 | .ZP | |
1164 | The | |
1165 | .I t | |
1166 | command is a synonym for | |
1167 | .I copy . | |
1168 | .LC | |
1169 | \fBta\fR \fItag\fR | |
1170 | .ZP | |
1171 | The focus of editing switches to the location of | |
1172 | .I tag, | |
1173 | switching to a different line in the current file where it is defined, | |
1174 | or if necessary to another file.\(dd | |
1175 | .FS | |
1176 | \(dd If you have modified the current file before giving a | |
1177 | .I tag | |
1178 | command, you must write it out; giving another | |
1179 | .I tag | |
1180 | command, specifying no | |
1181 | .I tag | |
1182 | will reuse the previous tag. | |
1183 | .FE | |
1184 | .IP | |
1185 | The tags file is normally created by a program such as | |
1186 | .I ctags, | |
1187 | and consists of a number of lines with three fields separated by blanks | |
1188 | or tabs. The first field gives the name of the tag, | |
1189 | the second the name of the file where the tag resides, and the third | |
1190 | gives an addressing form which can be used by the editor to find the tag; | |
1191 | this field is usually a contextual scan using `/\fIpat\fR/' to be immune | |
1192 | to minor changes in the file. Such scans are always performed as if | |
1193 | .I nomagic | |
1194 | was set. | |
1195 | .PP | |
1196 | The tag names in the tags file are required to be sorted alphabetically. | |
1197 | .LC | |
1198 | \fBundo\fR abbr: \fBu\fR | |
1199 | .ZP | |
1200 | Reverses the changes made in the buffer by the last | |
1201 | buffer editing command. | |
1202 | Note that | |
1203 | .I global | |
1204 | commands are considered a single command for the purpose of | |
1205 | .I undo | |
1206 | (as are | |
1207 | .I open | |
1208 | and | |
1209 | .I visual.) | |
1210 | Also, the commands | |
1211 | .I write | |
1212 | and | |
1213 | .I edit | |
1214 | which interact with the | |
1215 | file system cannot be undone. | |
1216 | .I Undo | |
1217 | is its own inverse. | |
1218 | .IP | |
1219 | .I Undo | |
1220 | always marks the previous value of the current line `\fB.\fR' | |
1221 | as `\'\''. | |
1222 | After an | |
1223 | .I undo | |
1224 | the current line is the first line restored | |
1225 | or the line before the first line deleted if no lines were restored. | |
1226 | For commands with more global effect | |
1227 | such as | |
1228 | .I global | |
1229 | and | |
1230 | .I visual | |
1231 | the current line regains it pre-command value after an | |
1232 | .I undo. | |
1233 | .LC | |
1234 | \fBunmap\fR \fIlhs\fR | |
1235 | .ZP | |
1236 | The macro expansion associated by | |
1237 | .I map | |
1238 | for | |
1239 | .I lhs | |
1240 | is removed. | |
1241 | .LC | |
1242 | ( 1 , $ ) \fBv\fR /\fIpat\fR\|/ \fIcmds\fR | |
1243 | .ZP | |
1244 | A synonym for the | |
1245 | .I global | |
1246 | command variant \fBg!\fR, running the specified \fIcmds\fR on each | |
1247 | line which does not match \fIpat\fR. | |
1248 | .LC | |
1249 | \fBversion\fR abbr: \fBve\fR | |
1250 | .ZP | |
1251 | Prints the current version number of the editor | |
1252 | as well as the date the binary was created. | |
1253 | .LC | |
1254 | ( \fB.\fR ) \fBvisual\fR \fItype\fR \fIcount\fR \fIflags\fR abbr: \fBvi\fR | |
1255 | .ZP | |
1256 | Enters visual mode at the specified line. | |
1257 | .I Type | |
1258 | is optional and may be `\-' , `\(ua' or `\fB.\fR' | |
1259 | as in the | |
1260 | .I z | |
1261 | command to specify the placement of the specified line on the screen. | |
1262 | By default, if | |
1263 | .I type | |
1264 | is omitted, the specified line is placed as the first on the screen. | |
1265 | A | |
1266 | .I count | |
1267 | specifies an initial window size; the default is the value of the option | |
1268 | .I window. | |
1269 | See the document | |
1270 | .I "An Introduction to Display Editing with Vi" | |
1271 | for more details. | |
1272 | .LC | |
1273 | ( 1 , $ ) \fBwrite\fR \fIfile\fR abbr: \fBw\fR | |
1274 | .ZP | |
1275 | Writes changes made back to \fIfile\fR, printing the number of lines and | |
1276 | characters written. | |
1277 | Normally \fIfile\fR is omitted and the text goes back where it came from. | |
1278 | If a \fIfile\fR is specified, then text will be written to that file.* | |
1279 | .FS | |
1280 | * The editor writes to a file only if it is | |
1281 | the current file and is | |
1282 | .I edited , | |
1283 | if the file does not exist, | |
1284 | or if the file is actually a teletype, | |
1285 | .I /dev/tty, | |
1286 | .I /dev/null. | |
1287 | Otherwise, you must give the variant form \fBw!\fR to force the write. | |
1288 | .FE | |
1289 | If the file does not exist it is created. | |
1290 | The current file name is changed only if there is no current file | |
1291 | name; the current line is never changed. | |
1292 | .IP | |
1293 | If an error occurs while writing the current and | |
1294 | .I edited | |
1295 | file, the editor | |
1296 | considers that there has been ``No write since last change'' | |
1297 | even if the buffer had not previously been modified. | |
1298 | .LC | |
1299 | ( 1 , $ ) \fBwrite>>\fR \fIfile\fR abbr: \fBw>>\fR | |
1300 | .ZP | |
1301 | Writes the buffer contents at the end of | |
1302 | an existing file. | |
1303 | .IP | |
1304 | .LC | |
1305 | \fBw!\fR \fIname\fR | |
1306 | .ZP | |
1307 | Overrides the checking of the normal \fIwrite\fR command, | |
1308 | and will write to any file which the system permits. | |
1309 | .LC | |
1310 | ( 1 , $ ) \fBw\fR \fB!\fR\fIcommand\fR | |
1311 | .ZP | |
1312 | Writes the specified lines into | |
1313 | .I command. | |
1314 | Note the difference between \fBw!\fR which overrides checks and | |
1315 | \fBw\ \ !\fR which writes to a command. | |
1316 | .LC | |
1317 | \fBwq\fR \fIname\fR | |
1318 | .ZP | |
1319 | Like a \fIwrite\fR and then a \fIquit\fR command. | |
1320 | .LC | |
1321 | \fBwq!\fR \fIname\fR | |
1322 | .ZP | |
1323 | The variant overrides checking on the sensibility of the | |
1324 | .I write | |
1325 | command, as \fBw!\fR does. | |
1326 | .LC | |
1327 | ( \fB.\fR , \fB.\fR )\|\fByank\fR \fIbuffer\fR \fIcount\fR abbr: \fBya\fR | |
1328 | .ZP | |
1329 | Places the specified lines in the named | |
1330 | .I buffer, | |
1331 | for later retrieval via | |
1332 | .I put. | |
1333 | If no buffer name is specified, the lines go to a more volatile place; | |
1334 | see the \fIput\fR command description. | |
1335 | .LC | |
1336 | ( \fB.+1\fR ) \fBz\fR \fIcount\fR | |
1337 | .ZP | |
1338 | Print the next \fIcount\fR lines, default \fIwindow\fR. | |
1339 | .LC | |
1340 | ( \fB.\fR ) \fBz\fR \fItype\fR \fIcount\fR | |
1341 | .ZP | |
1342 | Prints a window of text with the specified line at the top. | |
1343 | If \fItype\fR is `\-' the line is placed at the bottom; a `\fB.\fR' causes | |
1344 | the line to be placed in the center.* | |
1345 | A count gives the number of lines to be displayed rather than | |
1346 | the number specified by the \fIwindow\fR option. | |
1347 | On a \s-2CRT\s0 the screen is cleared before display begins unless a | |
1348 | count which is less than the screen size is given. | |
1349 | The current line is left at the last line printed. | |
1350 | .FS | |
1351 | * Forms `z=' and `z\(ua' also exist; `z=' places the current line in the | |
1352 | center, surrounds it with lines of `\-' characters and leaves the current | |
1353 | line at this line. The form `z\(ua' prints the window before `z\-' | |
1354 | would. The characters `+', `\(ua' and `\-' may be repeated for cumulative | |
1355 | effect. | |
1356 | .FE | |
1357 | .LC | |
1358 | \fB!\fR \fIcommand\fR\fR | |
1359 | .ZP | |
1360 | The remainder of the line after the `!' character is sent to a shell | |
1361 | to be executed. | |
1362 | Within the text of | |
1363 | .I command | |
1364 | the characters | |
1365 | `%' and `#' are expanded as in filenames and the character | |
1366 | `!' is replaced with the text of the previous command. | |
1367 | Thus, in particular, | |
1368 | `!!' repeats the last such shell escape. | |
1369 | If any such expansion is performed, the expanded line will be echoed. | |
1370 | The current line is unchanged by this command. | |
1371 | .IP | |
1372 | If there has been ``[No\ write]'' of the buffer contents since the last | |
1373 | change to the editing buffer, then a diagnostic will be printed | |
1374 | before the command is executed as a warning. | |
1375 | A single `!' is printed when the command completes. | |
1376 | .LC | |
1377 | ( \fIaddr\fR , \fIaddr\fR ) \fB!\fR \fIcommand\fR\fR | |
1378 | .ZP | |
1379 | Takes the specified address range and supplies it as | |
1380 | standard input to | |
1381 | .I command; | |
1382 | the resulting output then replaces the input lines. | |
1383 | .LC | |
1384 | ( $ ) \fB=\fR | |
1385 | .ZP | |
1386 | Prints the line number of the | |
1387 | addressed line. | |
1388 | The current line is unchanged. | |
1389 | .KS | |
1390 | .LC | |
1391 | ( \fB.\fR , \fB.\fR ) \fB>\fR \fIcount\fR \fIflags\fR | |
1392 | .br | |
1393 | ( \fB.\fR , \fB.\fR ) \fB<\fR \fIcount\fR \fIflags\fR | |
1394 | .IP | |
1395 | Perform intelligent shifting on the specified lines; | |
1396 | \fB<\fR shifts left and \fB>\fR shift right. | |
1397 | The quantity of shift is determined by the | |
1398 | .I shiftwidth | |
1399 | option and the repetition of the specification character. | |
1400 | Only white space (blanks and tabs) is shifted; | |
1401 | no non-white characters are discarded in a left-shift. | |
1402 | The current line becomes the last line which changed due to the | |
1403 | shifting. | |
1404 | .KE | |
1405 | .LC | |
1406 | \fB^D\fR | |
1407 | .ZP | |
1408 | An end-of-file from a terminal input scrolls through the file. | |
1409 | The | |
1410 | .I scroll | |
1411 | option specifies the size of the scroll, normally a half screen of text. | |
1412 | .LC | |
1413 | ( \fB.\fR+1 , \fB.\fR+1 ) | |
1414 | .br | |
1415 | ( \fB.\fR+1 , \fB.\fR+1 ) | | |
1416 | .ZP | |
1417 | An address alone causes the addressed lines to be printed. | |
1418 | A blank line prints the next line in the file. | |
1419 | .LC | |
1420 | ( \fB.\fR , \fB.\fR ) \fB&\fR \fIoptions\fR \fIcount\fR \fIflags\fR | |
1421 | .ZP | |
1422 | Repeats the previous | |
1423 | .I substitute | |
1424 | command. | |
1425 | .LC | |
1426 | ( \fB.\fR , \fB.\fR ) \fB\s+2~\s0\fR \fIoptions\fR \fIcount\fR \fIflags\fR | |
1427 | .ZP | |
1428 | Replaces the previous regular expression with the previous | |
1429 | replacement pattern from a substitution. | |
1430 | .NH 1 | |
1431 | Regular expressions and substitute replacement patterns | |
1432 | .NH 2 | |
1433 | Regular expressions | |
1434 | .PP | |
1435 | A regular expression specifies a set of strings of characters. | |
1436 | A member of this set of strings is said to be | |
1437 | .I matched | |
1438 | by the regular expression. | |
1439 | .I Ex | |
1440 | remembers two previous regular expressions: | |
1441 | the previous regular expression used in a | |
1442 | .I substitute | |
1443 | command | |
1444 | and the previous regular expression used elsewhere | |
1445 | (referred to as the previous \fIscanning\fR regular expression.) | |
1446 | The previous regular expression | |
1447 | can always be referred to by a null \fIre\fR, e.g. `//' or `??'. | |
1448 | .NH 2 | |
1449 | Magic and nomagic | |
1450 | .PP | |
1451 | The regular expressions allowed by | |
1452 | .I ex | |
1453 | are constructed in one of two ways depending on the setting of | |
1454 | the | |
1455 | .I magic | |
1456 | option. | |
1457 | The | |
1458 | .I ex | |
1459 | and | |
1460 | .I vi | |
1461 | default setting of | |
1462 | .I magic | |
1463 | gives quick access to a powerful set of regular expression | |
1464 | metacharacters. | |
1465 | The disadvantage of | |
1466 | .I magic | |
1467 | is that the user must remember that these metacharacters are | |
1468 | .I magic | |
1469 | and precede them with the character `\e' | |
1470 | to use them as ``ordinary'' characters. | |
1471 | With | |
1472 | .I nomagic, | |
1473 | the default for | |
1474 | .I edit, | |
1475 | regular expressions are much simpler, | |
1476 | there being only two metacharacters. | |
1477 | The power of the other metacharacters is still available by preceding | |
1478 | the (now) ordinary character with a `\e'. | |
1479 | Note that `\e' is thus always a metacharacter. | |
1480 | .PP | |
1481 | The remainder of the discussion of regular expressions assumes | |
1482 | that | |
1483 | that the setting of this option is | |
1484 | .I magic.\(dg | |
1485 | .FS | |
1486 | \(dg To discern what is true with | |
1487 | .I nomagic | |
1488 | it suffices to remember that the only | |
1489 | special characters in this case will be `\(ua' at the beginning | |
1490 | of a regular expression, | |
1491 | `$' at the end of a regular expression, | |
1492 | and `\e'. | |
1493 | With | |
1494 | .I nomagic | |
1495 | the characters `\s+2~\s0' and `&' also lose their special meanings | |
1496 | related to the replacement pattern of a substitute. | |
1497 | .FE | |
1498 | .NH 2 | |
1499 | Basic regular expression summary | |
1500 | .PP | |
1501 | The following basic constructs are used to construct | |
1502 | .I magic | |
1503 | mode regular expressions. | |
1504 | .IP \fIchar\fR 15 | |
1505 | An ordinary character matches itself. | |
1506 | The characters `\(ua' at the beginning of a line, | |
1507 | `$' at the end of line, | |
1508 | `*' as any character other than the first, | |
1509 | `.', `\e', `[', and `\s+2~\s0' are not ordinary characters and | |
1510 | must be escaped (preceded) by `\e' to be treated as such. | |
1511 | .IP \fB\(ua\fR | |
1512 | At the beginning of a pattern | |
1513 | forces the match to succeed only at the beginning of a line. | |
1514 | .IP \fB$\fR | |
1515 | At the end of a regular expression forces the match to | |
1516 | succeed only at the end of the line. | |
1517 | .IP \&\fB.\fR | |
1518 | Matches any single character except | |
1519 | the new-line character. | |
1520 | .IP \fB\e<\fR | |
1521 | Forces the match | |
1522 | to occur only at the beginning of a ``variable'' or ``word''; | |
1523 | that is, either at the beginning of a line, or just before | |
1524 | a letter, digit, or underline and after a character not one of | |
1525 | these. | |
1526 | .IP \fB\e>\fR | |
1527 | Similar to `\e<', but matching the end of a ``variable'' | |
1528 | or ``word'', i.e. either the end of the line or before character | |
1529 | which is neither a letter, nor a digit, nor the underline character. | |
1530 | .IP \fB[\fIstring\fR]\fR | |
1531 | Matches any (single) character in the class defined by | |
1532 | .I string. | |
1533 | Most characters in | |
1534 | .I string | |
1535 | define themselves. | |
1536 | A pair of characters separated by `\-' in | |
1537 | .I string | |
1538 | defines the set of characters collating between the specified lower and upper | |
1539 | bounds, thus `[a\-z]' as a regular expression matches | |
1540 | any (single) lower-case letter. | |
1541 | If the first character of | |
1542 | .I string | |
1543 | is an `\(ua' then the construct | |
1544 | matches those characters which it otherwise would not; | |
1545 | thus `[\(uaa\-z]' matches anything but a lower-case letter (and of course a | |
1546 | newline). | |
1547 | To place any of the characters | |
1548 | `\(ua', `[', or `\-' in | |
1549 | .I string | |
1550 | you must escape them with a preceding `\e'. | |
1551 | .NH 2 | |
1552 | Combining regular expression primitives | |
1553 | .PP | |
1554 | The concatenation of two regular expressions matches the leftmost and | |
1555 | then longest string | |
1556 | which can be divided with the first piece matching the first regular | |
1557 | expression and the second piece matching the second. | |
1558 | Any of the (single character matching) regular expressions mentioned | |
1559 | above may be followed by the character `*' to form a regular expression | |
1560 | which matches any number of adjacent occurrences (including 0) of characters | |
1561 | matched by the regular expression it follows. | |
1562 | .PP | |
1563 | The character `\s+2~\s0' may be used in a regular expression, | |
1564 | and matches the text which defined the replacement part | |
1565 | of the last | |
1566 | .I substitute | |
1567 | command. | |
1568 | A regular expression may be enclosed between the sequences | |
1569 | `\e(' and `\e)' with side effects in the | |
1570 | .I substitute | |
1571 | replacement patterns. | |
1572 | .NH 2 | |
1573 | Substitute replacement patterns | |
1574 | .PP | |
1575 | The basic metacharacters for the replacement pattern are | |
1576 | `&' and `~'; these are | |
1577 | given as `\e&' and `\e~' when | |
1578 | .I nomagic | |
1579 | is set. | |
1580 | Each instance of `&' is replaced by the characters | |
1581 | which the regular expression matched. | |
1582 | The metacharacter `~' stands, in the replacement pattern, | |
1583 | for the defining text of the previous replacement pattern. | |
1584 | .PP | |
1585 | Other metasequences possible in the replacement pattern | |
1586 | are always introduced by the escaping character `\e'. | |
1587 | The sequence `\e\fIn\fR' is replaced by the text matched | |
1588 | by the \fIn\fR-th regular subexpression enclosed between | |
1589 | `\e(' and `\e)'.\(dg | |
1590 | .FS | |
1591 | \(dg When nested, parenthesized subexpressions are present, | |
1592 | \fIn\fR is determined by counting occurrences of `\e(' starting from the left. | |
1593 | .FE | |
1594 | The sequences `\eu' and `\el' cause the immediately following character in | |
1595 | the replacement to be converted to upper- or lower-case respectively | |
1596 | if this character is a letter. | |
1597 | The sequences `\eU' and `\eL' turn such conversion on, either until | |
1598 | `\eE' or `\ee' is encountered, or until the end of the replacement pattern. | |
1599 | .de LC | |
1600 | .br | |
1601 | .sp .1i | |
1602 | .ne 4 | |
1603 | .LP | |
1604 | .ta 3.65i | |
1605 | .. | |
1606 | .NH 1 | |
1607 | Option descriptions | |
1608 | .PP | |
1609 | .LC | |
1610 | \fBautoindent\fR, \fBai\fR default: noai | |
1611 | .ZP | |
1612 | Can be used to ease the preparation of structured program text. | |
1613 | At the beginning of each | |
1614 | .I append , | |
1615 | .I change | |
1616 | or | |
1617 | .I insert | |
1618 | command | |
1619 | or when a new line is | |
1620 | .I opened | |
1621 | or created by an | |
1622 | .I append , | |
1623 | .I change , | |
1624 | .I insert , | |
1625 | or | |
1626 | .I substitute | |
1627 | operation within | |
1628 | .I open | |
1629 | or | |
1630 | .I visual | |
1631 | mode, | |
1632 | .I ex | |
1633 | looks at the line being appended after, | |
1634 | the first line changed | |
1635 | or the line inserted before and calculates the amount of white space | |
1636 | at the start of the line. | |
1637 | It then aligns the cursor at the level of indentation so determined. | |
1638 | .IP | |
1639 | If the user then types lines of text in, | |
1640 | they will continue to be justified at the displayed indenting level. | |
1641 | If more white space is typed at the beginning of a line, | |
1642 | the following line will start aligned with the first non-white character | |
1643 | of the previous line. | |
1644 | To back the cursor up to the preceding tab stop one can hit | |
1645 | \fB^D\fR. | |
1646 | The tab stops going backwards are defined at multiples of the | |
1647 | .I shiftwidth | |
1648 | option. | |
1649 | You | |
1650 | .I cannot | |
1651 | backspace over the indent, | |
1652 | except by sending an end-of-file with a \fB^D\fR. | |
1653 | .IP | |
1654 | Specially processed in this mode is a line with no characters added | |
1655 | to it, which turns into a completely blank line (the white | |
1656 | space provided for the | |
1657 | .I autoindent | |
1658 | is discarded.) | |
1659 | Also specially processed in this mode are lines beginning with | |
1660 | an `\(ua' and immediately followed by a \fB^D\fR. | |
1661 | This causes the input to be repositioned at the beginning of the line, | |
1662 | but retaining the previous indent for the next line. | |
1663 | Similarly, a `0' followed by a \fB^D\fR | |
1664 | repositions at the beginning but without | |
1665 | retaining the previous indent. | |
1666 | .IP | |
1667 | .I Autoindent | |
1668 | doesn't happen in | |
1669 | .I global | |
1670 | commands or when the input is not a terminal. | |
1671 | .LC | |
1672 | \fBautoprint\fR, \fBap\fR default: ap | |
1673 | .ZP | |
1674 | Causes the current line to be printed after each | |
1675 | .I delete , | |
1676 | .I copy , | |
1677 | .I join , | |
1678 | .I move , | |
1679 | .I substitute , | |
1680 | .I t , | |
1681 | .I undo | |
1682 | or | |
1683 | shift command. | |
1684 | This has the same effect as supplying a trailing `p' | |
1685 | to each such command. | |
1686 | .I Autoprint | |
1687 | is suppressed in globals, | |
1688 | and only applies to the last of many commands on a line. | |
1689 | .LC | |
1690 | \fBautowrite\fR, \fBaw\fR default: noaw | |
1691 | .ZP | |
1692 | Causes the contents of the buffer to be written to the current file | |
1693 | if you have modified it and give a | |
1694 | .I next, | |
1695 | .I tag, | |
1696 | or | |
1697 | .I ! | |
1698 | command, or a \fB^\(ua\fR (switch files) or \fB^]\fR (tag goto) command | |
1699 | in | |
1700 | .I visual. | |
1701 | Note, that the | |
1702 | .I edit | |
1703 | and | |
1704 | .I ex | |
1705 | commands do | |
1706 | .B not | |
1707 | autowrite. | |
1708 | In each case, there is an equivalent way of switching when autowrite | |
1709 | is set to avoid the | |
1710 | .I autowrite | |
1711 | (\fIedit\fR | |
1712 | for | |
1713 | .I next, | |
1714 | .I tag! | |
1715 | for | |
1716 | .I tag, | |
1717 | .I shell | |
1718 | for | |
1719 | .I !, | |
1720 | and | |
1721 | \fB:e\ #\fR and a \fB:ta!\fR command from within | |
1722 | .I visual). | |
1723 | .LC | |
1724 | \fBbeautify\fR, \fBbf\fR default: nobeautify | |
1725 | .ZP | |
1726 | Causes all control characters except tab, newline and form-feed | |
1727 | to be discarded from the input. | |
1728 | A complaint is registered the first time a | |
1729 | backspace character is discarded. | |
1730 | .I Beautify | |
1731 | does not apply to command input. | |
1732 | .LC | |
1733 | \fBdirectory\fR, \fBdir\fR default: dir=/tmp | |
1734 | .ZP | |
1735 | Specifies the directory in which | |
1736 | .I ex | |
1737 | places its buffer file. | |
1738 | If this directory in not | |
1739 | writable, then the editor will exit abruptly when it fails to be | |
1740 | able to create its buffer there. | |
1741 | .LC | |
1742 | \fBedcompatible\fR default: noedcompatible | |
1743 | .ZP | |
1744 | Causes the presence of absence of | |
1745 | .B g | |
1746 | and | |
1747 | .B c | |
1748 | suffixes on substitute commands to be remembered, and to be toggled | |
1749 | by repeating the suffices. The suffix | |
1750 | .B r | |
1751 | makes the substitution be as in the | |
1752 | .I ~ | |
1753 | command, instead of like | |
1754 | .I &. | |
1755 | .LC | |
1756 | \fBerrorbells\fR, \fBeb\fR default: eb | |
1757 | .ZP | |
1758 | Error messages are preceded by a bell.* | |
1759 | .FS | |
1760 | * Bell ringing in | |
1761 | .I open | |
1762 | and | |
1763 | .I visual | |
1764 | on errors is not suppressed by setting | |
1765 | .I noeb. | |
1766 | .FE | |
1767 | If possible the editor always places the error message in a standout mode of the | |
1768 | terminal (such as inverse video) instead of ringing the bell. | |
1769 | .LC | |
1770 | \fBhardtabs\fR, \fBht\fR default: ht=8 | |
1771 | .ZP | |
1772 | Gives the boundaries on which terminal hardware tabs are set (or | |
1773 | on which the system expands tabs). | |
1774 | .LC | |
1775 | \fBignorecase\fR, \fBic\fR default: noic | |
1776 | .ZP | |
1777 | All upper case characters in the text are mapped to lower case in regular | |
1778 | expression matching. | |
1779 | In addition, all upper case characters in regular expressions are mapped | |
1780 | to lower case except in character class specifications. | |
1781 | .LC | |
1782 | \fBlisp\fR default: nolisp | |
1783 | .ZP | |
1784 | \fIAutoindent\fR indents appropriately for | |
1785 | .I lisp | |
1786 | code, and the \fB( ) { } [[\fR and \fB]]\fR commands in | |
1787 | .I open | |
1788 | and | |
1789 | .I visual | |
1790 | are modified to have meaning for \fIlisp\fR. | |
1791 | .LC | |
1792 | \fBlist\fR default: nolist | |
1793 | .ZP | |
1794 | All printed lines will be displayed (more) unambiguously, | |
1795 | showing tabs and end-of-lines as in the | |
1796 | .I list | |
1797 | command. | |
1798 | .LC | |
1799 | \fBmagic\fR default: magic for \fIex\fR and \fIvi\fR\(dg | |
1800 | .FS | |
1801 | \(dg \fINomagic\fR for \fIedit\fR. | |
1802 | .FE | |
1803 | .ZP | |
1804 | If | |
1805 | .I nomagic | |
1806 | is set, the number of regular expression metacharacters is greatly reduced, | |
1807 | with only `\(ua' and `$' having special effects. | |
1808 | In addition the metacharacters | |
1809 | `~' | |
1810 | and | |
1811 | `&' | |
1812 | of the replacement pattern are treated as normal characters. | |
1813 | All the normal metacharacters may be made | |
1814 | .I magic | |
1815 | when | |
1816 | .I nomagic | |
1817 | is set by preceding them with a `\e'. | |
1818 | .LC | |
1819 | \fBmapinput, mi\fR default: nomi | |
1820 | .ZP | |
1821 | Causes macros to be expanded during input within | |
1822 | .I visual | |
1823 | (text insertion mode) as well as in the command mode of | |
1824 | .I visual. | |
1825 | .LC | |
1826 | \fBnumber, nu\fR default: nonumber | |
1827 | .ZP | |
1828 | Causes all output lines to be printed with their | |
1829 | line numbers. | |
1830 | In addition each input line will be prompted for by supplying the line number | |
1831 | it will have. | |
1832 | .LC | |
1833 | \fBopen\fR default: open | |
1834 | .ZP | |
1835 | If \fInoopen\fR, the commands | |
1836 | .I open | |
1837 | and | |
1838 | .I visual | |
1839 | are not permitted. | |
1840 | This is set for | |
1841 | .I edit | |
1842 | to prevent confusion resulting from accidental entry to | |
1843 | open or visual mode. | |
1844 | .LC | |
1845 | \fBoptimize, opt\fR default: optimize | |
1846 | .ZP | |
1847 | Throughput of text is expedited by setting the terminal | |
1848 | to not do automatic carriage returns | |
1849 | when printing more than one (logical) line of output. | |
1850 | greatly speeding output on terminals without addressable | |
1851 | cursors when text with leading white space is printed. | |
1852 | .LC | |
1853 | \fBparagraphs,\ para\fR default: para=IPLPPPQPP\0LIbp | |
1854 | .ZP | |
1855 | Specifies the paragraphs for the \fB{\fR and \fB}\fR operations in | |
1856 | .I open | |
1857 | and | |
1858 | .I visual. | |
1859 | The pairs of characters in the option's value are the names | |
1860 | of the macros which start paragraphs. | |
1861 | .LC | |
1862 | \fBprompt\fR default: prompt | |
1863 | .ZP | |
1864 | Command mode input is prompted for with a `:'. | |
1865 | .LC | |
1866 | \fBredraw\fR default: noredraw | |
1867 | .ZP | |
1868 | The editor simulates (using great amounts of output), an intelligent | |
1869 | terminal on a dumb terminal (e.g. during insertions in | |
1870 | .I visual | |
1871 | the characters to the right of the cursor position are refreshed | |
1872 | as each input character is typed.) | |
1873 | Useful only at very high speed. | |
1874 | .LC | |
1875 | \fBreport\fR default: report=5\(dg | |
1876 | .FS | |
1877 | \(dg 2 for \fIedit\fR. | |
1878 | .FE | |
1879 | .ZP | |
1880 | Specifies a threshold for feedback from commands. | |
1881 | Any command which modifies more than the specified number of lines | |
1882 | will provide feedback as to the scope of its changes. | |
1883 | For commands such as | |
1884 | .I global , | |
1885 | .I open , | |
1886 | .I undo , | |
1887 | and | |
1888 | .I visual | |
1889 | which have potentially more far reaching scope, | |
1890 | the net change in the number of lines in the buffer is | |
1891 | presented at the end of the command, subject to this same threshold. | |
1892 | Thus notification is suppressed during a | |
1893 | .I global | |
1894 | command on the individual commands performed. | |
1895 | .LC | |
1896 | \fBscroll\fR default: scroll=12 | |
1897 | .ZP | |
1898 | Determines the number of logical lines scrolled when an end-of-file | |
1899 | is received from a terminal input. | |
1900 | .LC | |
1901 | \fBsections\fR default: sections=SHNHH\0HU | |
1902 | .ZP | |
1903 | Specifies the section macros for the \fB[[\fR and \fB]]\fR operations | |
1904 | in | |
1905 | .I open | |
1906 | and | |
1907 | .I visual. | |
1908 | The pairs of characters in the options's value are the names | |
1909 | of the macros which start paragraphs. | |
1910 | .LC | |
1911 | \fBshell\fR, \fBsh\fR default: sh=/bin/sh | |
1912 | .ZP | |
1913 | Gives the path name of the shell forked for | |
1914 | the shell escape command `!', and by the | |
1915 | .I shell | |
1916 | command. | |
1917 | .LC | |
1918 | \fBshiftwidth\fR, \fBsw\fR default: sw=8 | |
1919 | .ZP | |
1920 | Gives the width a software tab stop, | |
1921 | used in reverse tabbing with \fB^D\fR when using | |
1922 | .I autoindent | |
1923 | to append text, | |
1924 | and by the shift commands. | |
1925 | .LC | |
1926 | \fBshowmatch, sm\fR default: nosm | |
1927 | .ZP | |
1928 | In | |
1929 | .I open | |
1930 | and | |
1931 | .I visual | |
1932 | mode, when a \fB)\fR or \fB}\fR is typed, move the cursor to the matching | |
1933 | \fB(\fR or \fB{\fR for one second if this matching character is on the | |
1934 | screen. Extremely useful with | |
1935 | .I lisp. | |
1936 | .LC | |
1937 | \fBslowopen, slow\fR terminal dependent | |
1938 | .ZP | |
1939 | Affects the display algorithm used in | |
1940 | .I visual | |
1941 | mode, holding off display updating during input of new text to improve | |
1942 | throughput when the terminal in use is both slow and unintelligent. | |
1943 | See | |
1944 | .I "An Introduction to Display Editing with Vi" | |
1945 | for more details. | |
1946 | .LC | |
1947 | \fBtabstop,\ ts\fR default: ts=8 | |
1948 | .ZP | |
1949 | The editor expands tabs in the input file to be on | |
1950 | .I tabstop | |
1951 | boundaries for the purposes of display. | |
1952 | .LC | |
1953 | \fBterm\fR from environment | |
1954 | .ZP | |
1955 | The terminal type of the output device. | |
1956 | .LC | |
1957 | \fBterse\fR default: noterse | |
1958 | .ZP | |
1959 | Shorter error diagnostics are produced for the experienced user. | |
1960 | .LC | |
1961 | \fBwarn\fR default: warn | |
1962 | .ZP | |
1963 | Warn if there has been `[No write since last change]' before a `!' | |
1964 | command escape. | |
1965 | .LC | |
1966 | \fBwindow\fR default: window=23 | |
1967 | .ZP | |
1968 | The number of lines in a text window for the | |
1969 | .I z | |
1970 | and | |
1971 | .I visual | |
1972 | commands. | |
1973 | .LC | |
1974 | \fBwrapscap\fR, \fBws\fR default: ws | |
1975 | .ZP | |
1976 | Searches using the regular expressions in addressing | |
1977 | will wrap around past the end of the file. | |
1978 | .LC | |
1979 | \fBwrapmargin\fR, \fBwm\fR default: wm=0 | |
1980 | .ZP | |
1981 | Defines a margin for automatic wrapover of text during input in | |
1982 | .I open | |
1983 | and | |
1984 | .I visual | |
1985 | modes. See | |
1986 | .I "An Introduction to Text Editing with Vi" | |
1987 | for details. | |
1988 | .LC | |
1989 | \fBwriteany\fR, \fBwa\fR default: nowa | |
1990 | .IP | |
1991 | Inhibit the checks normally made before | |
1992 | .I write | |
1993 | commands, allowing a write to any file which the system protection | |
1994 | mechanism will allow. | |
1995 | .NH 1 | |
1996 | Limitations | |
1997 | .PP | |
1998 | Editor limits that the user is likely to encounter are as follows: | |
1999 | 1024 characters per line, | |
2000 | 256 characters per global command list, | |
2001 | 128 characters per file name, | |
2002 | 128 characters in the previous inserted and deleted text in | |
2003 | .I open | |
2004 | or | |
2005 | .I visual, | |
2006 | 100 characters in a shell escape command, | |
2007 | 30 characters in a string valued option, | |
2008 | and 30 characters in a tag name, and | |
2009 | a limit of 250000 lines in the file is silently enforced. | |
2010 | .PP | |
2011 | The | |
2012 | .I visual | |
2013 | implementation limits the number of macros defined with map to | |
2014 | 32, and the total number of characters in macros to be less than 512. | |
2015 | .LP | |
2016 | .LP | |
2017 | .I Acknowledgments. | |
2018 | Chuck Haley contributed greatly to the early development of | |
2019 | .I ex. | |
2020 | Bruce Englar encouraged the redesign which led to | |
2021 | .I ex | |
2022 | version 1. | |
2023 | Mark Horton has added a number of features to | |
2024 | .I ex | |
2025 | and is currently maintaining | |
2026 | .I ex | |
2027 | versions 2.9 and 3.1. |