1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650
|
<html><head>
<title>Elvis 2.1 Ex Mode</title>
</head><body>
<h1>4. EX COMMAND MODE</h1>
Ex is an editing mode in which elvis acts like a line editor.
This means that you type in a command line, and when the line is complete
elvis executes it on the current text buffer.
I.e., in ex each <em>line</em> (or group of lines) is a command,
as opposed to vi where each <em>character</em> (or group of characters) is a
command.
<p>Typically, ex commands are used to do perform complex actions such as
global search & replace, or actions which require an argument such as
writing the edit buffer out to a different file.
<p>Ex is also used as the configuration language for elvis;
configuration scripts such as <a href="elvisses.html#elvis.ini">elvis.ini</a>,
.exrc (or elvis.rc), and <a href="elvisses.html#elvis.arf">elvis.arf</a>
contain a series of ex commands.
<p>You can switch freely between vi and ex.
If you're in vi mode, you can enter a single ex command line via the
visual <a href="elvisvi.html#colon">:</a> command, or more permanently switch via
the visual <a href="elvisvi.html#Q">Q</a> command.
If you're in ex mode, you can switch to vi mode via ex's
<a href="#visual">:vi</a> command.
<p>Normally elvis will start in vi mode, but you can force it to start in
ex mode by supplying a <strong>-e</strong> command line flag.
On UNIX systems, you can link elvis to a name which ends with "x" to
achieve the same effect.
<p>The remainder of this section discusses how to enter lines, the general
syntax of an ex command line, and the specific commands which elvis supports.
<h2>4.1 Entering lines</h2>
In elvis, when you're typing in an ex command line
you're really inputting text into a buffer named "Elvis ex history".
All of the usual <a href="elvisinp.html">input mode</a> commands are available,
including <kbd>Backspace</kbd> to erase the previous character,
<kbd>Control-W</kbd> to erase the previous word, and so on.
<p>Any previously entered lines will still be in the "Elvis ex history"
buffer, and you can use the arrow keys to move back and edit earlier commands.
You can even use the <kbd>Control-O</kbd> input-mode command with
the <a href="elvisvi.html#slash">?<var>regexp</var></a> visual command,
to search for an earlier command line.
<a name="Tab"></a>
<p>The <kbd>Tab</kbd> key has a special function when you're inputting
text into the "Elvis ex history" buffer.
It is used for file name expansion.
The preceding word is assumed to be a partial file name, and elvis searches
for all matching files.
If there are multiple matches, then elvis fills in as many characters of the
name as possible, and then beeps;
or, if no additional characters are implied by the matching file names,
then elvis lists all matching names and redisplays the command line.
If there is a single match, then elvis completes the name and appends a
tab character.
If there are no matches, then elvis simply inserts a tab character.
<p>You can bypass the file name expansion by typing a <kbd>Control-V</kbd>
before the <kbd>Tab</kbd> key.
You can also disable file name completion all together by setting the
"Elvis ex history" buffer's <a href="elvisopt.html#inputtab">inputtab</a>
option to "tab", via the following command:
<pre>
:(Elvis ex history)set inputtab=tab</pre>
<p>When you hit the <kbd>Enter</kbd> key on a line in the "Elvis ex history"
buffer, elvis sends that line to the ex command parser,
which is described in the next section.
<h2>4.2 Syntax and Addressing</h2>
In general, ex command lines can begin with an optional window id.
This may be followed by an optional buffer id,
and then 0, 1, or 2 line addresses,
followed by a command name, and perhaps some arguments after that
(depending on the command name).
<p>A window ID is typed in as a decimal number followed by a colon character.
If you don't supply a window ID (and you almost never will) then it defaults
to the window where you typed in the command line.
The <a href="#buffer">:buffer</a> command lists the buffers, and shows which
one is being edited in which window.
Also, the <a href="elvisopt.html#windowid">windowid</a> option indicates the
ID of the current window.
<a name="BUFFERID"></a>
<p>A buffer ID is given by typing an opening parenthesis, the name of the
buffer, and a closing parenthesis.
For user buffers, the name of the buffer is usually identical to the name of
the file that it corresponds to.
For example, a file named ~/.Xdefaults would be loaded into a buffer which
could be addressed as <code>(~/.Xdefaults)</code>.
Elvis also assigns numbers to user buffers, which may be more convenient
to type since numbers are generally shorter than names.
If ~/.Xdefaults is the first file you've edited since starting elvis, then
its buffer could be addressed as <code>(1)</code>.
The <a href="#buffer">:buffer</a> command shows the number for each user
buffer.
<p>Elvis also has several internal buffers, all of which have names that start
with "Elvis ", such as <code>(Elvis cut buffer x)</code> and
<code>(Elvis error list)</code>.
The <a href="#buffer">:buffer!</a> command (with a ! suffix) will list them all.
For the sake of brevity, elvis allows you to refer to cut buffers as
<code>("x)</code>.
Similarly, the other internal buffers can be referred to via a " character
and the initial letter in each word of the full name, such as
<code>("Eel)</code> for <code>(Elvis error list)</code>.
<p>Commands which don't access the text, such as "<a href="#quit">:quit</a>",
don't allow any line addresses.
Other commands, such as "<a href="#mark">:mark</a>",
only allow a single line address.
Most commands, though, allow two line addresses;
the command is applied to all lines between the two specified lines,
inclusively.
The tables below indicate how many line addresses each command allows.
<p>Line addresses are always optional.
The first line address of most commands usually defaults to the current line.
The second line address usually defaults to be the same as the first line address.
Exceptions are <a href="#write">:write,</a> <a href="#lpr">:lpr,</a>
<a href="#global">:global,</a> and <a href="#vglobal">:vglobal,</a>
which act on all lines of the file by default, and
<a href="#BANG">:!,</a> which acts on no lines by default.
<p>If you use the visual <a href="elvisvi.html#V">V</a> command to mark
a range of lines, and then use the visual <a href="elvisvi.html#colon">:</a>
command to execute a single ex command,
then the default range affected by the ex command will
be the visibly marked text.
<p><a name="address"></a>Line addresses consist of an absolute part and a relative part.
The <em>absolute part</em> of a line specifier may be either an
explicit line number, a mark, a dot to denote the current line,
a dollar sign to denote the last line of the file, or a
forward or backward search.
An <em>explicit line number</em> is simply a decimal number,
expressed as a string of digits.
A <em>mark</em> is typed in as an apostrophe followed by a letter.
Marks must be set before they can be used.
You can set a mark in visual command mode by typing "m" and a letter,
or you can set it in ex command mode via the "mark" command.
A <em>forward search</em> is typed in as a regular expression surrounded by
slash characters; searching begins at the default line.
A <em>backward search</em> is typed in as a regular expression
surrounded by question marks;
searching begins at the line before the default line.
<p>If you omit the <em>absolute part,</em> then the default line is used.
<p>The <em>relative part</em> of a line specifier is typed as a <code>+</code>
or <code>-</code> character followed by a decimal number.
The number is added to or subtracted from the absolute part of the line
specifier to produce the final line number.
<p>As a special case, the <code>%</code> character may be used to specify
all lines of the file.
It is roughly equivalent to saying <code>1,$</code>.
This can be a handy shortcut.
<p>Here are some addressing examples, using the <a href="#print">:p</a> command:
<pre graphic>
COMMAND | ACTION
-------------|-------------------------------------------
:p | print the current line
:37p | print line 37
:'gp | print the line which contains mark g
:/foo/p | print the next line that contains "foo"
:$p | print the last line of the buffer
:20,30p | print lines 20 through 30
:1,$p | print all lines of the buffer
:%p | print all lines of the buffer
:(zot)%p | print all lines of the "zot" buffer
:/foo/-2,+4p | print 5 lines around the next "foo"</pre>
<p>The optional addresses are followed by the command name.
Command names may be abbreviated.
In the sections that follow, the command's full name is given with the
optional part enclosed in square brackets.
<p>Some commands allow a '!' character to appear immediately after the
command name.
The significance of the '!' varies from one command to another,
but typically it forces the command to do something dangerous that it would
ordinarily refuse to do.
For example, <a href="#write">:w <var>file</var></a> refuses to overwrite an
existing file, but <a href="#write">:w! <var>file</var></a> will do it.
<p>Many commands allow (or even require) additional arguments.
The descriptions below list which arguments each command accepts
with optional commands denoted by square brackets.
The most common argument types are:
<dl>
<dt>/regexp/
<dd>This is a <a href="elvisre.html">regular expression.</a>
You can use any punctuation character to delimit it, but the '/' character
is the most commonly used.
<p><strong>Note:</strong> When entering a <code>tab</code> character into
a regular expression, you should type <kbd>(Ctrl-V)(Tab)</kbd>. Otherwise
elvis will think the <code>tab</code> is intended to be used for
<a href="#Tab">file name expansion</a>.
<dt>/regexp/newtext/
<dd>This is a <a href="elvisre.html">regular expression</a>
followed by replacement text.
<p><strong>Note:</strong> When entering a <code>tab</code> character into
the replacement text, you should type <kbd>(Ctrl-V)(Tab)</kbd>. Otherwise
elvis will think the <code>tab</code> is intended to be used for
<a href="#Tab">file name expansion</a>.
<dt>count
<dd>This is a number - a string of digits.
Generally, it is used as the repeat count for certain commands.
<dt>cutbuf
<dd>This is the name of a cut buffer - a single letter.
Elvis also allows (but does not require) a quote character before the letter.
<dt>excmds
<dd>This is another ex command, or list of ex commands.
Traditionally, the whole list of commands had to appear on the same line,
delimited by '|' characters.
Elvis has the added versatility of allowing a '{' character on the first line,
each command on a separate following line, and then '}' on a line by itself to mark
the end of the ex command list.
<dt>lhs
<dd>This is string of characters.
If whitespace characters are to be included in it, then they must be
quoted by embedding a <kbd>^V</kbd> character before them.
<dt>line
<dd>This is a line address, as described earlier.
<dt>mark
<dd>This is the name of a mark - a single lowercase letter.
Elvis allows (but does not require) an apostrophe before the letter.
<dt>rhs
<dd>This is a string of characters.
If it begins with a whitespace character, then that character must be quoted
by embedding a <kbd>^V</kbd> character in the command line before it.
Other whitespace characters in the string do not need to be quoted.
<dt>expr
<dd>This is an <a href="elvisexp.html">arithmetic expression</a>
using the normal syntax.
<dt>shellcmd
<dd>This is a command line which is passed to the system's command interpretter.
Within the command line, the following character substitutions take place,
unless preceded by a backslash:
<pre graphic>
.-----------.----------------------------.
| CHARACTER | REPLACED BY |
|-----------|----------------------------|
| % | Name of current file |
| # | Name of alternate file |
| #<var>n</var> | Name of file whose <a href="elvisopt.html#bufid">bufid</a>=<var>n</var> |
| ! | Previous command line |
| \@ | Word at cursor location |
^-----------^----------------------------^
</pre>
Note that the <code>\@</code> substitution <em>requires</em> a backslash.
This quirk exists for the sake of backward compatibility -
the real vi doesn't perform any substitutions for just plain @.
<dt>file or files
<dd>This is one or more file name, or a "wildcard" pattern which matches
the names of zero or more files. File names are subjected to three levels
of processing. First, leading ~ characters and certain other characters
are replaced with text, as follows:
<pre graphic>
.---------.------------------------------------------------.
| SYMBOL | REPLACED BY |
|---------|------------------------------------------------|
| ~<var>user</var> | (Unix only) Replaced by home directory of <var>user</var> |
| ~+ | Replaced by current working directory |
| ~- | Replaced by previous directory (<a href="elvisopt.html#previousdir">previousdir</a>) |
| ~ | Replaced by home directory (<a href="elvisopt.html#home">home</a>) |
| % | Replaced by the name of the current file |
| # | Replaced by the name of the alternate file |
| #<var>n</var> | Replaced by the filename of buffer with <a href="elvisopt.html#bufid">bufid</a>=<var>n</var>|
| (space) | Delimits one file name from another |
^---------^------------------------------------------------^
</pre>
The second stage of processing evaluates each name using the
<a href="elvisexp.html#simpler">simpler expression syntax</a>.
This basically means that expressions of the form
<strong>$</strong><var>NAME</var> will be replaced with the value of
the environment variable named <var>NAME</var>.
Also, you can use parentheses around option names or more complex expressions.
For example, if the user option <a href="elvisopt.html#f">f</a> contains
the name of a file, then you could say "<code>:e (f)</code>" to edit that file.
<p>In either of the first two stages,
backslashes may be used to prevent the special symbols from
having their usual meaning; they'll be treated as normal text instead.
In particular, a backslash-space sequence can be used to give a filename
which includes spaces; e.g., to edit "C:\Program Files\foo" you would type
"<code>:e C:\Program\ Files\foo</code>".
Note that backslashes which are followed by a normal character are simply
retained as normal characters, so you rarely need to type a double-backslash
when your file name needs only a single backslash.
<p>The third stage of processing checks for "wildcard" characters in the name,
and if there are any then the whole name is replaced by the name of each
matching file. The exact list of supported wildcards will vary from one
operating system to another, but the following are typical:
<pre graphic>
.--------.----------------------------------------------.
| SYMBOL | MATCHES |
|--------|----------------------------------------------|
| * | Any string of characters, of any length |
| ? | Any single character |
| [a-z] | (Unix only) Any single character from A to Z |
^--------^----------------------------------------------^
</pre>
In most operating systems, wildcards are only recognized when they occur
in the last file name part of a longer pathname. In other words, you can
use wildcards for file names,
but not in directory names leading up to file names.
<p>Traditionally, vi has used the Unix shell to expand wildcards.
However, this interferes with the use of spaces in file names, isn't easily
portable to non-Unix operating systems, and is a potential security hole.
So elvis performs all wildcard expansion itself. The only disadvantage
of this is that you loose other shell notations such as
<code>`command`</code> and <code>{alt1,alt2}</code>.
</dl>
<p>Most commands can be followed by a '|' character and another ex command.
Others can't. In particular, any command which takes a <strong>excmd</strong>
or <strong>shellcmd</strong> argument doesn't treat '|' as a command delimiter.
<p>If a command does treat '|' as a delimiter, and you want '|' to be treated
as part of a command argument, then you'll need to quote the '|' character
by preceding it with a backslash or ^V, depending on the command.
(Sadly, different commands require different quote characters.)
<h2><a name="GROUP"></a>4.3 Ex Commands, Grouped by Function</h2>
<menu>
<li><a href="#HELP"> 4.3.1 The help command itself</a>
<li><a href="#EDIT"> 4.3.2 Editing commands</a>
<li><a href="#GLOBAL"> 4.3.3 Global edit commands</a>
<li><a href="#PRINT"> 4.3.4 Displaying text</a>
<li><a href="#TAGS"> 4.3.5 Tags</a>
<li><a href="#IO"> 4.3.6 File I/O commands</a>
<li><a href="#ARGS"> 4.3.7 The args list, and selecting a file to edit</a>
<li><a href="#QUIT"> 4.3.8 Quitting</a>
<li><a href="#MACRO"> 4.3.9 Scripts and macros</a>
<li><a href="#ERRLIST"> 4.3.10 Working with a compiler</a>
<li><a href="#CALC"> 4.3.11 Built-in calculator</a>
<li><a href="#BUFFER"> 4.3.12 Buffer commands</a>
<li><a href="#WINDOW"> 4.3.13 Window commands</a>
<li><a href="#SETUP"> 4.3.14 Configuration</a>
<li><a href="#MISC"> 4.3.15 Miscellaneous</a>
</menu>
<h3><a name="HELP"></a>4.3.1 The help command itself</h3>
<pre graphic>.-------.-------------------.-----------------------------------.
|ADDRESS| COMMAND | ARGUMENTS |
|-------|-------------------|-----------------------------------|
| | <a href="#help">h[elp]</a> | topic |
^-------^-------------------^-----------------------------------^
</pre>
<a name="help"></a>The <em>:help</em> command loads and displays a
help file for a given topic.
There are several help files, covering a wide variety of topics.
<p>Elvis looks at the topic you supply, and tries to determine whether
it is an ex command name, vi keystroke, option name, or something else.
Based on this, it generates a hypertext link to the topic in the appropriate
help file, and shows the topic in a separate window.
Elvis uses the following rules to convert your requested topic into
a hypertext reference:
<pre graphic>
.---------------.-------------------------------------------.
| COMMAND | ELVIS' INTERPRETATION |
|---------------|-------------------------------------------|
| :help | With no topic, elvis loads the table of |
| | contents. This has hypertext links that |
| | can lead you to any other topic. |
| :help ex | Elvis loads the chapter describing ex |
| | commands. |
| :help vi | Elvis loads the chapter describing vi |
| | commands. |
| :help set XXX | If XXX is an option name, elvis will show |
| | the description of that option; else it |
| | will list groups of all options. |
| :help :XXX | If XXX is an ex command name, elvis will |
| | show its description; else elvis will |
| | list groups of all ex commands. |
| :help XXX | If XXX appears to be a keystroke then |
| | elvis will assume it is meant to be a |
| | vi command and will show the command's |
| | description. Else if it is an option |
| | name elvis will show that. Else if it |
| | is an ex command, elvis will show that. |
| | Else elvis will show this description |
| | of the :help command itself. |
^---------------^-------------------------------------------^</pre>
<p>Although this chart only mentions sections on ex commands, vi commands,
and options, there are many others which are only accessible via the
table of contents shown by ":help" with no arguments.
<p>All of these help files are HTML documents.
Elvis' standard HTML editing facilities are available while you're
viewing the help text.
Some of the highlights of this are:
<ul>
<li>To close this help window, type <kbd>ZQ</kbd>. Actually, this works
for all windows. (You must hold the <kbd>Shift</kbd> key
as you type <kbd>ZQ</kbd>, because lowercase <kbd>zq</kbd> does
something else entirely: nothing!)
<li>Any underlined text is a hypertext reference. This means that you
can move the cursor onto it, and hit the <kbd>Enter</kbd> key,
and the cursor will move to a topic describing the underlined text.
<li>To return to your original position after following a hypertext reference, hit <kbd>^T</kbd> (Control-T).
<li>The <kbd>Tab</kbd> key moves the cursor forward to the next
hypertext reference.
</ul>
<p>You can use elvis to print the document via the <a href="#lpr">:lpr</a>
command. This assumes you have set the <a href="elvisopt.html#LPR">printing
options</a> correctly.
<h3><a name="EDIT"></a>4.3.2 Editing commands</h3>
<pre graphic>.-------.-------------------.-----------------------------------.
|ADDRESS| COMMAND | ARGUMENTS |
|-------|-------------------|-----------------------------------|
| line | <a href="#append">a[ppend]</a>[!] | [text] |
| line | <a href="#insert">i[nsert]</a>[!] | [text] |
| range | <a href="#change">c[hange]</a>[!] | [count] [text] |
| range | <a href="#delete">d[elete]</a> | [cutbuf] [count] |
| range | <a href="#yank">y[ank]</a> | [cutbuf] [count] |
| line | <a href="#put">pu[t]</a> | [cutbuf] |
| range | <a href="#copy">co[py]</a> | line |
| range | <a href="#move">m[ove]</a> | line |
| range | <a href="#to">t[o]</a> | line |
| range | <a href="#BANG">!</a> | shellcmd |
| range | <a href="#GT">></a> | |
| range | <a href="#LT"><</a> | |
| range | <a href="#join">j[oin]</a>[!] | |
| | <a href="#undo">u[ndo]</a> | [count] |
| | <a href="#redo">red[o]</a>[!] | [count] |
^-------^-------------------^-----------------------------------^
</pre>
<a name="append"></a>The <em>:append</em> command inserts text after the
current line.
If no new text is supplied on the command line, then elvis will wait for
you to type in text;
you can then mark the end of the new text by typing a "." (period) on a
line by itself.
<p><a name="insert"></a>The <em>:insert</em> command inserts text before the
current line.
Other than that, it is identical to the <a href="#append">:append</a>
command.
<p><a name="change"></a>The <em>:change</em> command deletes old text lines
(copying them into the anonymous cut buffer) and then waits for you to enter
new text to replace it.
You can then mark the end of the new text by typing a "." (period) on a
line by itself.
<p><a name="delete"></a><a name="yank"></a>The <em>:delete</em> command copies
text into a cut buffer, and then deletes it from the edit buffer.
The <em>:yank</em> command copies text into a cut buffer but leaves the
edit buffer unchanged.
<p><a name="put"></a>The <em>:put</em> command "pastes" text from a cut buffer
back into the edit buffer.
The cut buffer's contents are inserted after the addressed line.
If you want to insert before the first line, you can use address 0 like
this:
<pre>
:0put</pre>
<p><a name="copy"></a><a name="to"></a>
The <em>:copy</em> and <em>:to</em> commands are identical.
They both make a copy of a portion of an edit buffer, and insert that copy
at a specific point.
The destination line can be specified with an optional buffer name and the
full address syntax as described in <a href="#address">section 4.2.</a>
Consequently, you can use this command to copy part of one edit buffer
into another edit buffer.
The following example copies an 11-line window from the current buffer
onto the end of a buffer named "otherbuf"
<pre>
:-5,+5t(otherbuf)$</pre>
<p><a name="move"></a>
The <em>:move</em> command resembles <a href="#copy">:copy</a> except that
<em>:move</em> deletes the original text.
<p><a name="BANG"></a>
The <em>:!</em> command allows you to send parts of your edit buffer though
some external "filter" program.
The output of the program then replaces the original text.
For example, this following will sort lines 1 through 10 using the "sort"
program.
<pre>
:1,10!sort</pre>
<p>If you use the <em>:!</em> command without any line addresses, then
elvis will simply execute the program and display its output.
This is only guaranteed to work correctly for non-interactive programs;
to execute an interactive program you should use the <a href="#shell">:shell</a>
command.
<p><a name="LT"></a><a name="GT"></a>
The <em>:<</em> and <em>:></em> commands adjust the indentation on the
addressed lines.
The <em>:<</em> command decreases the leading whitespace by the number of
spaces indicated in the <a href="elvisopt.html#shiftwidth">shiftwidth</a> option,
and <em>:></em> does the reverse.
<p><a name="join"></a>
The <em>:join</em> command joins multiple lines together so they form one
long line.
Normally it will intelligently decide how much whitespace it should place
between lines, depending on the <a href="elvisopt.html#sentenceend">sentenceend,</a>
<a href="elvisopt.html#sentencegap">sentencegap,</a> and
<a href="elvisopt.html#sentencequote">sentencequote</a> options.
When invoked with an exclamation point, as <code>:join!</code>, it joins the lines
without doing fancy things to whitespace.
<p><a name="undo"></a><a name="redo"></a>
The <em>:undo</em> command undoes recent changes.
The number of undoable changes is controllable on a buffer-by-buffer basis,
via the <a href="elvisopt.html#undolevels">undolevels</a> option.
The <em>:redo</em> command undoes an undo.
<h3><a name="GLOBAL"></a>4.3.3 Global edit commands</h3>
<pre graphic>.-------.-------------------.-----------------------------------.
|ADDRESS| COMMAND | ARGUMENTS |
|-------|-------------------|-----------------------------------|
| range | <a href="#global">g[lobal]</a>[!] | /regexp/ excmds |
| range | <a href="#vglobal">v[global]</a>[!] | /regexp/ excmds |
| range | <a href="#substitute">s[ubstitute]</a> | /regexp/newtext/[g][p][x][count] |
| range | <a href="#AMP">&</a> | |
| range | <a href="#TILDE">~</a> | |
^-------^-------------------^-----------------------------------^
</pre>
<a name="global"></a>
<a name="vglobal"></a>
The <em>:global</em> command searches for lines which contain the
<a href="elvisre.html">/regexp/</a> and executes the given <var>excmds</var>
for each matching line.
The <em>:vglobal</em> command executes the <var>excmds</var> for each line
which <em>does not</em> match the <var>/regexp/.</var>
<p>In script files, you can supply multiple command lines to a single
<code>:global</code> or <code>:vglobal</code> by placing a '{' character on the
<code>:global/:vglobal</code> line,
following that with any number of command lines, and then finally a '}'
character on a line by itself to mark the end.
This notation doesn't allow nesting; you can't use {...} inside a larger
{...} command list.
(Hopefully this limitation will be lifted soon.)
<p><strong>Note:</strong> When entering a <code>tab</code> character into
a regular expression, you should type <kbd>(Ctrl-V)(Tab)</kbd>. Otherwise
elvis will think the <code>tab</code> is intended to be used for
<a href="#Tab">file name expansion</a>.
<p><a name="substitute"></a>
The <em>:substitute</em> command searches for the <var>/regexp/</var> in each
line, and replaces the matching text with <var>newtext.</var>
The interpretation of <var>newtext</var> is described in
<a href="elvisre.html#SUBST">section 5.2</a>
<p>The <var>newtext</var> can be followed by a <kbd>g</kbd> flag to
replace all instances in each line.
Without the <kbd>g</kbd> flag, only the first match within each line
is changed.
<p>You can also supply a <kbd>p</kbd> flag.
This causes each affected line to be printed, after all substitutions have
been made to that line.
<p>Standard vi supports a <kbd>c</kbd> flag, which prompts for confirmation
before each substitution, but <em>elvis doesn't support that yet.</em>
Until elvis supports <kbd>c,</kbd> the suggested work-around is:
set the <a href="elvisopt.html#autoselect">autoselect</a> option,
use the visual <a href="elvisvi.html#slash">/</a> command to search for
the first match,
then use the visual <a href="elvisvi.html#c">c</a> command to change the
text.
After that, you can use <a href="elvisvi.html#n">n</a> to find the next
match, and <a href="elvisvi.html#stop">.</a> to change the text.
If you want to leave a match unchanged, just hit <a href="elvisvi.html#n">n</a>
without hitting the <a href="elvisvi.html#stop">.</a> key.
<p>Elvis supports a special <kbd>x</kbd> flag.
Instead of performing each substitution,
elvis will execute the final replacement text as an ex command line.
This is used in the implementation of modelines, like this:
<pre>
1,5 s/ex:\(.*\):/\1/x
$-4,$ s/ex:\(.*\):/\1/x</pre>
<p><strong>Note:</strong> When entering a <code>tab</code> character into
a regular expression or the replacement text, you should type <kbd>(Ctrl-V)(Tab)</kbd>. Otherwise
elvis will think the <code>tab</code> is intended to be used for
<a href="#Tab">file name expansion</a>.
<p><a name="AMP"></a><a name="TILDE"></a>
The <em>:&</em> and <em>:~</em> commands are identical to each other.
They both repeat the previous <em>:substitute</em> command.
<h3><a name="PRINT"></a>4.3.4 Displaying text</h3>
<pre graphic>.-------.-------------------.-----------------------------------.
|ADDRESS| COMMAND | ARGUMENTS |
|-------|-------------------|-----------------------------------|
| range | <a href="#print">p[rint]</a> | [count] |
| range | <a href="#list">l[ist]</a> | [count] |
| range | <a href="#number">nu[mber]</a> | [count] |
| range | <a href="#HASH">#</a> | [count] |
| line | <a href="#z">z</a> | [spec] |
| range | <a href="#EQ">=</a> | |
^-------^-------------------^-----------------------------------^
</pre>
<a name="print"></a>
The <em>:print</em> command displays lines from the edit buffer.
It displays them the normal way -- with tabs expanded and so on.
<p><a name="list"></a>
The <em>:list</em> command also displays lines, but it tries to make
all non-printing characters visible, and it marks the end of each line with
a '$' character.
<p><a name="number"></a><a name="HASH"></a>
The <em>:number</em> and <em>:#</em> commands are identical to each other.
They both display lines the normal way except that each line is preceded by
its line number.
<p><a name="z"></a>
The <em>:z</em> command shows a "window" of lines surrounding the current line.
The default size of the "window" is taken from the
<a href="elvisopt.html#window">window</a> option.
If a line address is supplied, then it becomes the current line before this
command is executed.
The <var>spec</var> can be one of the following characters;
the default is <kbd>z+.</kbd>
<pre graphic>
.------.-----------------------------------------------------.
| SPEC | OUTPUT STYLE |
|------|-----------------------------------------------------|
| - | Place the current line at the bottom of the window. |
|------|-----------------------------------------------------|
| + | Place the current line at the top of the window. |
| | Upon completion of this command, the last line |
| | output will become the current line. |
|------|-----------------------------------------------------|
| ^ | Jump back 2 windows' worth of lines, and then do |
| | the equivalent of z+. Note that z+ is like paging |
| | forward and z^ is like paging backward. |
|------|-----------------------------------------------------|
| . | Place the current line in the middle of the window. |
| | Upon completion of this command, the last line |
| | output will become the current line. |
|------|-----------------------------------------------------|
| = | Place the current line in the middle of the window, |
| | and surround it with lines containing hyphens. |
^------^-----------------------------------------------------^ </pre>
<p><a name="EQ"></a>
The <em>:=</em> command displays the line number of the current line,
or the addressed line if given one address.
If given a range of addresses, it tells you the line numbers of the two
endpoints and the total number of lines in the range.
<h3><a name="TAGS"></a>4.3.5 Tags</h3>
<pre graphic>.-------.-------------------.-----------------------------------.
|ADDRESS| COMMAND | ARGUMENTS |
|-------|-------------------|-----------------------------------|
| | <a href="#tag">ta[g]</a>[!] | [tag] |
| | <a href="#stack">stac[k]</a> | |
| | <a href="#pop">po[p]</a>[!] | |
| | <a href="#browse">br[owse]</a>[!] | restrictions |
^-------^-------------------^-----------------------------------^
</pre>
Tags provide a way to associate names with certain places within certain files.
Typically, you will run the <strong>ctags</strong> program to create a file
named "tags" which describes the location of each function and macro
used in the source code for your project.
The tag names are the same as the function names, in this case.
<p>In HTML mode, elvis uses the tags commands to follow hypertext links,
but we'll generally ignore that in the following discussions.
<p><a name="tag"></a>
The <em>:tag</em> command performs tag lookup.
It reads the "tags" file to locate the named tag.
It then loads the source file where that tag is defined, and moves the
cursor to the specific point within that buffer where the tag is defined.
Elvis' implementation of <code>:tag</code> also allows you to give extra
<a href="elvistag.html#HINTS">restrictions and hints.</a>
There is also a <a href="#stag">:stag</a> command which creates a new window
and moves its cursor to the tag's definition point.
<p><a name="browse"></a>
The <em>:browse</em> command extracts selected tags from the tags file,
constructs an HTML document listing those tags (with hypertext links to their
definition points inside your source code) and displays it in the current
window.
There is also a <a href="#sbrowse">:sbrowse</a> command which displays the
same list in a new window.
See chapter <a href="elvistag.html">14. Tags</a> for a full description of
<a href="elvistag.html#HINTS">restrictions and hints,</a> and
<a href="elvistag.html#BROWSE">browsing.</a>
<p><a name="stack"></a>
Before moving the cursor, elvis will save the old cursor position on a stack.
You can use the <em>:stack</em> command to display the contents of that stack.
Each window has an independent stack.
<p><a name="pop"></a>
The <em>:pop</em> command pops a cursor position off the stack, restoring
the cursor to its previous position.
When you're browsing though source code, you will typically use <em>:tag</em>
to go deeper into the call tree, and <em>:pop</em> to come back out again.
<p>In HTML mode, these all work the same except that <em>:tag</em> expects to
be given an URL instead of a tag name.
URLs don't depend on having a "tags" file, so the "tags" file is ignored
when in HTML mode.
Elvis doesn't support any network protocols, so its URLs can only consist
of a file name and/or a #label.
The following example would move the cursor to the start of this section:
<pre>
:tag elvisopt.html#TAGS</pre>
<h3><a name="IO"></a>4.3.6 File I/O commands</h3>
<pre graphic>.-------.-------------------.-----------------------------------.
|ADDRESS| COMMAND | ARGUMENTS |
|-------|-------------------|-----------------------------------|
| line | <a href="#read">r[ead]</a> | file | !shellcmd |
| range | <a href="#write">w[rite]</a>[!] | [file | >>file | !shellcmd] |
| range | <a href="#lpr">lp[r]</a>[!] | [file | >>file | !shellcmd] |
^-------^-------------------^-----------------------------------^
</pre>
<a name="read"></a>
The <em>:read</em> command reads a file or external program,
and inserts the new text into the edit buffer after the addressed line.
If you don't explicitly give a line address, then the text will be
inserted after the current line.
To insert the file's contents into the top of the buffer (before line 1),
you should specify line 0.
For example, to insert the contents of "foo.txt" before line 1, you would
give the command...
<pre>:0 read foo.txt</pre>
<p><a name="write"></a>
The <em>:write</em> command writes either the entire edit buffer (if no
address range is given) or a part of it (if a range is given) out to either
a file or an external filter program.
If you don't specify the output file or external command,
then elvis will assume it should write to the file that the buffer was
originally loaded from.
<p>Elvis will normally prevent you from overwriting existing files.
(The exact details of this protection depend on the
<a href="elvisopt.html#edited">edited,</a>
<a href="elvisopt.html#filename">filename,</a>
<a href="elvisopt.html#newfile">newfile,</a>
<a href="elvisopt.html#readonly">readonly,</a> and
<a href="elvisopt.html#writeany">writeany</a> options.)
If you want to force elvis to overwrite an existing file,
you can append a "!" to the end of the command name, but before the file name.
In order to avoid ambiguity, <em>there must not be any whitespace between
the "write" command name and the "!" character</em> when you want to
overwrite an existing file.
Conversely, when writing to an external program there <em>should</em> be
whitespace before the "!" that marks the start of the program's command line.
The ">>file" notation tells elvis to append to "file" instead of overwriting it.
<p><a name="lpr"></a>
The <em>:lpr</em> command sends text to the printer.
It is similar to <code>:write</code> except that <code>:lpr</code>
formats the buffer contents as defined by the
<a href="elvisopt.html#bufdisplay">bufdisplay</a> option and the
<a href="elvisopt.html#LPR">printing options.</a>
If no output file or external program is specified,
then the printer output is sent to the file or external program
specified by the <a href="elvisopt.html#lpout">lpout</a> option.
<h3><a name="ARGS"></a>4.3.7 The args list, and selecting a file to edit</h3>
<pre graphic>.-------.-------------------.-----------------------------------.
|ADDRESS| COMMAND | ARGUMENTS |
|-------|-------------------|-----------------------------------|
| | <a href="#args">ar[gs]</a> | [file...] |
| | <a href="#next">n[ext]</a>[!] | [file...] |
| | <a href="#previous">N[ext]</a>[!] | |
| | <a href="#previous">pre[vious]</a>[!] | |
| | <a href="#rewind">rew[ind]</a>[!] | |
| | <a href="#last">la[st]</a> | |
| | <a href="#wnext">wn[ext]</a>[!] | |
| | <a href="#file">f[ile]</a> | [file] |
| | <a href="#edit">e[dit]</a>[!] | [+line] [file] |
| | <a href="#ex">ex</a>[!] | [+line] [file] |
| | <a href="#visual">vi[sual]</a>[!] | [+line] [file] |
| | <a href="#open">o[pen]</a>[!] | [+line] [file] |
^-------^-------------------^-----------------------------------^
</pre>
The "args list" is a list of file names.
It provides an easy way to edit a whole series of files, one at a time.
Initially, it contains any file names that you named on the command line
when you invoked elvis.
<p><a name="args"></a>
The <em>:args</em> command displays the args list, with the
current file name enclosed in brackets.
You can also use <code>:args</code> to replace the args list with a new
set of files;
this has no effect on whatever file you're editing at that time, but
it will affect any <a href="#next">:next</a> commands that you give later.
<p><a name="next"></a>
The <em>:next</em> command switches to the next file in the args list.
This means it loads the next file from the args list into an edit buffer,
and makes that edit buffer be the current buffer for this window.
You can also give a new args list on the <code>:next</code> command line;
this acts like a <code>:args</code> command to set the args list, followed by
an argumentless <code>:next</code> command to load the next (first) file in
that list.
<p><a name="Next"></a><a name="previous"></a>
The <em>:Next</em> (with a capital "N") and <em>:previous</em> commands
are identical to each other.
They both move backwards through the args list.
<p><a name="rewind"></a><a name="last"></a>
The <em>:rewind</em> and <em>:last</em> commands switch to the first and
last files in the args list, respectively.
<p><a name="wnext"></a>
The <em>:wnext</em> command is like a <a href="#write">:write</a> command
followed by a <a href="#next">:next</a> command.
It saves any changes made to the current file before switching to the next
file.
(The <a href="elvisopt.html#autowrite">autowrite</a> option offers a better
alternative.)
<p><a name="file"></a>
The <em>:file</em> command displays information about the current buffer.
It can also be used to change the filename associated with this buffer.
<p><a name="edit"></a><a name="ex"></a>
The <em>:edit</em> and <em>:ex</em> commands are identical to each other.
They both switch to a new file, or if no file is named then they reread
the current file.
This has no effect on the args list.
<p><a name="visual"></a><a name="open"></a>
The <em>:visual</em> and <em>:open</em> commands switch to a new file if
one is named; otherwise they continue to use the current buffer <em>without</em>
reloading it from the original file.
These commands have the side-effect of switching the window mode from ex mode
to either the normal visual mode or the uglier "open" mode, respectively.
"Open" mode allows you to use all of the visual commands, but it only displays
a single line (the line that the cursor is on) at the bottom of the screen.
The sole advantage that "open" mode has over "visual" mode is that "open"
mode doesn't need to know what kind of terminal you're using.
<h3><a name="QUIT"></a>4.3.8 Quitting</h3>
<pre graphic>.-------.-------------------.-----------------------------------.
|ADDRESS| COMMAND | ARGUMENTS |
|-------|-------------------|-----------------------------------|
| | <a href="#close">cl[ose]</a>[!] | |
| | <a href="#quit">q[uit]</a>[!] | |
| | <a href="#wquit">wq[uit]</a>[!] | [file] |
| | <a href="#xit">x[it]</a>[!] | [file] |
| | <a href="#qall">qa[ll]</a>[!] | |
| | <a href="#preserve">pres[erve]</a> | |
^-------^-------------------^-----------------------------------^
</pre>
Except for <code>:qall,</code> all of these commands attempt to close the current
window without losing any changes.
When the last window is closed, elvis exits.
The differences between these commands concern how modified buffers are handled.
In the discussions below, it is assumed that
<a href="elvisopt.html#tempsession">tempsession</a> is True and the buffer's
<a href="elvisopt.html#retain">retain</a> option is False, which is usually
the case.
<p><a name="close"></a>
The <em>:close</em> command is the simplest.
If the current window is the only window and one or more buffers have been
modified but not yet saved, then <code>:close</code> will fail;
otherwise the current window will be closed.
The visual <a href="elvisvi.html#^Wq">^Wq</a> command uses this command internally.
If the window's buffer was modified, then elvis will just have a modified
buffer lying around, which may or may not be visible in some other window.
That's okay.
The other quitting commands won't allow you to lose that buffer accidentally.
You can make some other window view that buffer by giving that buffer's
name in parentheses on an ex command line in that other window.
<p><a name="quit"></a>
The <em>:quit</em> command fails if the current buffer has been modified.
If you wish to abandon the changes made to the current buffer, you can add
a "!" to the end of the command name; this has the effect of turning off
the buffer's <a href="elvisopt.html#modified">modified</a> flag.
<p><a name="xit"></a>
The <em>:xit</em> command saves the file if it has been modified, and then
closes the window.
The visual <a href="elvisvi.html#Z">ZZ</a> command uses this command internally.
<p><a name="wquit"></a>
The <em>:wquit</em> command saves the file regardless of whether it has been
modified, and then closes the window.
<p><a name="qall"></a>
The <em>:qall</em> command tries to close all of the windows at once.
It is equivalent to giving the <code>:quit</code> command in each window.
<p><a name="preserve"></a>
The <em>:preserve</em> command closes all windows and exits, but it doesn't
delete the session file.
You can restart the same edit session later by giving the command...
<pre>
elvis -s<em>sessionfile</em>
</pre>
...where <em>sessionfile</em> is the name of the session file,
usually "/var/tmp/elvis1.ses".
You may want to check the value of the
<a href="elvisopt.html#session">session</a> option first, just to make sure.
<h3><a name="MACRO"></a>4.3.9 Scripts and macros</h3>
<pre graphic>.-------.-------------------.-----------------------------------.
|ADDRESS| COMMAND | ARGUMENTS |
|-------|-------------------|-----------------------------------|
| | <a href="#AT">@</a> | cutbuf |
| | <a href="#source">so[urce]</a>[!] | file |
| | <a href="#safer">saf[er]</a>[!] | file |
| | <a href="#alias">al[ias]</a> | [name [excmds]] |
| | <a href="#unalias">unal[ias]</a>[!] | name |
^-------^-------------------^-----------------------------------^
</pre>
<a name="AT"></a>
The <em>:@</em> command executes the contents of a cut buffer as a series
of ex command lines.
<p><a name="source"></a>
The <em>:source</em> reads a file, and executes its contents as a series of
ex commands.
Normally, elvis would issue an error message if the requested file didn't
exist but when a "!" is appended to the command name, elvis will silently
ignore the command if it doesn't exist.
<p><a name="safer"></a>
The <em>:safer</em> command is exactly like <code>:source</code>, except that
<code>:safer</code> will temporarily set the <a href="elvisopt.html#safer">safer</a>
option while it is executing the commands.
You should use <code>:safer</code> instead of <code>:source</code> when it is possible
that the file to be executed could contain potentially harmful commands.
For example, the default "elvis.ini" file uses <code>:source</code> to execute
the ".exrc" file in your home directory since it is presumably secure,
but <code>:safer</code> is used to execute the ".exrc" file in the current
directory since it could have been created by anybody.
<p><a name="alias"></a><a name="unalias"></a>
The <em>:alias</em> and <em>:unalias</em> commands manipulate the alias list.
(See the <a href="elvistip.html#ALIAS">Tips</a> section of the manual for
a discussion of aliases.)
With no arguments, <code>:alias</code> displays all aliases.
When given a name but no commands, <code>:alias</code> displays the complete definition of
the named alias.
When given a name and commands, <code>:alias</code> defines (or redefines) an
alias.
The <code>:unalias</code> command deletes the alias with a given name.
<h3><a name="ERRLIST"></a>4.3.10 Working with a compiler</h3>
<pre graphic>.-------.-------------------.-----------------------------------.
|ADDRESS| COMMAND | ARGUMENTS |
|-------|-------------------|-----------------------------------|
| | <a href="#cc">cc</a>[!] | [args] |
| | <a href="#make">mak[e]</a>[!] | [args] |
| | <a href="#errlist">er[rlist]</a>[!] | [file] |
^-------^-------------------^-----------------------------------^
</pre>
If you use elvis to edit source code for programs, then you can have
elvis read the output of your compiler and parse that output for error
messages.
When elvis finds an error message, it can move the cursor to the file and
line number where the error was reported.
<p>To parse the compiler output, elvis first breaks the output into lines.
Each line is then broken into words.
If a word looks like a number, then it is assumed to be a line number.
If a word looks like the name of an existing file, then it is assumed to
be a file name.
Any line which contains both a line number and a file name is treated as
an error report (with the remainder of the line serving as a description
of the error); lines which don't have both of these are simply ignored.
<p><a name="cc"></a><a name="make"></a>
The <em>:cc</em> and <em>:make</em> commands use the
<a href="elvisopt.html#ccprg">ccprg</a> and
<a href="elvisopt.html#makeprg">makeprg</a> options, respectively,
to run your compiler or "make" utility, and collect the output.
Elvis will then move the cursor to where the first error was detected.
(If there were no errors, elvis will say so and leave the cursor unchanged.)
<p><a name="errlist"></a>
After that, the <em>:errlist</em> command can be used repeatedly to move
to each successive error.
You can also use the <code>:errlist</code> command with a file name argument
to load a new batch of error messages from a file; the cursor is then moved
to the first error in that batch.
<h3><a name="CALC"></a>4.3.11 Built-in calculator</h3>
<pre graphic>.-------.-------------------.-----------------------------------.
|ADDRESS| COMMAND | ARGUMENTS |
|-------|-------------------|-----------------------------------|
| | <a href="#calculate">ca[lculate]</a> | expr |
| | <a href="#eval">ev[al]</a> | expr |
^-------^-------------------^-----------------------------------^
</pre>
Elvis has a built-in calculator which uses a C-like syntax.
It is described in section <a href="elvisexp.html">12: Arithmetic Expressions.</a>
The <a href="#if">:if</a> and <a href="#let">:let</a> commands also use
the calculator.
<p><a name="calculate"></a>
The <em>:calculate</em> command evaluates an expression and displays the
result.
<p><a name="eval"></a>
The <em>:eval</em> command evaluates an expression using the simpler syntax
(which basically means that text outside of parentheses is left alone),
and then executes the result as an ex command line.
This provides a way to use expressions with commands which would not
ordinarily use expressions.
For example, the following command line inserts the value the
<a href="elvisopt.html#elvispath">elvispath</a> option into the current
edit buffer.
<pre>:eval insert elvispath=(elvispath)</pre>
<p><strong>Note:</strong>
There is a hardcoded limit of (normally) 1023 characters for the result of
any expression. This limit will sometimes impact the use of :eval.
For example, if your <code>$EXINIT</code> environment variable is longer
than 1023 characters then elvis will be unable to interpret it during
initialization.
<h3><a name="BUFFER"></a>4.3.12 Buffer commands</h3>
<pre graphic>.-------.-------------------.-----------------------------------.
|ADDRESS| COMMAND | ARGUMENTS |
|-------|-------------------|-----------------------------------|
| | <a href="#all">al[l]</a>[!] | excmds |
| | <a href="#buffer">b[uffer]</a>[!] | [buffer] |
| | <a href="#OPEN">(</a> | buffer |
| | <a href="#bbrowse">bb[rowse]</a>[!] | |
| | <a href="#sbbrowse">sbb[rowse]</a>[!] | |
^-------^-------------------^-----------------------------------^
</pre>
<a name="all"></a>
The <em>:all</em> command applies a given ex command line to each edit buffer
in turn.
Normally the command is applied just to the user edit buffers, but if you
append a "!" to the command name, then the ex command line is applied to
internal buffers as well.
For example, the following sets the "bufdisplay" option of all user
edit buffers:
<pre>:all set bufdisplay=normal</pre>
<p>In script files, you can supply multiple command lines to a single
<code>:all</code> commands
by placing a '{' character on the <code>:all</code>
line, following that with any number of command lines, and then finally a '}'
character on a line by itself to mark the end.
This notation doesn't allow nesting; you can't use {...} inside a larger
{...} command list.
(Hopefully this limitation will be lifted soon.)
<p><a name="buffer"></a>
The <em>:buffer</em> command lists either all user edit buffers, or
(when "!" is appended to the command name) <em>all</em> buffers including
internal ones.
If the buffer is being edited in one or more windows, then the window ID
is also displayed.
Buffers which have been modified will be marked with an asterisk.
<p>You can also use the <code>:buffer</code> command to make the current window
display a different buffer.
<p><a name="OPEN"></a>
The <em>:(buffer</em> notation causes the current window to display the
named buffer, instead of the current buffer.
This isn't really a command;
it is part of an address.
Whenever you give an address without specifying a command, elvis
moves the cursor to the addressed line.
In this particular case, we're addressing the most recently changed line
of a given buffer, so that's where the cursor is moved to.
For more information, see the discussion of <a href="#BUFFERID">Buffer IDs</a>
earlier in this chapter (in the discussion of addresses).
<p><a name="bbrowse"></a><a name="sbbrowse"></a>
The <em>:bbrowse</em> and <em>:sbbrowse</em> commands create an HTML document
which lists the names of all user buffers (or, when a '!' is appended to the
command name, <em>all</em> buffers including internal buffers).
You can then go to one of the buffers just by following the hypertext link.
The difference between these two commands is that <code>:bbrowse</code> displays
the list in the current window, but <code>:sbbrowse</code> creates a new
window to display it.
<h3><a name="WINDOW"></a>4.3.13 Window commands</h3>
<pre graphic>.-------.-------------------.-----------------------------------.
|ADDRESS| COMMAND | ARGUMENTS |
|-------|-------------------|-----------------------------------|
| | <a href="#split">sp[lit]</a> | [+line] [file | !shellcmd] |
| | <a href="#new">new</a> | |
| | <a href="#snew">sne[w]</a> | |
| | <a href="#snext">sn[ext]</a> | [file...] |
| | <a href="#sNext">sN[ext]</a> | |
| | <a href="#srewind">sre[wind]</a> | |
| | <a href="#slast">sl[ast]</a> | |
| | <a href="#stag">sta[g]</a> | [tag] |
| | <a href="#sbrowse">sb[rowse]</a> | restrictions |
| | <a href="#sall">sa[ll]</a> | |
| | <a href="#window">wi[ndow]</a> | [ +[+] | -[-] | number | buffer] |
| | <a href="#display">di[splay]</a> | [modename [language]] |
| | <a href="#normal">no[rmal]</a> | |
^-------^-------------------^-----------------------------------^
</pre>
<a name="split"></a>
The <em>:split</em> command creates a new window.
If you supply a file name, then it will load that file into an edit buffer
and the new window will show that buffer.
If you supply a shell command line preceded by a '!' character, then it
will create an untitled buffer, and read the output of that command line
into the buffer.
Otherwise, the new window will show the same buffer as the current window.
<p><a name="new"></a><a name="snew"></a>
The <em>:new</em> and <em>:snew</em> commands are identical to each other.
They both create a new empty buffer, and then create a new window to
show that buffer.
<p><a name="snext"></a><a name="sNext"></a><a name="srewind"></a>
<a name="slast"></a><a name="stag"></a><a name="sbrowse"></a>
The <em>:snext, :sNext, :srewind, :slast, :stag, </em> and <em>:sbrowse</em>
commands resemble the
<a href="#next">:next,</a>
<a href="#Next">:Next,</a>
<a href="#rewind">:rewind,</a>
<a href="#last">:last,</a>
<a href="#tag">:tag,</a> and
<a href="#browse">:browse</a>
commands, respectively,
except that these "s" versions create a new window for the newly loaded file,
and leave the current window unchanged.
<p><a name="sall"></a>
The <em>:sall</em> command creates a new window for any files named in the
args list, which don't already have a window.
(See section <a href="#ARGS">4.3.7: The args list...</a> for a discussion
of the args list.)
<p><a name="window"></a>
The <em>:window</em> command either lists all windows
(when invoked with no arguments) or switches to a given window.
You can specify which to switch to by giving one of the following
arguments.
<pre graphic>
.----------.-----------------------------------------------.
| ARGUMENT | MEANING |
|----------|-----------------------------------------------|
| + | Switch to the next window, like <a href="elvisvi.html#^Wk">^Wk</a> |
| ++ | Switch to the next window, wrapping like <a href="elvisvi.html#^W^W">^W^W</a> |
| - | Switch to the previous window, like <a href="elvisvi.html#^Wj">^Wj</a> |
| -- | Switch to the previous window, wrapping |
| number | Switch to the window whose windowid=number |
| buffer | Switch to the window editing the named buffer |
^----------^-----------------------------------------------^</pre>
<p><a name="display"></a>
The <em>:display</em> command switches the window to a new display mode,
overriding the value of the <a href="elvisopt.html#bufdisplay">bufdisplay</a>
option.
The <a href="elvisopt.html#display">display</a> option indicates the current
display mode.
If you omit the new modename, then the <code>:display</code> command will list
all supported display modes, with an asterisk next to the current mode.
The "syntax" mode allows you to specify which language's syntax it is supposed
to use; if you don't specify a language, elvis will guess the language from
the file name's extension.
<p><a name="normal"></a>
The <em>:normal</em> command is equivalent to "<code>:display normal</code>".
It can be abbreviated to ":no", which is certainly easier to type than
":dis normal".
<h3><a name="SETUP"></a>4.3.14 Configuration</h3>
<pre graphic>.-------.-------------------.-----------------------------------.
|ADDRESS| COMMAND | ARGUMENTS |
|-------|-------------------|-----------------------------------|
| | <a href="#abbreviate">ab[breviate]</a>[!] | [lhs rhs] |
| | <a href="#unabbreviate">una[bbreviate]</a>[!] | lhs |
| | <a href="#map">map</a>[!] | [lhs rhs] |
| | <a href="#unmap">unm[ap]</a>[!] | lhs |
| | <a href="#break">bre[ak]</a>[!] | lhs |
| | <a href="#unbreak">unb[reak]</a>[!] | lhs |
| | <a href="#digraph">dig[raph]</a>[!] | [lhs [rhs]] |
| | <a href="#color">col[or]</a> | [font color ["on" color]] |
| | <a href="#gui">gu[i]</a> | text |
| | <a href="#set">se[t]</a>[!] | [option=value | option? | all] |
| | <a href="#let">le[t]</a>[!] | option=expr |
| | <a href="#if">if</a> | expr |
| | <a href="#then">th[en]</a> | excmds |
| | <a href="#else">el[se]</a> | excmds |
| | <a href="#while">wh[ile]</a> | expr |
| | <a href="#do">do</a> | excmds |
| | <a href="#mkexrc">mk[exrc]</a>[!] | [file] |
^-------^-------------------^-----------------------------------^
</pre>
<a name="abbreviate"></a><a name="unabbreviate"></a>
The <em>:abbreviate</em> and <em>:unabbreviate</em> commands add and remove
entries to the abbreviation table, respectively.
Also, the <code>:abbreviate</code> command can be used with no arguments to list
the current contents of the abbreviation table.
For a discussion of abbreviations, see section
<a href="elvisinp.html#ABBR">3.3: Abbreviations.</a>
<p><a name="map"></a><a name="unmap"></a>
The <em>:map</em> and <em>:unmap</em> commands add and remove entries to the
map tables, respectively.
When the <code>:map</code> command is given without any arguments, it lists
the contents of a map table.
<p>There are two map tables.
When a "!" is appended to the command name, these commands use the table
that applies to input mode; without the "!" these commands use the table
that applied to visual command mode.
<p>The primary purpose of map tables is to assign actions to the cursor keypad
and the function keys.
Each of these keys sends an arbitrary but distinctive sequence of characters
when pressed.
The map tables are used to convert these arbitrary character sequences into
command keystrokes that elvis can do something useful with.
For example, arrow keys are normally mapped to the
<a href="elvisvi.html#h">h,</a>
<a href="elvisvi.html#j">j,</a>
<a href="elvisvi.html#k">k,</a> and
<a href="elvisvi.html#l">l</a> commands.
<p>The first argument to <code>:map</code> is the raw character sequence sent
by a key, and the remaining arguments are the characters that elvis should
pretend you pressed.
This can be either a literal sequence of characters, or a gui-dependent
symbol representing a particular keystroke.
See the <a href="elvisgui.html">User Interfaces</a> chapter for lists of
keystrokes.
Also, function keys can usually be denoted by #1 for the <F1> key,
#2 for the <F2> key, and so on.
<p>The second argument is character sequence that elvis should pretend you
typed whenever the raw characters are received.
This may be preceded by the word "visual" which causes the
remaining argument characters to be processed as visual commands, even if
the key is pressed in input mode.
This trick is used to allow the cursor to be moved via the arrow keys when
in input mode.
<p><a name="break"></a><a name="unbreak"></a>
The <em>:break</em> and <em>:unbreak</em> commands set and reset the breakpoint
flag for a given macro, respectively.
This is used for debugging macros, as described in section
<a href="elvistip.html#DEBUG">16.3: How to debug macros.</a>
If a macro has its breakpoint flag set, and the
<a href="elvisopt.html#maptrace">maptrace</a> option is set to <strong>run,</strong>
then when that map is encountered elvis will automatically switch maptrace
to <strong>step</strong> mode.
<p><a name="digraph"></a>
The <em>:digraph</em> command manipulates the digraph table.
(See section <a href="elvisinp.html#DIG">3.2: Digraphs</a> for a discussion
on digraphs.)
With no arguments, it lists the digraph table.
With one argument, it removes the given digraph from the table.
With two arguments, it adds the given digraph to the table, or
if the same two ASCII characters are already in the table then it alters
the existing entry.
<p>Normally, the <code>:digraph</code> command sets the most significant bit
in the last argument's character.
That way you don't need to be able to type a non-ASCII character on your
keyboard in order to enter it into the table; you can type the ASCII
equivalent and allow elvis to convert it to non-ASCII before storing the
digraph.
If you don't want elvis to set the most significant bit, then append a
"!" to the end of the command name.
<p><a name="color"></a>
The <em>:color</em> command allows you to choose a color to use for displaying
each font.
Some user interfaces don't support this.
The ones that do will vary in the color names that they support.
The <a href="elvisgui.html#termcap">termcap</a> interface supports <strong>black, white, gray, red, green, blue,
brown, yellow, magenta,</strong> and <strong>cyan,</strong> plus
<strong>light</strong> or <strong>bright</strong> versions of most of those.
The <a href="elvisgui.html#windows">windows</a> interface supports the same
colors, except that it is pickier:
it doesn't allow spaces, and only "light" is accepted, such as "lightblue".
The <a href="elvisgui.html#x11">x11</a> interface supports all standard
X color names.
<p>The first argument should be the name of the font to change.
This can be "normal", "bold", "emphasized", "italic", "underlined",
or "fixed".
Some user interfaces may also support "standout", "cursor", "scrollbar",
and/or "toolbar".
All of these can be either spelled out completely, or abbreviated to
the first letter.
(Currently no user interface supports both "standout" and "scrollbar"
so there is no ambiguity.)
If you omit the font name, then "normal" is assumed.
The termcap interface requires you to assign a "normal" color before
any of the other fonts.
<p>You can specify an optional background color.
The word "on" is used to delimit the foreground color name from the background
color name.
For example, the command "<code>:color yellow on blue</code>" causes normal text
to be displayed as yellow characters on a blue background.
<p>The <a href="elvisgui.html#x11">x11</a> user interface allows you to specify
both the foreground and background color for the cursor. The cursor is drawn
in the foreground color normally, but the background color if elvis own the
current X selection.
<p><a name="gui"></a>
The <em>:gui</em> command provides a way to pass unusual commands to the
user interface.
Currently, the only user interface which uses this is the "x11" interface,
which uses it to <a href="elvisgui.html#x11.toolbar">configure the toolbar.</a>
<p><a name="set"></a>
The <em>:set</em> command allows you to examine or change the values of
<a href="elvisopt.html">options.</a>
Using <em>:set!</em> (with a "!" to the end of the command name) causes it to
include the group name of any option that is output.
<p>With no arguments, <code>:set</code> lists the names and values of any
options that have been altered or are of frequent interest.
If given the argument "all" it will list the names and values of
most (but not really all) options.
If given the name of an option followed by a "?" character,
<code>:set</code> will output the option's name and value.
If given the name of a group of options, followed by a "?" character,
<code>:set</code> will output the names and values of all options in that group.
<p>To turn a Boolean option on, just give the name of the option.
You can turn it off by adding the prefix "no" to the option name, and you
can negate it by adding the "neg" prefix to its name.
<p>To change the value of a non-Boolean option, give the name followed
<em>immediately</em> by an "=" and the new value.
If the new value contains whitespace, you should either enclose the
entire value in quotes, or precede each whitespace character with a backslash.
<p>If you give the name of a non-Boolean option, without either
"=<var>value</var>" or "?", then elvis will display its value.
<pre graphic>
.-----------.--------------------------------------------------------.
| EXAMPLE | WHAT IT DOES |
|-----------|--------------------------------------------------------|
| :set | display names & values of changed/interesting options |
| :set all | display names & values of most POSIX-compliant options |
| :set ts? | display name & value of the tabstop option |
| :set lp? | display names & values of all printing options |
| :set ts=4 | set value of the tabstop option to 4 |
| :set ai | turn on the autoindent option |
| :set noai | turn off the autoindent option |
| :set negai| toggle the autoindent option |
^-----------^--------------------------------------------------------^</pre>
<p><a name="let"></a>
The <em>:let</em> command computes a new value for an option.
The <code>:let</code> command should be followed by the name of an option,
then an "=" sign, and then an <a href="elvisexp.html">expression</a>
that produces the new value.
Note that even Boolean options use the "=" notation here.
<p><a name="if"></a><a name="then"></a><a name="else"></a>
The <em>:if</em> command evaluates an <a href="elvisexp.html">expression</a>,
and sets an internal variable according to whether the result was true or false.
Later, the <em>:then</em> and <em>:else</em> commands can be used to test
that variable, and conditionally execute other ex commands.
<p>Note that after an <code>:if</code> command, any other ex commands which
don't start with <code>:then</code> or <code>:else</code> will be executed
unconditionally.
Another thing to watch out for is the fact that there is only one "if" variable
and therefore you can't nest <code>:if</code> commands as you might expect.
<p>In script files, you can supply multiple command lines to a single
<code>:then</code> or <code>:else</code> by placing a '{' character on the
<code>:then/:else</code> line,
following that with any number of command lines, and then finally a '}'
character on a line by itself to mark the end.
<p><a name="while"></a><a name="do"></a>
The <em>:while</em> command stores an expression. It should be followed by
a <em>:do</em> command; the <code>:do</code> command repeatedly evaluates
the expression, and as long as the result is true it executes the commands
which follow the <code>:do</code>.
<p>Both the <code>:if/:then/:else</code> and <code>:while/:do</code> command
structures permit nesting. I.e., the commands in a <code>:then</code> command
can't affect the "if" variable to cause the <code>:else</code> command to
also be executed.
<p><a name="mkexrc"></a>
The <em>:mkexrc</em> command creates a file containing ex commands which
recreate the current map, abbreviation, and digraph tables, and also sets
any options which have been changed.
Basically it stores your current configuration in a file which you can later
<code>:source</code> to restore your configuration.
If you don't specify a filename, then it will write to ".exrc" or "elvis.rc"
in the current directory.
<h3><a name="MISC"></a>4.3.15 Miscellaneous</h3>
<pre graphic>.-------.-------------------.-----------------------------------.
|ADDRESS| COMMAND | ARGUMENTS |
|-------|-------------------|-----------------------------------|
| | <a href="#QUOTE">"</a> | text |
| | <a href="#cd">cd</a>[!] | [directory] |
| | <a href="#chdir">chd[ir]</a>[!] | [directory] |
| | <a href="#echo">ec[ho]</a> | text |
| | <a href="#shell">sh[ell]</a> | |
| | <a href="#stop">st[op]</a>[!] | |
| | <a href="#suspend">sus[pend]</a>[!] | |
| | <a href="#version">ve[rsion]</a> | |
| line | <a href="#goto">go[to]</a> | |
| line | <a href="#mark">ma[rk]</a> | mark |
| line | <a href="#k">k</a> | mark |
| | <a href="#OCUR">{</a> | |
^-------^-------------------^-----------------------------------^
</pre>
<a name="QUOTE"></a>
The <em>"</em> command causes the remainder of the line to be ignored.
It is used for inserting comments into ex scripts.
<p><a name="cd"></a><a name="chdir"></a>
The <em>:cd</em> and <em>:chdir</em> commands are identical.
They both change the current working directory for elvis and all its windows.
If you don't specify a new directory name then elvis will switch to your
home directory.
<p><a name="echo"></a>
The <em>:echo</em> command displays its arguments as a message.
This may be useful in ex scripts.
<p><a name="shell"></a>
The <em>:shell</em> command starts up an interactive shell
(command-line interpreter).
Elvis will be suspended while the shell executes.
(Exception: the "x11" GUI runs the shell in a separate xterm window.
The elvis and the shell can then run simultaneously.)
<p><a name="stop"></a><a name="suspend"></a>
The <em>:stop</em> and <em>:suspend</em> commands are identical to each other.
If the operating system and user interface support it, they will suspend
elvis and resume the shell that started elvis.
(This is like hitting <kbd>^Z</kbd> on many UNIX systems.)
If the OS or GUI don't support it, then elvis will generally treat these
commands as synonyms for the <code>:shell</code> command.
<p><a name="version"></a>
The <em>:version</em> command identifies this version number of elvis,
and displays credits.
<p><a name="goto"></a>
The <em>:goto</em> moves the cursor to the addressed line.
This is the only command which can be abbreviated down to zero characters,
so if you type in a line containing just a line address, then elvis will
treat that as a <code>:goto</code> command.
<p><a name="mark"></a><a name="k"></a>
The <em>:mark</em> and <em>:k</em> commands are identical to each other.
They set a named mark to equal the addressed line, or the current line if
no address was given.
<p><a name="OCUR"></a>
The <em>{ commands }</em> notation isn't really a command;
it is a feature of elvis' syntax which allows you to pass several command lines
to a command which normally expects a single command line as its argument.
It is supported by the
<a href="#global">:global</a>, <a href="#vglobal">:vglobal</a>,
<a href="#all">:all</a>, <a href="#then">:then</a>, and <a href="#else">:else</a>
commands.
Instead of placing the argument command at the end of one of those command
lines, you can place a single '{' character there.
That should be followed by one or more command lines, and terminated
by a '}' on a line by itself.
<h2><a name="INDEX"></a>4.4 Alphabetical list of ex commands</h2>
<pre graphic>
.-------.-------------------.-----------------------------------.
|ADDRESS| COMMAND | ARGUMENTS |
|-------|-------------------|-----------------------------------|
| | <a href="#abbreviate">ab[breviate]</a>[!] | [lhs rhs] |
| | <a href="#all">al[l]</a>[!] | excmds |
| line | <a href="#append">a[ppend]</a>[!] | [text] |
| | <a href="#args">ar[gs]</a> | [file...] |
| | <a href="#bbrowse">bb[rowse]</a> | |
| | <a href="#break">bre[ak]</a>[!] | lhs |
| | <a href="#browse">br[owse]</a>[!] | restrictions |
| | <a href="#buffer">b[uffer]</a>[!] | [buffer] |
| | <a href="#calculate">ca[lculate]</a> | expr |
| | <a href="#cc">cc</a>[!] | [args] |
| | <a href="#cd">cd</a>[!] | [directory] |
| range | <a href="#change">c[hange]</a>[!] | [count] [text] |
| | <a href="#chdir">chd[ir]</a>[!] | [directory] |
| | <a href="#close">cl[ose]</a>[!] | |
| | <a href="#color">col[or]</a> | [font color ["on" color]] |
| range | <a href="#copy">co[py]</a> | line |
| range | <a href="#delete">d[elete]</a> | [cutbuf] [count] |
| | <a href="#digraph">dig[raph]</a>[!] | [lhs [rhs]] |
| | <a href="#display">di[splay]</a> | [modename [language]] |
| | <a href="#do">do</a> | excmds |
| | <a href="#echo">ec[ho]</a> | text |
| | <a href="#edit">e[dit]</a>[!] | [+line] [file] |
| | <a href="#else">el[se]</a> | excmds |
| | <a href="#errlist">er[rlist]</a>[!] | [file] |
| | <a href="#eval">ev[al]</a> | expr |
| | <a href="#ex">ex</a>[!] | [+line] [file] |
| | <a href="#file">f[ile]</a> | [file] |
| range | <a href="#global">g[lobal]</a>[!] | /regexp/ excmds |
| line | <a href="#goto">go[to]</a> | |
| | <a href="#gui">gu[i]</a> | text |
| | <a href="#help">h[elp]</a> | topic |
| | <a href="#if">if</a> | expr |
| line | <a href="#insert">i[nsert]</a>[!] | [text] |
| range | <a href="#join">j[oin]</a>[!] | |
| line | <a href="#k">k</a> | mark |
| | <a href="#last">la[st]</a> | |
| | <a href="#let">le[t]</a>[!] | option=expr |
| range | <a href="#list">l[ist]</a> | [count] |
| range | <a href="#lpr">lp[r]</a>[!] | [ file | >>file | !shellcmd ] |
| | <a href="#make">mak[e]</a>[!] | [args] |
| | <a href="#map">map</a>[!] | [lhs rhs] |
| line | <a href="#mark">ma[rk]</a> | mark |
| | <a href="#mkexrc">mk[exrc]</a>[!] | [file] |
| range | <a href="#move">m[ove]</a> | line |
| | <a href="#new">new</a> | |
| | <a href="#next">n[ext]</a>[!] | [file...] |
| | <a href="#Next">N[ext]</a>[!] | |
| | <a href="#normal">no[rmal]</a> | |
| range | <a href="#number">nu[mber]</a> | [count] |
| | <a href="#open">o[pen]</a>[!] | [+line] [file] |
| | <a href="#pop">po[p]</a>[!] | |
| | <a href="#previous">pre[vious]</a>[!] | |
| range | <a href="#print">p[rint]</a> | [count] |
| line | <a href="#put">pu[t]</a> | [cutbuf] |
| | <a href="#qall">qa[ll]</a>[!] | |
| | <a href="#quit">q[uit]</a>[!] | |
| line | <a href="#read">r[ead]</a> | file | !shellcmd |
| | <a href="#redo">red[o]</a>[!] | [count] |
| | <a href="#rewind">rew[ind]</a>[!] | |
| | <a href="#sNext">sN[ext]</a> | |
| | <a href="#safer">saf[er]</a>[!] | file |
| | <a href="#sall">sa[ll]</a> | |
| | <a href="#sbbrowse">sbb[rowse]</a> | |
| | <a href="#sbrowse">sb[rowse]</a> | restrictions |
| | <a href="#set">se[t]</a>[!] | [option=value | option? | all] |
| | <a href="#shell">sh[ell]</a> | |
| | <a href="#slast">sl[ast]</a> | |
| | <a href="#snew">sne[w]</a> | |
| | <a href="#snext">sn[ext]</a> | [file...] |
| | <a href="#source">so[urce]</a>[!] | file |
| | <a href="#split">sp[lit]</a> | [file | !shellcmd] |
| | <a href="#srewind">sre[wind]</a>[!] | |
| | <a href="#stack">stac[k]</a> | |
| | <a href="#stag">sta[g]</a> | [tag] |
| | <a href="#stop">st[op]</a>[!] | |
| range | <a href="#substitute">s[ubstitute]</a> | /regexp/newtext/[g][p][x][count] |
| | <a href="#suspend">sus[pend]</a>[!] | |
| | <a href="#tag">ta[g]</a>[!] | [tag] |
| | <a href="#then">th[en]</a> | excmds |
| range | <a href="#to">t[o]</a> | line |
| | <a href="#unabbreviate">una[bbreviate]</a>[!] | lhs |
| | <a href="#unbreak">unb[reak]</a>[!] | lhs |
| | <a href="#undo">u[ndo]</a> | [count] |
| | <a href="#unmap">unm[ap]</a>[!] | lhs |
| | <a href="#version">ve[rsion]</a> | |
| range | <a href="#vglobal">v[global]</a>[!] | /regexp/ excmds |
| | <a href="#visual">vi[sual]</a>[!] | [+line] [file] |
| | <a href="#while">wh[ile]</a> | expr |
| | <a href="#window">wi[ndow]</a> | [+ | - | number | buffer ] |
| | <a href="#wnext">wn[ext]</a>[!] | |
| | <a href="#wquit">wq[uit]</a>[!] | [file] |
| range | <a href="#write">w[rite]</a>[!] | [file | >>file | !shellcmd] |
| | <a href="#xit">x[it]</a>[!] | [file] |
| range | <a href="#yank">y[ank]</a> | [cutbuf] [count] |
| line | <a href="#z">z</a> | [spec] |
| range | <a href="#BANG">!</a> | shellcmd |
| | <a href="#QUOTE">"</a> | text |
| range | <a href="#HASH">#</a> | [count] |
| range | <a href="#AMP">&</a> | |
| | <a href="#OPEN">(</a> | buffer |
| range | <a href="#LT"><</a> | |
| range | <a href="#EQ">=</a> | |
| range | <a href="#GT">></a> | |
| | <a href="#AT">@</a> | cutbuf |
| | <a href="#OCUR">{</a> | |
| range | <a href="#TILDE">~</a> | |
^-------^-------------------^-----------------------------------^
</pre>
</body></html>
|