Next: , Previous: , Up: Basic   [Contents][Index]


4.2 Changing the Location of Point

To do more than insert characters, you have to know how to move point (see Point). The simplest way to do this is with arrow keys, or by clicking the left mouse button where you want to move to.

NOTE: Many of the following commands have two versions, one that uses the function keys (e.g. LEFT or END) and one that doesn’t. The former versions may only be available on X terminals (i.e. not on TTY’s), but the latter are available on all terminals.

C-a
HOME

Move to the beginning of the line (beginning-of-line).

C-e
END

Move to the end of the line (end-of-line).

C-f
RIGHT

Move forward one character (forward-char).

C-b
LEFT

Move backward one character (backward-char).

M-f
C-RIGHT

Move forward one word (forward-word).

M-b
C-LEFT

Move backward one word (backward-word).

C-n
DOWN

Move down one line, vertically (next-line). This command attempts to keep the horizontal position unchanged, so if you start in the middle of one line, you end in the middle of the next. When on the last line of text, C-n creates a new line and moves onto it.

C-p
UP

Move up one line, vertically (previous-line).

C-v
PGDN

Move down one page, vertically (scroll-up).

M-v
PGUP

Move up one page, vertically (scroll-down).

C-l

Clear the frame and reprint everything (recenter). Text moves on the frame to bring point to the center of the window.

M-r

Move point to left margin, vertically centered in the window (move-to-window-line). Text does not move on the screen.

A numeric argument says which screen line to place point on. It counts screen lines down from the top of the window (zero for the top line). A negative argument counts lines from the bottom (-1 for the bottom line).

C-t

Transpose two characters, the ones before and after the cursor (transpose-chars).

M-<
C-HOME

Move to the top of the buffer (beginning-of-buffer). With numeric argument n, move to n/10 of the way from the top. See Arguments, for more information on numeric arguments.

M->
C-END

Move to the end of the buffer (end-of-buffer).

M-x goto-char

Read a number n and move point to buffer position n. Position 1 is the beginning of the buffer.

M-g

Read a number n and move point to line number n (goto-line). Line 1 is the beginning of the buffer.

M-x set-goal-column

Use the current column of point as the semi-permanent goal column for C-n and C-p (set-goal-column). Henceforth, those commands always move to this column in each line moved into, or as close as possible given the contents of the line. This goal column remains in effect until canceled.

C-u M-x set-goal-column

Cancel the goal column. Henceforth, C-n and C-p once again try to avoid changing the horizontal position, as usual.

If you set the variable track-eol to a non-nil value, then C-n and C-p when at the end of the starting line move to the end of another line. Normally, track-eol is nil. See Variables, for how to set variables such as track-eol.

Normally, C-n on the last line of a buffer appends a newline to it. If the variable next-line-add-newlines is nil, then C-n gets an error instead (like C-p on the first line).


Next: , Previous: , Up: Basic   [Contents][Index]