home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / bsd_srcs / share / doc / usd / 16.ex / ex.rm next >
Encoding:
Text File  |  1991-04-17  |  58.4 KB  |  2,231 lines

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