Emacs Text Editor for UNIX Quick Reference Guide


In this article


What is Emacs?

Emacs is a free text editor designed for programmers. With Emacs, you can edit code in "common programming languages" with "context sensitive indentation and layouts". The following basic guide to Emacs can help you get started with this versatile program.


Basic keystrokes

Control keys

Hold 'Contol' (Ctrl) key down while pressing another key. Noted as 'C-'. For example: C-a (control-a goes to beginning of the line.)

Meta keys

Press the 'Escape' (Esc) key down and release, then press another key. Noted as 'M-'. For example: M-> (Esc-> goes to end of file (EOF).) The Meta key can also be used to prefix a command with the number of times you wish that command executed. See examples for C-f and C-b below.

Top


General terms

Point - Where the cursor currently is positioned in the editing session; usually where the cursor is.

Mark - Placeholder for a position (point) in the file; many commands affect the region between the mark and the point.

Region - The area between the point and the mark (or between the mark & the point).

TOF - Top of file.

EOF - End of file.

RET - Return (or Enter) key.

Top


Basic editing

Moving cursor

Searching

Modifying text

Top


Window Manipulation

Divide screen horizontally: C-x 2

Divide screen vertically: C-x 3 - Very handy when comparing two versions of the same program.

Find (get) file in other window: C-x 4 f (prompts for file name)

Go to other window: C-x o (that's an "oh")

Maximize current window: C-x 1 (that's a "one")

Top


Session Manipulation

Display buffer menu: M-x buffer-menu (navigate with arrow keys; select buffer with Enter key)

Top


Case Conversion

Convert region to lower case: C-x C-l

Convert region to upper case: C-x C-u

Top


Quitting Emacs

C-x C-c - If buffer has been modified since the last save, you will be prompted to write to the filename prior to exiting.

Top


Get More Information

For complete guide, please see Emacs Text Editor.

Top