MAINEDIT User's Guide, Chapter 2

previous   next   top   contents   index   framed top   this page unframed


2. Command Syntax

The basic syntax of MAINED commands is:

modifiers   basicCommand    object

The four types of modifiers are direction, count, emphasis, and special. They can be specified in any order, as long as they precede basicCommand. The object must follow basicCommand. Not all basic commands need or allow the use of modifiers or objects.

2.1. Direction (+ or -)

For many commands, + (plus) indicates “toward the end of the buffer”, and - (minus) indicates “toward the beginning of the buffer”. + is the default in such commands.

Some commands, such as .B, F, X, and Y, use the + or - modifiers in their own special ways. See the descriptions of those commands for details. In some commands, both + and - may be used. In some commands, the number of +'s or -'s is important, and the command may contain more than one + or -.

2.2. Count (n)

This modifier (where n is a nonnegative integer) is used in two similar ways. As a count, it indicates the number of times a command is to be repeated. As a quantifier, it specifies an exact target; for example:

Command Action
< Move the cursor left one column
n< Move the cursor left n columns
G Go to next page
nG Go to page n

The effects of quantifiers are included in the description of each command.

2.3. Emphasis (Q)

The Q modifier generally indicates emphasis, or “do the following command in a big way”. Thus, it often plays the role of an infinite count, though it can also indicate a special case of the command. For example, with the D (Delete) command:

3DW    Delete three words
QDW    Delete all remaining words on the current line

Command descriptions often describe the Q modifier as giving a command an effect over “all characters”, “all words”, or “all lines”. Such character and word ranges are limited to the current line, and such line ranges are limited to the current page (although they may be partially outside the current window).

Some commands perform differently depending on how many times the Q modifier is repeated; that is, a command can contain multiple Qs.

2.4. Special ($)

Some commands can be prefixed with the modifier $. Like the direction and emphasis modifiers, a command can sometimes contain more than one $. For example:

5$G                             Go to absolute line number 5
$TsearchString<eol>       Search for searchString case-sensitively

2.5. Basic Command

The basic command is the verb part of the command string; it specifies the action to be taken. The basic command consists usually of a single character, or sometimes one or more dots followed by a character. For example, K means “Kill a character”, whereas .K means “Kill buffers”. The . has no consistent meaning across commands.

It is important to remember that the basic command separates the modifiers from the object. If a basic command consists of more than one character, the characters must be contiguous; i.e., they may not be separated by modifiers. For example, .3C is not the same as 3.C.

2.6. Object

Many basic commands can act on either characters, words, lines, or pages, and thus require that the target object be specified. The summaries for these commands give a list of possible objects, such as [C|W|L|P]. This means to follow the basic command with exactly one of the options inside the square brackets.

For example, when using the C command, type CC to copy characters, CW to copy words, CL to copy lines or CP to copy pages.


previous   next   top   contents   index   framed top   this page unframed

MAINEDIT User's Guide, Chapter 2