home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / unix / riscbsd / 1_1_contri / usd / 16_ex / ex_rm next >
Encoding:
Text File  |  1986-05-31  |  56.8 KB  |  2,204 lines

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