Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Emacs Command Cheat Sheet

Standard Emacs Commands and Command Lines

Meta Key on Various Keyboards:

Common Abbreviations: M-x means press and then release the Meta key and then press the x key C-x means press and hold the Control key and then press and release the x key

Unix PC Macintosh

Command Open a file Insert another file at the current cursor position Save current file Save current file with another name (similar to Save As) Open an additional file

Keystroke C-x C-f C-x i C-x C-s C-x C-w C-x C-f

Command-Line M-x find-file M-x insert-file M-x save-buffer M-x write-file M-x find file

Emacs Basic Commands

Command Move to the previous buffer Display buffer list Delete current buffer

Keystroke C-x b C-x C-b C-x k

Command-Line M-x switch-to-buffer M-x list-buffers M-x kill-buffer

Moving Among Buffers

Using Emacs Windows


Page 1 of 4

Emacs Command Cheat Sheet


Command Create two windows Move to the other window Delete the current window Delete all other windows except the current window Keystroke C-x 2 C-x o C-x 0 C-x 1 Standard Emacs Commands and Command Lines Command-Line M-x split-window-vertically M-x other-window M-x delete-window M-x delete-other-windows

Command Move to the beginning of a buffer Move to the end of a buffer Move forward one character Move backward one character Move down one line Move up on line Move forward one word Move backward one word Move to the end of a line Move to the beginning of a line Move forward one screen Move backward one screen

Keystroke M-< M-> C-f C-b C-n C-p M-f M-b C-e C-a C-v M-v

Command-Line M-x beginning-of-buffer M-x end-of-buffer M-x forward-char M-x backward-char M-x next-line M-x previous-line M-x forward-word M-x backward-word M-x end-of-line M-x beginning-of-line M-x scroll up M-x scroll-down

Moving Around an Emacs Buffer

Command Delete character Delete previous character Delete word Delete previous word Delete the entire line

Keystroke C-d DEL (or BACKSPACE on some keyboards) M-d M-DEL (or M-BACKSPACE on some keyboards) C-k

Command-Line M-x delete-char M-x delete-backward-char M-x kill-word M-x backward-kill-word M-x kill-line

Cutting (Deleting) Text

Page 2 of 4

Emacs Command Cheat Sheet


Standard Emacs Commands and Command Lines

Command Mark the beginning of a selection Delete the marked region Copy a marked region Paste (Yank) a cut or copied a region

Keystroke C-@ or C-SPACEBAR C-w M-w or C-INSERT C-y

Marking Text to Delete, Move or Copy


Command-Line M-x set-mark-command M-x kill-region M-x kill-ring-save M-x yank

Command Incremental search forward* Incremental search backward* Exit incremental search* Cancel incremental search* Delete incorrect character in search string of incremental search* Non-incremental search forward Non-incremental search backward Start query replace Replace current instance and continue on to next instance Dont replace current instance, but move on to next instance

Keystroke C-s C-r <ENTER> or <RETURN> C-g DEL (or M-BACKSPACE on some keyboards) C-s RETURN (or ENTER on some keyboards) C-r RETURN (or ENTER on some keyboards) M-% SPACEBAR or y DEL (or M-BACKSPACE on some keyboards) or n . (period key)

Command-Line M-x isearch-forward M-x isearch-backward *None M-x keyboard-quit *None *None *None M-x query-replace *None *None

Searching & Replacing Text

Replace the current instance and then quit *None Replace the current instance and then , (comma key) *None pause Resume after pausing SPACEBAR or y *None Replace remaining instances without asking ! *None Back up to previous instance ^ *None Exit query replace RETURN (or ENTER on some keyboards) or q *None *- NOTE: An incremental search is one in which the search begins as soon as you begin typing and continues search as you type additional characters.

Wildcard Searches
Page 3 of 4

Emacs Command Cheat Sheet


Command Search for a group of sequential characters forward Search for a group of sequential characters backward Search for a group of sequential characters forward and incrementally Search for a group of sequential characters backward and incrementally Keystroke M C-s RETURN (ENTER on some keyboards) FOLLOWED BY thisIsMySearchExpressio* M C-r RETURN (ENTER on some keyboards) FOLLOWED BY thisIsMySearchExpressio* M C-s M C-r Standard Emacs Commands and Command Lines Command-Line M-x re-search-forward

M-x re-search-backward M-x isearch-forward-regexp M-x isearch-backward-regexp

Command Undoing recent changes Undo all changes since the last save Go back to an earlier version of the current file (the file as it appeared when you first opened it) Pop out to your Unix prompt Cancel current command

Keystroke C-x u *None C-x C-f filename~ RETURN (ENTER on some keyboards) FOLLOWED BY C-x C-w filename *None C-g

Command-Line *None M-x revert-buffer *None M-x shell *None

Various Other Commands

Page 4 of 4

You might also like