Previous Next Chapter

Repeating Commands in Extended Mode

Pressing Ctrl+G repeats a command line. You can set up execute complex sets of editing commands many times.

You can repeat a command a specified number of times by entering the number before the command. For example:

4 E/rename/copy/

exchanges the next four occurrences of "rename" to "copy".

Us the RP (Repeat) extended command to repeat a command until ED returns an error, such as reaching the end of the file. For example:

T;RP E/rename/copy/

moves the cursor to the top of the file, then exchanges all occurrences of "rename" with "copy". The T command (Top of File) changes all occurrences of Rename in the whole file. Otherwise, only the occurrences after the current cursor position are changed.

To execute command groups repeatedly, you can group the commands together in parentheses. You can also nest command groups. For example:

RP (F/Workbench/;3A//)

inserts three blank lines (the null string//) after every line containing Workbench.

To interrupt any sequence of extended commands, press any key during execution. If an error occurs, ED abandons the command sequence.

Customizing ED

You can customize ED with commands that change the menus and function key setup. These commands can be entered individually within ED. They can also be saved as a script, such as S:Ed-startup, or as a file specified using the WITH argument. To execute the file from within ED, use the Run File (Esc,R,F) extended command. For information about changing the function keys, see page 4-15.

Set Menu Item

Esc,S,I

Defines the menu headings and items. There are 120 menu item slots ranging from 0 to 119. The slot type identifies the contents of the slot and is a number from 0 to 4. The 0 slot type must be the last defined slot. Do not create a menu without items; if you specify a menu heading, include menu items after it. See below for the syntax of the Set Menu Item command and a table of the slot types.

Enable Menu

Esc,E,M

Enables menus. You must follow the Set Menu Item commands with EM to enable the menu commands. See page 4-22 for an example script using the Enable Menu command.

Set Menu Item

The following is the syntax for the Set Menu Item command:

SI <slot number> <slot type> /string1/string2/

The following table shows the slot types and functions used with the Set Menu Item command:

Type

Function

String Input

0

End of Menus

No arguments

1

Menu Heading

String1 = heading name

2

Menu Item

String1 = item name

String2 = command string

3

Submenu Heading

String1 = heading name

String2 = command string

4

Separator bar

No arguments

Example Script

The following is an example script using the Set Menu Item and Enable Menu commands. Quotation marks are used as the delimiters.

SI 0 1 "Project"
SI 1 2 "Open . . . " "op ? /Open file:/"
SI 2 2 "Save ... " "sa"
SI 3 4
SI 4 2 "Quit!" "q"
SI 5 1 "Move"
SI 6 2 "Top" "t"
SI 7 2 "Bottom" "b"
SI 8 0
EM

This script produces the menus illustrated in Figure 4-4:

Figure 4-4. ED Custom Menu Example

Printing From ED

Use the following steps to print a file that is open in the current ED window:

  1. Choose the Save As menu item to display a file requester.
  2. Enter prt: in the Drawer field.
  3. Select OK.

This prints the file, but does not save it to disk. If you wish to save the file you must select the Save menu item or Save As and a file name.

Quitting ED

You can exit ED in one of the following three ways:

Top Previous Next Chapter