You are on page 1of 4

Emacs Command Cheat Sheet

Standard Emacs Commands and Command Lines

Meta Key on *nix &C Macintosh

arious Key!oards"

Common A!!reviations" M-x! means #ress and t$en re%ease the Meta %e$ and then press the x! %e$ C-x! means #ress and $o%d the Control %e$ and then press and release the x! %e$

Command Open a file Insert another file at the current cursor position Save current file Save current file with another name (similar to Save s!" 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 #ispla$ buffer list #elete current buffer

Keystroke C-x b C-x C-b C-x %

Command-Line M-x switch-to-buffer M-x list-buffers M-x %ill-buffer

Moving Among Buffers

Using Emacs Windows


&a'e ( of )

Emacs Command Cheat Sheet


Command Create two windows Move to the other window #elete the current window #elete all other windows except the current window Keystroke C-x + C-x o C-x , C-x ( Standard Emacs Commands and Command Lines Command-Line M-x split-window-verticall$ M-x other-window M-x delete-window M-x delete-other-windows

Command Move to the be'innin' of a buffer Move to the end of a buffer Move forward one character Move bac%ward one character Move down one line Move up on line Move forward one word Move bac%ward one word Move to the end of a line Move to the be'innin' of a line Move forward one screen Move bac%ward 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 be'innin'-of-buffer M-x end-of-buffer M-x forward-char M-x bac%ward-char M-x next-line M-x previous-line M-x forward-word M-x bac%ward-word M-x end-of-line M-x be'innin'-of-line M-x scroll up M-x scroll-down

Moving Around an Emacs Buffer

Command #elete character #elete previous character #elete word #elete previous word #elete the entire line

Keystroke C-d #EL (or / C0S& CE on some %e$boards" M-d M-#EL (or M-/ C0S& CE on some %e$boards" C-%

Command-Line M-x delete-char M-x delete-bac%ward-char M-x %ill-word M-x bac%ward-%ill-word M-x %ill-line

Cutting &'e%eting( )e*t

&a'e + of )

Emacs Command Cheat Sheet


Standard Emacs Commands and Command Lines

Command Mar% the be'innin' of a selection #elete the mar%ed re'ion Cop$ a mar%ed re'ion &aste (5an%" a cut or copied a re'ion

Keystroke C-1 or C-S& CE/ 2 C-w M-w or C-I3SE24 C-$

Marking )e*t to 'e%ete+ Move or Co#y


Command-Line M-x set-mar%-command M-x %ill-re'ion M-x %ill-rin'-save M-x $an%

Command Incremental search forward6 Incremental search bac%ward6 Exit incremental search6 Cancel incremental search6 #elete incorrect character in search strin' of incremental search6 3on-incremental search forward 3on-incremental search bac%ward Start 7uer$ replace 2eplace current instance and continue on to next instance #on9t replace current instance: but move on to next instance

Keystroke C-s C-r -E34E2. or -2E4*23. C-' #EL (or M-/ C0S& CE on some %e$boards" C-s 2E4*23 (or E34E2 on some %e$boards" C-r 2E4*23 (or E34E2 on some %e$boards" M-8 S& CE/ 2 or $ #EL (or M-/ C0S& CE on some %e$boards" or n ; (period %e$"

Command-Line M-x isearch-forward M-x isearch-bac%ward 63one M-x %e$board-7uit 63one 63one 63one M-x 7uer$-replace 63one 63one

,earc$ing - .e#%acing )e*t

2eplace the current instance and then 7uit 63one 2eplace the current instance and then : (comma %e$" 63one pause 2esume after pausin' S& CE/ 2 or $ 63one 2eplace remainin' instances without as%in' < 63one /ac% up to previous instance = 63one Exit 7uer$ replace 2E4*23 (or E34E2 on some %e$boards" or 7 63one 6- 3O4E> n incremental search is one in which the search be'ins as soon as $ou be'in t$pin' and continues search as $ou t$pe additional characters;

Wi%dcard ,earc$es
&a'e ? of )

Emacs Command Cheat Sheet


Command Search for a 'roup of se7uential characters forward Search for a 'roup of se7uential characters bac%ward Search for a 'roup of se7uential characters forward and incrementall$ Search for a 'roup of se7uential characters bac%ward and incrementall$ Keystroke M C-s 2E4*23 (E34E2 on some %e$boards" @OLLOAE# /5 thisIsM$SearchExpressio6 M C-r 2E4*23 (E34E2 on some %e$boards" @OLLOAE# /5 thisIsM$SearchExpressio6 M C-s M C-r Standard Emacs Commands and Command Lines Command-Line M-x re-search-forward

M-x re-search-bac%ward M-x isearch-forward-re'exp M-x isearch-bac%ward-re'exp

Command *ndoin' recent chan'es *ndo all chan'es since the last save Bo bac% to an earlier version of the current file (the file as it appeared when $ou first opened it" &op out to $our *nix prompt Cancel current command

Keystroke C-x u 63one C-x C-f filenameC 2E4*23 (E34E2 on some %e$boards" @OLLOAE# /5 C-x C-w filename 63one C-'

Command-Line 63one M-x revert-buffer 63one M-x shell 63one

arious /t$er Commands

&a'e ) of )

You might also like