Help with ed, the line editor

The mud has a fairly versatile line editor available for your use in posting, on boards, in mail, in rn, and in hmplans.

Start posting as you normally would, and whenever you make any mistakes, or have any other reasons to break out ed, type ~e on its own line (if you use zmud, you may have to actually type ~~e, as ~ is the default quote character). If you do this right, you should have ed's prompt, looking something like this:


Ed uses two modes, which we'll call "command mode" and "edit mode." The colon is the prompt for command mode. In command mode, you can, enter commands to manipulate the text.

Edit mode works just like the editor you are used to for writing posts, with one exception: the only way to get out of it is with a single period (.) on a line, and instead of ending the post, it simply puts you back into command mode.

In command mode, there are several basic commands for deleting lines, inserting new text, and even more complex and exciting things. Most commands operate on line numbers. To see line numbers, type 'n' in command mode.

Now, probably the most important commands in ed are those which show us the text that has already been entered. The simplest of all is simply to type in the line number or line range that you want to look at, and it will spit it back to you (and set that as the current line). For instance, to see what's on line 5, simply type "5," to see lines 15 through 20, type "15,20." To see the next twenty lines or so from where the current line is, type "z" (or the similar command "Z," which shows about 40 lines at a time).

For posting, probably the most useful command is "d," which deletes lines. If you just type "d" by itself, it will delete the current line, and the line following becomes the new current line. However, most commands allow you to specify which lines you want to use them on by simply typing the line number(s) in before the command. For instance, if you don't like line 5, just type "5d," and if the whole section starting on line 15 and ending on line 20 needs to go, type "15,20d." If you want to delete all the lines in the post and get a fresh start, you can type "1,$d".

Perhaps even more useful, and definitely less dangerous, than "d" is "a," which stands for "append," and simply puts you into edit mode after the line you specify. For example, if you want to add a new line after line 5, type "5a" and begin typing (if 5 happens to be the current line, you can just type "a" and it will have the same effect). Type as many lines as you like, and when you're done, type a period to get back to command mode.

Closely related to "a" is "i," which stands for "insert." It will put you into edit mode before the line you specify. So, if you want to add a new line before line 7, type "7i" and enter your text. As with "a," enter a single period in order to get back to command mode.

That should be all you will need for basic posting using ed, to finish, and submit your post, at command mode, simply type "x," to exit. Please note that this immediately submits your post.

You can get a list of other functions in ed, and some basic help by invoking the help command in ed, aptly called "h." Just "h" will give a list of commands, while h<command> will give information on that command (for instance, hd will tell about the delete command, "d").