Emacs is a non-modal editor, meaning when you have a file loaded into
a buffer, you can type text and it will appear directly in the
buffer. You don't need to be in a special insert mode as in vi. That
also means cursor movement and other text manipulation commands are
not mapped to single alphabetic characters as in vi. Commands in Emacs
are typically entered with a two- or three-key sequence, either
Control- or Alt- followed by a one- or two-key sequence. The Control
key in the Emacs documentation is denoted by "C" and Alt by "M" (Emacs
documentation refers to the Alt key as Meta, hence the "M". The Esc
key on most keyboards acts as an Alt or Meta key as well). For
example, to quit Emacs, you type C-x C-c
, meaning you hold down the
Control key, hit the "x" key and release it, then hit the "c" key and
release it. To move up a screenfull of text, you type M-v
, meaning
hold down the Alt key and type "v". With that in mind, here are a few
useful key sequences:
C-x C-f | Find file and load into buffer (Emacs prompts for filename) |
C-x C-s | Save the current buffer |
C-x C-w | Save the current buffer under a different name (Emacs prompts for the new name) |
C-x C-c | Quit Emacs, prompting if you have not saved any buffers |
Arrow keys or C-f, C-b, C-n, C-p | Right (forward), left (back), down (next), up (previous), respectively |
C-k | Delete from cursor to end of line |
C-a | Go to start of line |
C-e | Go to end of line |
C-v | Go down a page |
M-v | Go up a page |
C-x u | Undo |
C-g | Abort the current command |
C-l | Redraw and center screen at cursor |
M-< | Go to start of buffer |
M-> | Go to end of buffer |
Backspace | Delete previous character |