emacs Cursor (point) movement


Example

In addition to cursor movements using the arrow keys, Home, End, Page up, and Page down, emacs defines a number of keystrokes that can move the cursor over smaller or larger pieces of text:

By character:

  • Backward character: C-b
  • Forward character: C-f

By word

  • Backward word: M-b (i.e. Alt b, or Meta b)
  • Forward word: M-f

By line:

  • Beginning of current line: C-a
  • Beginning of current line first(non-space)character:M-m
  • End of current line: C-e
  • Previous line: C-p
  • Next line: C-n

Entire buffer:

  • Beginning of buffer: M-<
  • End of buffer: M->

By 'block', depending on context (mode):

Typical key bindings:

  • Backward sentence/statement: M-a
  • Forward sentence/statement: M-e
  • Beginning of function: M-C-a
  • End of function: M-C-e

Prefix arguments

In order to move several 'steps' at once, the movement commands may be given a prefix argument by pressing ESC or C-u and a number before the listed keystrokes. For C-u, the number is optional and defaults to 4.
E.g. ESC 3 C-n moves 3 lines down, while C-u M-f moves 4 words forward.