MAINEDIT User's Guide, Chapter 1

previous   next   top   contents   index   framed top   this page unframed


1. MAINED Basics

MAINED was the first front end written for MAINEDIT and has the most complete set of commands for manipulating MAINEDIT's special facilities (such as buffers, windows, and executing modules). For this reason, users of the other front ends should familiarize themselves somewhat with this description of MAINED.

1.1. Notation Conventions

1.1.1. Case

MAINED does not distinguish between upper and lower case in command characters. Though most commands in this manual are shown in upper case, you may type them in upper or lower case.

1.2. Starting and Ending a MAINED Session

1.2.1. Initial Page and Line

If you are editing an existing file, MAINED asks for the page and line number at which to start editing. If you are editing a new file, you must start at the first line of the first page, so MAINED does not ask for the initial page and line.

In the Initial page.line prompt, the numbers in parentheses indicate the page and line number that MAINED uses by default. This is the point last edited in the file, as recorded in eparms. Thus, if you last edited the file at page 3, line 45, the prompt offers (3.45):

Initial page.line for old-file.txt (3.45):

Typing <eol> at this point accepts the offered default value. If you wish to start at another point you can type it in:

Initial page.line for foo.txt (6.8): 2.3<eol>

The above response tells MAINED to place the cursor at the third line of the second page of the file foo.txt. This can save time if you have a particular destination in mind. A response of n is equivalent to n.1; .n is equivalent to 1.n. A line number greater than the number of the last line on the specified page selects the last line on the page; a page number greater than the number of the last page in the file selects the last line in the file.

1.2.2. The $MAINED Group in the Parameter File

Some MAINED-specific parameters can be specified in the parameter in a group named $MAINED (see Chapter 2 of the MAINEDIT User's Guide for a discussion of the parameter file).

Several MAINED-specific options (see Chapter 16) can be specified as parameters. The options stickyTabs and wordWrap are available as parameters. In addition, the insertModeDefault option can be set by giving the parameter defaultModule the value insert, and the overstrikeModeDefault option can be set by giving the parameter defaultModule the value overstrike.

The parameter autoSaveInterval is used to set the initial value of autoSaveLimit, as described in Section 13.8. The parameter tabStops is used to set tab stops, as if its value were given as an argument to the Q<tab> command.

1.2.3. Finishing the Edit Session

When you are ready to end your edit session, type QF. If you have made changes to the buffer, MAINED prompts in the message line to ask if you want the buffer saved:

Write buffer FOO.BAR (Yes No)?

If you type Y or y in response, MAINED writes the buffer into a file. If you type N or n, MAINED does not write the buffer. This means that none of your changes since you last saved the buffer is recorded, so be careful that this is what you really want.

The name of the output file is normally the same as the name of the input file (you can change the name to be used for the output file by using the Q.F command described in Chapter 10). If the kind of file you are editing supports file versions, a new version is created for the output file. Otherwise, you are prompted whether to delete the existing file, so that the new file can replace it. If you say no (N), then you are prompted for a new file name to be used for the output file.

If you try to save a file that has been modified since the last time the editor saved it, the editor asks you to confirm whether to overwrite the file.

Before returning control to the operating system or MAINEX prompt after a QF command, MAINED blanks the screen.

1.3. Modes

In MAINED your keystrokes either:

  1. Form command characters or answer prompts. This mode is called command mode.

  2. Are inserted into the buffer. This is insert mode.

  3. Are overstruck into the buffer. This is overstrike mode.

  4. Are interpreted by a MAINSAIL module other than the editor. This is escape mode.

1.3.1. Command Mode

When MAINED is first invoked, command mode is in effect. Any input is interpreted as commands, except for responses to prompts. The status line at the top of the buffer indicates command mode with a C.

1.3.2. Insert Mode

The command I (typed while in command mode) puts MAINED into insert mode. The I command changes the letter in the status line to I. In insert mode, characters are inserted into the text in the buffer at the cursor. Any characters to the right of the cursor on the current line are moved to the right. Typing <eol> in insert mode terminates the current line and begins a new one below; any text to the right of the cursor is moved to the beginning of the new line.

1.3.3. Overstrike Mode

The command O (typed while in command mode) puts MAINED into overstrike mode. The O command changes the letter in the status line to O. In overstrike mode, characters at the cursor are overwritten (replaced). Typing <eol> in overstrike mode moves the cursor to the beginning of the next line without altering the existing line.

1.3.4. Escape Mode

In escape mode, keystrokes are intercepted and interpreted by some program other than the editor. The effect of various keys depends on the program. Refer to Chapter 17 for more information on escape mode.

1.3.5. Returning to Command Mode

A special non-printing key is needed to leave insert or overstrike mode. This key, called <ecm> (Enter Command Mode), puts MAINED into command mode from either insert or overstrike mode. <ecm> typed while in command mode aborts the current command (if in the midst of entering a multicharacter command) and remains in command mode. <ecm> typed in escape mode is interpreted by the program that is intercepting keystrokes, and may or may not enter command mode (but by convention usually does).

The actual key to press for <ecm> is terminal-dependent. See the description of your display module in Appendix B of the MAINEDIT User's Guide to determine the <ecm> key for your terminal.

1.4. Basic Editing Commands

The following sections briefly describe a few commands to allow you to move the cursor, scroll the window, and delete objects. Together with insert and overstrike mode, these are enough to allow simple editing.

1.4.1. Moving the Cursor

Six commands for moving the cursor are shown in Table 1–1. These commands can be modified by first typing the number of columns or words by which you want to move. Thus, 5< moves the cursor left by 5 columns.

Table 1–1. Basic Cursor Movement Commands
Command Move Cursor:
< left
> right
^ up
\ down
( left one word
) right one word

The commands shown in Table 1–1 work for any terminal. On many terminals, there are keys marked with arrows pointing left, right, up, and down. These keys are mapped by default to perform the commands >, <, ^, and \, respectively. Refer to the keypad mappings for supported terminals given in Appendix B of the MAINEDIT User's Guide.

1.4.2. Windowing

The text in the current window can be scrolled up or down with the commands shown in Table 1–2.

Table 1–2. Basic Scrolling Commands
Command Scroll:
W up 4/5 of a screen
-W down 4/5 of a screen
nW up n lines (n must be present)
-nW down n lines (n must be present)

1.4.3. Deleting

Text can be deleted by means of the commands shown in Table 1–3. Any of these commands can be modified with a count to indicate how many objects to delete. For example, 5K deletes five characters.

Table 1–3. Basic Commands for Deleting Text
Command Delete Current:
K or DC character
DW word
DL line
DP page

1.5. Current Character, Word, Line, and Page

Most MAINED commands deal with the “current” character, word, line, or page.

The current character is the one at which the cursor is positioned. If the cursor is beyond the end of the line, then there is no current character.

The current word is the word that contains the current character. A word is any sequence of visible characters, separated from other words by blank space (i.e., space or tab characters) or by the end of a line. If the cursor is not under a visible character, then the current word is the blank space from the cursor up to the next word to the right, if there is a word to the right of the cursor; otherwise there is no current word.

The current line is the one that contains the cursor. The cursor can be anywhere on the line.

The current page is the one that contains the cursor. The cursor can be anywhere on the page, including the initial page mark (which is considered to be line zero of the page).

1.6. MAINED Window Appearance

MAINED windows by default show special characters (colons, asterisks, and Es) in the margins. This display is suppressed by default in some of the other front ends, although the it can be disabled in MAINED or reenabled with special commands in the other front ends.

1.6.1. Margins

The columns of colons on the left and right sides of the screen mark the left and right margins, respectively. There is no limit to the length of a line of text, though you can see at any one time only what can be displayed on your screen. If a line of text extends beyond a margin, an asterisk (*) is used in place of the colon as a margin marker. For example:

:This line contains text beyond the right marginb*
:
The text is not visible on the screenbut is     :
:"
therenevertheless.                             :

The display of the colons may be disabled, as described in Chapter 16.

1.6.2. Buffer End

The Es at the lower left margin indicate “end-of-buffer”. That is, there is no more text beyond the last colon printed. In this case the right margin is blank.

1.7. Pages and Page Marks

Type P to insert an end-of-page character immediately ahead of the current line. MAINED indicates the end-of-page on your screen with a page mark, which shows the number of the page. The first page in a buffer is number one, and it starts with the beginning of the file instead of a page mark. The last page is terminated by the end of the file instead of a page mark. See Figure 1–2 of the MAINEDIT User's Guide.

To delete a page mark, place the cursor anywhere on the line containing the page mark, and type DL (Delete Line). Insertion or deletion of a page mark automatically updates page numbers in any page marks visible on the screen. The G (Go) command moves the cursor to a specified page and line.

1.8. Buffer Names

Buffer names may be abbreviated in most commands that prompt for buffer names (the exceptions are the .K command and its variants, which require the full name of the buffer to be killed). A buffer name abbreviation is any substring of a buffer name.

If the string typed in response to a prompt for a buffer matches the name of some buffer exactly, that buffer is selected. If the string typed is a substring of exactly one buffer name, that buffer is selected. If the string typed is a substring of more than one buffer name, one of the buffers is selected (no guarantee is given on which one).

To force the creation of a new buffer with a name that is the substring of an existing buffer name, first create a buffer the name of which is not a substring of any existing buffer name, then rename the buffer with the Q.B command.

1.9. MAINED Special Keys

The keys marked with an asterisk in Table 1–4 are user-redefinable as macro IDs. In all command descriptions in this manual, the keys are assumed not to have been redefined; commands using these keys behave differently if they have been redefined. See Chapter 14 for an explanation of how to redefine these keys.

Table 1–4. Key Name Abbreviations
Key Name Meaning
<del> DELete (or rubout)
* <eol> End Of Line (marked RETURN or ENTER on most keyboards)
* <tab> horizontal TAB
* <lf> LineFeed
<sp> SPace bar
* <bs> Back Space
<ecm> Enter Command Mode
<abort> ABORT command
<esc> ESCape key

The remainder of the MAINED portion of this manual documents all MAINED commands, and is required reading for full use of MAINED's features. All the MAINED commands and their uses, as well as the handling of buffers, files, and windows, are discussed in detail.

Appendix B is a command summary for quick reference; the commands are summarized there in alphabetic order.


previous   next   top   contents   index   framed top   this page unframed

MAINEDIT User's Guide, Chapter 1