home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 365_01 / ex.ms < prev    next >
Text File  |  1992-04-06  |  17KB  |  525 lines

  1. .Go 3 "COLON MODE COMMANDS"
  2. .ID
  3. .ps
  4. .in 0.8i
  5. .ta 2i 3.i
  6. .\" NOTE: The following macro is used to output a single line of the
  7. .\" command chart.  Its usage is:
  8. .\"
  9. .\"        .Cm <linespecs> <name> <arguments>...
  10. .\"
  11. .de Cm
  12. .if "\\$1"0" \t\\$2\t\\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
  13. .if "\\$1"1" \s-2[line]\s+2\t\\$2\t\\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
  14. .if "\\$1"2" \s-2[line][,line]\s+2\t\\$2\t\\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
  15. ..
  16. .if t .ds Q ``
  17. .if t .ds U ''
  18. .if n .ds Q "
  19. .if n .ds U "
  20. \s+2LINES    COMMAND    ARGUMENTS\s-2
  21. .Cm 0 ab[br] [short] [expanded form]
  22. .Cm 1 a[ppend][!]
  23. .Cm 0 ar[gs] [files]
  24. .Cm 0 cc [files]
  25. .Cm 0 cd[!] [directory]
  26. .Cm 2 c[hange]
  27. .Cm 0 chd[ir][!] [directory]
  28. .Cm 2 co[py] line
  29. .Cm 0 col[or] [when] [[\*Qlight\*U] color] [\*Qon\*U color]
  30. .Cm 2 d[elete] [\*Ux]
  31. .Cm 0 dig[raph][!] [XX [Y]]
  32. .Cm 0 e[dit][!] [file]
  33. .Cm 0 er[rlist][!] [errlist]
  34. .Cm 0 f[ile] [file]
  35. .Cm 2 g[lobal] /regexp/ command
  36. .Cm 1 i[nsert]
  37. .Cm 2 j[oin][!]
  38. .Cm 2 l[ist]
  39. .Cm 0 mak[e] [target]
  40. .Cm 0 map[!] key mapped_to
  41. .Cm 1 ma[rk]  \*Ux
  42. .Cm 0 mk[exrc]
  43. .Cm 2 m[ove] line
  44. .Cm 0 n[ext][!] [files]
  45. .Cm 0 N[ext][!]
  46. .Cm 2 nu[mber]
  47. .Cm 2 p[rint]
  48. .Cm 1 pu[t] [\*Ux]
  49. .Cm 0 q[uit][!]
  50. .Cm 1 r[ead] file
  51. .Cm 0 rew[ind][!]
  52. .Cm 0 se[t] [options]
  53. .Cm 0 so[urce] file
  54. .Cm 2 s[ubstitute] /regexp/replacement/[p][g][c]
  55. .Cm 0 ta[g][!] tagname
  56. .Cm 0 una[bbr] [short]
  57. .Cm 0 u[ndo]
  58. .Cm 0 unm[ap][!] key
  59. .Cm 0 ve[rsion]
  60. .Cm 2 v[global] /regexp/ command
  61. .Cm 0 vi[sual] [filename]
  62. .Cm 0 wq 
  63. .Cm 2 w[rite][!] [[>>]file]
  64. .Cm 0 x[it][!]
  65. .Cm 2 y[ank] [\*Ux]
  66. .Cm 2 ! command
  67. .Cm 2 < 
  68. .Cm 2 = 
  69. .Cm 2 > 
  70. .Cm 2 & 
  71. .Cm 0 @ "" \*Ux
  72. .DE
  73. .TA
  74. .PP
  75. To use colon mode commands, you must switch from visual command
  76. mode to colon command mode.
  77. The visual mode commands to do this are ":" for a single colon command,
  78. or "Q" for many colon mode commands.
  79. .NH 2
  80. Line Specifiers
  81. .PP
  82. Line specifiers are always optional.
  83. The first line specifier of most commands usually defaults to the current line.
  84. The second line specifier usually defaults to be the same
  85. as the first line specifier.
  86. Exceptions are :write, :global, and :vglobal, which act on all lines of the
  87. file by default, and :!, which acts on no lines by default.
  88. .PP
  89. Line specifiers consist of an absolute part and a relative part.
  90. The absolute part of a line specifier may be either an explicit line number,
  91. a mark, a dot to denote the current line, a dollar sign to denote the last
  92. line of the file, or a forward or backward search.
  93. .PP
  94. An explicit line number is simply a decimal number, expressed as a
  95. string of digits.
  96. .PP
  97. A mark is typed in as an apostrophe followed by a letter.
  98. Marks must be set before they can be used.
  99. You can set a mark in visual command mode by typing "m" and a letter,
  100. or you can set it in colon command mode via the "mark" command.
  101. .PP
  102. A forward search is typed in as a regular expression surrounded by
  103. slash characters; searching begins at the default line.
  104. A backward search is typed in as a regular expression surrounded by
  105. question marks; searching begins at the line before the default line.
  106. .PP
  107. If you omit the absolute part, then the default line is used.
  108. .PP
  109. The relative part of a line specifier is typed as a "+" or "-" character
  110. followed by a decimal number.
  111. The number is added to or subtracted from the absolute part
  112. of the line specifier to produce the final line number.
  113. .PP
  114. As a special case, the % character may be used to specify all lines of the file.
  115. It is roughly equivelent to saying 1,$.
  116. This can be a handy shortcut.
  117. .PP
  118. Some examples:
  119. .LD
  120. .ps
  121. .ta 0.5i 1.8i
  122.     :p    print the current line
  123.     :37p    print line 37
  124.     :'gp    print the line which contains mark g
  125.     :/foo/p    print the next line that contains "foo"
  126.     :$p    print the last line of the file
  127.     :20,30p    print lines 20 through 30
  128.     :1,$p    print all lines of the file
  129.     :%p    print all lines of the file
  130.     :/foo/-2,+4p    print 5 lines around the next "foo"
  131. .TA
  132. .DE
  133. .NH 2
  134. Text Entry Commands
  135. .if n .ul 0
  136. .ID
  137. .ps
  138. [line] append
  139. [line][,line] change ["x]
  140. [line] insert
  141. .DE
  142. .PP
  143. The \fBa\fRppend command inserts text after the specified line.
  144. .PP
  145. The \fBi\fRnsert command inserts text before the specified line.
  146. .PP
  147. The \fBc\fRhange command copies the range of lines into a cut buffer,
  148. deletes them, and inserts new text where the old text used to be.
  149. .PP
  150. For all of these commands, you indicate the end of the text you're
  151. inserting by hitting ^D or by entering a line which contains only a
  152. period.
  153. .NH 2
  154. Cut & Paste Commands
  155. .if n .ul 0
  156. .ID
  157. .ps
  158. [line][,line] delete ["x]
  159. [line][,line] yank ["x]
  160. [line] put ["x]
  161. [line][,line] copy line
  162. [line][,line] to line
  163. [line][,line] move line
  164. .DE
  165. .PP
  166. The \fBd\fRelete command copies the specified range of lines into a
  167. cut buffer, and then deletes them.
  168. .PP
  169. The \fBy\fRank command copies the specified range of lines into a cut
  170. buffer, but does *not* delete them.
  171. .PP
  172. The \fBpu\fRt command inserts text from a cut buffer after the
  173. specified line.
  174. .PP
  175. The \fBco\fRpy and \fBt\fRo commands yank the specified range of lines and
  176. then immediately paste them after some other line.
  177. .PP
  178. The \fBm\fRove command deletes the specified range of lines and then
  179. immediately pastes them after some other line.
  180. If the destination line comes after the deleted text,
  181. then it will be adjusted automatically to account for the deleted lines.
  182. .NH 2
  183. Display Text Commands
  184. .if n .ul 0
  185. .ID
  186. .ps
  187. [line][,line] print
  188. [line][,line] list
  189. [line][,line] number
  190. .DE
  191. .PP
  192. The \fBp\fRrint command displays the specified range of lines.
  193. .PP
  194. The \fBnu\fRmber command displays the lines, with line numbers.
  195. .PP
  196. The \fBl\fRist command also displays them, but it is careful to make
  197. control characters visible.
  198. .NH 2
  199. Global Operations Commands
  200. .if n .ul 0
  201. .ID
  202. .ps
  203. [line][,line] global /regexp/ command
  204. [line][,line] vglobal /regexp/ command
  205. .DE
  206. .PP
  207. The \fBg\fRlobal command searches through the lines of the specified range
  208. (or through the whole file if no range is specified)
  209. for lines that contain a given regular expression.
  210. It then moves the cursor to each of these lines and
  211. runs some other command on them.
  212. .PP
  213. The \fBv\fRglobal command is similar, but it searches for lines that \fIdon't\fR
  214. contain the regular expression.
  215. .NH 2
  216. Line Editing Commands
  217. .if n .ul 0
  218. .ID
  219. .ps
  220. [line][,line] join[!]
  221. [line][,line] ! program
  222. [line][,line] <
  223. [line][,line] >
  224. [line][,line] substitute /regexp/replacement/[p][g][c]
  225. [line][,line] &
  226. .DE
  227. .PP
  228. The \fBj\fRoin command catenates all lines in the specified range together
  229. to form one big line.
  230. If only a single line is specified, then the following line is catenated
  231. onto it.
  232. The normal ":join" inserts one or two spaces between the lines;
  233. the ":join!" variation (with a '!') doesn't insert spaces.
  234. .PP
  235. The \fB!\fR command runs an external filter program,
  236. and feeds the specified range of lines to it's stdin.
  237. The lines are then replaced by the output of the filter.
  238. A typical example would be ":'a,'z!sort" to sort the lines 'a,'z.
  239. .PP
  240. The \fB<\fR and \fB>\fR commands shift the specified range of lines left or right,
  241. normally by the width of 1 tab character.
  242. The "shiftwidth" option determines the shifting amount.
  243. .PP
  244. The \fBs\fRubstitute command finds the regular expression in each line,
  245. and replaces it with the replacement text.
  246. The "p" option causes the altered lines to be printed.
  247. The "g" option permits all instances of the regular expression
  248. to be found & replaced.
  249. (Without "g", only the first occurrence in each line is replaced.)
  250. The "c" option asks for confirmation before each substitution.
  251. .PP
  252. The \fB&\fR command repeats the previous substitution command.
  253. Actually, "&" is equivelent to "s//~/" with the same options as last time.
  254. It searches for the last regular expression that you specified for any purpose,
  255. and replaces it with the the same text
  256. that was used in the previous substitution.
  257. .NH 2
  258. Undo Command
  259. .if n .ul 0
  260. .ID
  261. .ps
  262. undo
  263. .DE
  264. .PP
  265. The \fBu\fRndo command restores the file to the state it was in before
  266. your most recent command which changed text.
  267. .NH 2
  268. Configuration & Status Commands
  269. .if n .ul 0
  270. .ID
  271. .ps
  272. map[!] [key mapped_to]
  273. unmap[!] key
  274. abbr [word expanded_form_of_word]
  275. unabbr word
  276. digraph[!] [XX [Y]]
  277. set [options]
  278. mkexrc
  279. [line] mark "x
  280. visual
  281. version
  282. [line][,line] =
  283. file [file]
  284. source file
  285. @ "x
  286. color [when] [["light"] color] ["on" color]
  287. .DE
  288. .PP
  289. The \fBma\fRp command allows you to configure \*E to recognize your function keys,
  290. and treat them as though they transmitted some other sequence of characters.
  291. Normally this mapping is done only when in the visual command mode,
  292. but with the [!] present it will map keys under input and replace modes as well.
  293. When this command is given with no arguments,
  294. it prints a table showing all mappings currently in effect.
  295. When called with two arguments, the first is the sequence that your
  296. function key really sends, and the second is the sequence that you want
  297. \*E to treat it as having sent.
  298. As a special case, if the first argument is a number then \*E will map the
  299. corresponding function key;
  300. for example, ":map 7 dd" will cause the <F7> key to delete a line.
  301. .PP
  302. The \fBunm\fRap command removes key definitions that were made via the map command.
  303. .PP
  304. The \fBab\fRbr command is used to define/list a table of abbreviations.
  305. The table contains both the abbreviated form and the fully spelled-out form.
  306. When you're in visual input mode, and you type in the abbreviated form,
  307. \*E will replace the abbreviated form with the fully spelled-out form.
  308. When this command is called without arguments, it lists the table;
  309. with two or more arguments, the first argument is taken as the abbreviated
  310. form, and the rest of the command line is the fully-spelled out form.
  311. .PP
  312. The \fBuna\fRbbr command deletes entries from the abbr table.
  313. .PP
  314. The \fBdi\fRgraph command allows you to display the set of digraphs that \*E is
  315. using, or add/remove a digraph.
  316. To list the set of digraphs, use the digraph command with no arguments.
  317. To add a digraph, you should give the digraph command two arguments.
  318. The first argument is the two ASCII characters that are to be combined;
  319. the second is the non-ASCII character that they represent.
  320. The non-ASCII character's most significant bit is automatically set by the
  321. digraph command, unless to append a ! to the command name.
  322. Removal of a digraph is similar to adding a digraph, except that you should
  323. leave off the second argument.
  324. .PP
  325. The \fBse\fRt command allows you examine or set various options.
  326. With no arguments, it displays the values of options that have been changed.
  327. With the single argument "all" it displays the values of all options,
  328. regardless of whether they've been explicitly set or not.
  329. Otherwise, the arguments are treated as options to be set.
  330. .PP
  331. The \fBmk\fRexrc command saves the current configuration to a file
  332. called ".exrc" in the current directory.
  333. .PP
  334. The mar\fBk\fR command defines a named mark to refer to a specific place
  335. in the file.
  336. This mark may be used later to specify lines for other commands.
  337. .PP
  338. The \fBvi\fRsual command puts the editor into visual mode.
  339. Instead of emulating ex, \*E will start emulating vi.
  340. .PP
  341. The \fBve\fRrsion command tells you that what version of \*E this is.
  342. .PP
  343. The \fB=\fR command tells you what line you specified, or,
  344. if you specified a range of lines, it will tell you both endpoints and
  345. the number of lines included in the range.
  346. .PP
  347. The \fBf\fRile command tells you the name of the file,
  348. whether it has been modified,
  349. the number of lines in the file,
  350. and the current line number.
  351. You can also use it to change the name of the current file.
  352. .PP
  353. The \fBso\fRurce command reads a sequence of colon mode commands from a file,
  354. and interprets them.
  355. .PP
  356. The \fB@\fR command executes the contents of a cut-buffer as EX commands.
  357. .PP
  358. The \fBcol\fRor command only works under MS-DOS, or if you have an ANSI-compatible
  359. color terminal.
  360. It allows you to set the foreground and background colors
  361. for different types of text:
  362. normal, bold, italic, underlined, standout, pop-up menu, and visible selection.
  363. By default, it changes the "normal" colors;
  364. to change other colors, the first argument to the :color command should be
  365. the first letter of the type of text you want.
  366. The syntax for the colors themselves is fairly intuitive.
  367. For example, ":color light cyan on blue" causes normal text to be displayed
  368. in light cyan on a blue background, and
  369. ":color b bright white" causes bold text to be displayed in bright white on
  370. a blue background.
  371. The background color always defaults to the current background color of
  372. normal text.
  373. Your first :color command \fImust\fP specify both the foreground and background
  374. for normal text.
  375. .NH 2
  376. Multiple File Commands
  377. .if n .ul 0
  378. .ID
  379. .ps
  380. args [files]
  381. next[!] [files]
  382. Next[!]
  383. previous[!]
  384. rewind[!]
  385. .DE
  386. .PP
  387. When you invoke \*E from your shell's command line,
  388. any filenames that you give to \*E as arguments are stored in the args list.
  389. The \fBar\fRgs command will display this list, or define a new one.
  390. .PP
  391. The \fBn\fRext command switches from the current file to the next one
  392. in the args list.
  393. You may specify a new args list here, too.
  394. .PP
  395. The \fBN\fRext and \fBpre\fRvious commands
  396. (they're really aliases for the same command)
  397. switch from the current file to the preceding file in the args list.
  398. .PP
  399. The \fBrew\fRind command switches from the current file to the first file
  400. in the args list.
  401. .NH 2
  402. Switching Files
  403. .if n .ul 0
  404. .ID
  405. .ps
  406. edit[!] [file]
  407. tag[!] tagname
  408. .DE
  409. .PP
  410. The \fBe\fRdit command allows to switch from the current file to some other file.
  411. This has nothing to do with the args list, by the way.
  412. .PP
  413. The \fBta\fRg command looks up a given tagname in a file called "tags".
  414. This tells it which file the tag is in, and how to find it in that file.
  415. \*E then switches to the tag's file and finds the tag.
  416. .NH 2
  417. Working with a Compiler
  418. .if n .ul 0
  419. .ID
  420. .ps
  421. cc [files]
  422. make [target]
  423. errlist[!] [errlist]
  424. .DE
  425. .PP
  426. The \fBcc\fR and \fBmak\fRe commands execute your compiler or "make" utility
  427. and redirect any error messages into a file called "errlist".
  428. By default, cc is run on the current file.
  429. (You should write it before running cc.)
  430. The contents of the "errlist" file are then scanned for error messages.
  431. If an error message is found, then the cursor is moved to the line where
  432. the error was detected,
  433. and the description of the error is displayed on the status line.
  434. .PP
  435. After you've fixed one error, the \fBer\fRrlist command will move
  436. the cursor to the next error.
  437. In visual command mode,
  438. hitting `*' will do this, too.
  439. .PP
  440. You can also create an "errlist" file from outside of \*E,
  441. and use "\*E -m" to start elvis and have the cursor moved to the
  442. first error.
  443. Note that you don't need to supply a filename with "\*E -m" because
  444. the error messages always say which source file an error is in.
  445. .PP
  446. Note:
  447. When you use errlist repeatedly to fix several errors in a single file,
  448. it will attempt to adjust the reported line numbers to allow for lines
  449. that you have inserted or deleted.
  450. These adjustments are made with the assumption that you will work though
  451. the file from the beginning to the end.
  452. .NH 2
  453. Exit Commands
  454. .if n .ul 0
  455. .ID
  456. .ps
  457. quit[!]
  458. wq
  459. xit
  460. .DE
  461. .PP
  462. The \fBq\fRuit command exits from the editor without saving your file.
  463. .PP
  464. The \fBwq\fR command writes your file out, then then exits.
  465. .PP
  466. The \fBx\fRit command is similar to the \fBwq\fR command, except that
  467. \fBx\fRit won't bother to write your file if you haven't modified it.
  468. .NH 2
  469. File I/O Commands
  470. .if n .ul 0
  471. .ID
  472. .ps
  473. [line] read file
  474. [line][,line] write[!] [[>>]file]
  475. .DE
  476. .PP
  477. The \fBr\fRead command gets text from another file and inserts it
  478. after the specified line.
  479. It can also read the output of a program;
  480. simply precede the program name by a '!' and use it in place of the file name.
  481. .PP
  482. The \fBw\fRrite command writes the whole file, or just part of it,
  483. to some other file.
  484. The !, if present, will permit the lines to be written even if you've set
  485. the readonly option.
  486. If you precede the filename by >> then the lines will be appended to the file.
  487. You can send the lines to the standard input of a program by replacing the
  488. filename with a '!' followed by the command and its arguments.
  489. .PP
  490. Note: Be careful not to confuse ":w!filename" and ":w !command".
  491. To write to a program, you must have at least one blank before the '!'.
  492. .NH 2
  493. Directory Commands
  494. .if n .ul 0
  495. .ID
  496. .ps
  497. cd [directory]
  498. chdir [directory]
  499. shell
  500. .DE
  501. .PP
  502. The \fBcd\fR and \fBchd\fRir commands
  503. (really two names for one command)
  504. switch the current working directory.
  505. .PP
  506. The \fBsh\fRell command starts an interactive shell.
  507. .NH 2
  508. Debugging Commands
  509. .if n .ul 0
  510. .ID
  511. .ps
  512. [line][,line] debug[!]
  513. validate[!]
  514. .DE
  515. .PP
  516. These commands are only available if you compile \*E with the -DDEBUG flag.
  517. .PP
  518. The de\fBb\fRug command lists statistics for the blocks which contain
  519. the specified range of lines.
  520. If the ! is present, then the contents of those blocks is displayed, too.
  521. .PP
  522. The \fBva\fRlidate command checks certain variables for internal consistency.
  523. Normally it doesn't output anything unless it detects a problem.
  524. With the !, though, it will always produce *some* output.
  525.