previous next top contents index framed top this page unframed
Table 3–1. Basic Cursor Positioning Commands
| Command | Move cursor: |
|---|---|
| n<, n<bs>, n<del> | left n columns |
| Q<, Q<bs>, Q<del> | to left margin |
| n>, n<sp> | right n columns |
| Q>, Q<sp> | to right margin |
| n( | left n words |
| Q( | to first visible character on current line |
| n.( | to space after nth previous word |
| n) | right n words |
| Q) | to space after last character on current line |
| n.) | to space after nth next word |
| n<tab> | to nth next tab stop |
| -n<tab> | to nth previous tab stop |
| n^ | up n rows |
| Q^ | to first row of window |
| n\, n<lf> | down n rows |
| Q\, Q<lf> | to last row of window |
| n<eol> | to left margin of nth next line |
| -n<eol> | to left margin of nth previous line |
| nX | to column n from left margin |
| -nX | to window width - n + 1 |
| nY | n rows from top of window |
| -nY | n rows from bottom of window |
| n.Y | to nth next window on screen |
| -n.Y | to nth previous window on screen |
| Q.Y | to bottommost window on screen |
| -Q.Y | to topmost window on screen |
Table 3–2. Page- and Line-Relative Motion Commands
| Command | Go to: |
|---|---|
| G | first line of next page |
| -G | first line of previous page |
| p.lG | page p, line l |
| .G | first line of current page |
| .lG | line l of current page |
| pG | first line of page p |
| +nG | first line of current page + n |
| -nG | first line of current page - n |
| n$G | absolute line number n |
If the target page does not exist, the cursor is moved to the last line of the buffer. If the target line does not exist, the cursor is moved to the last line of the target page.
Absolute line numbers are line numbers counting from the beginning of the file rather than from the beginning of a page. Whether a page mark is counted as a separate line depends on the setting of the option countPageMarksAsLines (see Section 16.7).
Use the emphasis modifier (Q) with the G command
to set a mark at the current position
before going to the new position.
For example, Q5G sets the mark to
the current position and then goes to page 5. This is equivalent to
typing .@ before the G command; see Section 3.5.
3.3. Go to Specified Character Position
The V command is used to go to a specified character position in
the current buffer. Character position n is the location of the
nth character in the buffer,
counting from 1. In response to the V
command, MAINED prompts for the target character position, giving
the current position as the default target position. To stay at the
current position type just <eol> in response to the prompt. For
example:
Position (27832): <eol> (stay at current position)
Position (27832): 12345<eol> (go to position 12345)
The V command may be aborted with the <abort> key.
3.4. Skip to Character or Line
The Skip command moves the cursor either to an occurrence of a
specified character on the current line, or to an occurrence of a
line (in the current window) of
which the first visible character is the
specified character. In Table 3–3, x represents any
character.
If the + modifier is specified, the skip command skips to the first character (or line) that is not (or does not begin with) the specified character.
Table 3–3. Commands to Skip to a Character or Line
| Command | Skip to: |
|---|---|
| nSx | nth next occurrence of x on current line |
| -nSx | nth previous occurrence of x on current line |
| +Sx | next occurrence of non-x on current line |
| -+Sx | previous occurrence of non-x on current line |
| QnSx | nth next line with x as first visible character (x may not be <sp>) |
| -QnSx | nth previous line with x as first visible character (x may not be <sp>) |
| +QSx | next line without x as first character |
| -+QSx | previous line without x as first character |
| QnS<sp> | nth next all-blank line |
| -QnS<sp> | nth previous all-blank line |
If the target is not found, the cursor is moved to the beginning
(for -) or end of the line for the non-Q forms, and the
beginning (for -) or end of the window for the Q forms.
3.5. Set and Jump to Mark
Each buffer contains a single mark that acts as a place holder. Use of the mark allows you to move the cursor temporarily to another point in the buffer, then return quickly to the original location. The commands are shown in Table 3–4.
Table 3–4. Commands to Control and Use the Mark
| Command | Action: |
|---|---|
| .@ | Set the mark to the current location |
| @ | Jump to the marked location |
| Q@ | Set the mark to the current location, then jump to previously marked location |
Q@ makes it easy to bounce back and forth between two places in the buffer. The QG command (see Section 3.2) sets the mark to the current location before going to the target page and line.
The mark remembers the page number, the relative line number on the
page, and the relative character number on the line.
If text before the marked location is changed, then jumping to
a mark may not position the cursor at exactly the same point in the
text as the one at which the mark was set.
3.6. Scroll Window
Scrolling the text in the window to show portions of the text that
are not currently visible is called windowing. The variations of
the W (Window) command allow you to scroll the text in the current
window in either direction, and by varying amounts. See
Table 3–5.
Table 3–5. Commands for Scrolling Windows
| Command | Scroll: |
|---|---|
| W | up 4/5 of a window |
| -W | down 4/5 of a window |
| nW | up n lines (n required) |
| QW | up all lines of the window |
| -nW | down n lines (n required) |
| -QW | down all lines of the window |
| n.W | current line to nth line from top of window |
| -n.W | current line to nth line from bottom of window |