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