- | - |
---|---|
C-x b |
Select another buffer |
C-x C-b |
List all buffers |
C-x k |
Kill a buffer |
Getting started
Buffers
Keyboard Macros
- | - |
---|---|
C-x ( |
Start defining a keyboard macro |
C-x ) |
End keyboard macro definition |
C-x e |
Execute last-defined keyboard macro |
C-u C-x ( |
Append to last keyboard macro |
M-x name-last-kbd-macro |
Name last keyboard macro |
M-x insert-kbd-macro |
Insert Lisp definition in buffer |
Rectangles
- | - |
---|---|
C-x r r |
Copy rectangle to register |
C-x r k |
Kill rectangle |
C-x r y |
Yank rectangle |
C-x r o |
Open rectangle, shifting text right |
C-x r c |
Blank out rectangle |
C-x r t |
Prefix each line with a string |
Tags
- | - |
---|---|
M-. |
Find a tag (a definition) |
C-u M-. |
Find next occurrence of tag |
M-x visit-tags-table |
Specify a new tags file |
M-x tags-search |
Regexp search on all files in tags table |
M-x tags-query-replace |
Run query-replace on all the files |
M-, |
Continue last tags search or query-replace |
Minibuffer
The following keys are defined in the minibuffer.
- | - |
---|---|
TAB |
Complete as much as possible |
SPC |
Complete up to one word |
RET |
Complete and execute |
? |
Show possible completions |
M-p |
Fetch previous minibuffer input |
M-n |
Fetch later minibuffer input or default |
M-r |
Regexp search backward through history |
M-s |
Regexp search forward through history |
C-g |
Abort command |
Type C-x ESC ESC to edit and repeat the last command that used the minibuffer. Type F10 to activate menu bar items on text terminals. |
Info
- | - |
---|---|
C-h i |
Enter the Info documentation reader |
C-h S |
Find specified function or variable in Info |
#Moving within a node
- | - |
---|---|
SPC |
Scroll forward |
DEL |
Scroll reverse |
b |
Beginning of node |
#Moving between nodes
- | - |
---|---|
n |
Next node |
p |
Previous node |
u |
Move up |
m |
Select menu item by name |
n |
Select nth menu item by number (1â9) |
f |
Follow cross reference (return with l) |
l |
Return to last node you saw |
d |
Return to directory node |
t |
Go to top node of Info file |
g |
Go to any node by name |
#Other
- | - |
---|---|
h |
Run Info tutorial |
i |
Look up a subject in the indices |
s |
Search nodes for regexp |
q |
Quit Info |
Formatting
- | - |
---|---|
TAB |
Indent current line (mode-dependent) |
C-M-\ |
Indent region (mode-dependent) |
C-M-q |
Indent sexp (mode-dependent) |
C-x TAB |
Indent region rigidly arg columns |
M-; |
Indent for comment |
C-o |
Insert newline after point |
C-M-o |
Move rest of line vertically down |
C-x C-o |
Delete blank lines around point |
M-^ |
Join line with previous (with arg, next) |
M-\ |
Delete all white space around point |
M-SPC |
Put exactly one space at point |
M-q |
Fill paragraph |
C-x f |
Set fill column to arg |
C-x . |
Set prefix each line starts with |
M-o |
Set face |
Multiple Windows
When two commands are shown, the second is a similar command for a frame instead of a window.
- | - | - |
---|---|---|
C-x 5 1 |
C-x 1 |
Delete all other windows |
C-x 5 2 |
C-x 2 |
Split window, above and below |
C-x 5 0 |
C-x 0 |
Delete this window |
C-x 3 |
Split window, side by side | |
C-M-v |
Scroll other window | |
C-x 5 o |
C-x o |
Switch cursor to another window |
C-x 5 b |
C-x 4 b |
Select buffer in other window |
C-x 5 C-o |
C-x 4 C-o |
Display buffer in other window |
C-x 5 f |
C-x 4 f |
Find file in other window |
C-x 5 r |
C-x 4 r |
Find file read-only in other window |
C-x 5 d |
C-x 4 d |
Run Dired in other window |
C-x 5 . |
C-x 4 . |
Find tag in other window |
C-x ^ |
Grow window taller | |
C-x { |
Shrink window narrower | |
C-x } |
Grow window wider |
Getting Help
- | - |
---|---|
C-x 1 |
Remove help window |
C-M-v |
Scroll help window |
C-h a |
Apropos: show commands matching a string |
C-h k |
Describe the function a key runs |
C-h f |
Describe a function |
C-h m |
Get mode-specific information |
The help system is simple. Type C-h (or F1 ) and follow the directions. If you are a first-time user, type C-h t for a tutorial. |
Killing and Deleting
Backward | Forward | Entity to kill |
---|---|---|
DEL |
C-d |
Character (delete) |
M-DEL |
M-d |
Word |
M-0 C-k |
C-k |
Line (to end of) |
C-x DEL |
M-k |
Sentence |
M-- C-M-k |
C-M-k |
Sexp |
#Killing
- | - |
---|---|
C-W |
Kill region C-w |
M-w |
Copy region to kill ring |
M-z char |
Kill through next occurrence of char |
C-y |
Yank back last thing killed |
M-y |
Replace last yank with previous kill |
Marking
- | - |
---|---|
C-@``C-SPC |
Uet mark here |
C-x C-x |
Exchange point and mark |
M-@ |
Set mark arg words away |
M-h |
Mark paragraph |
C-x C-p |
Mark page |
C-M-@ |
Mark sexp |
C-M-h |
Mark function |
C-x h |
Mark entire buffer |
Transposing
- | - |
---|---|
C-t |
Transpose characters |
M-t |
Transpose words |
C-x C-t |
Transpose lines |
C-M-t |
Transpose sexps |
#Scroll
- | - |
---|---|
C-v |
Scroll to next screen |
M-v |
Scroll to previous screen |
C-x < |
Scroll left |
C-x > |
Scroll right |
C-l |
Scroll current line to center, top, bottom |
#Goto
- | - |
---|---|
M-g g |
Goto line |
M-g c |
Goto char |
M-m |
Back to indentation |
Error Recovery
- | - |
---|---|
C-g |
Abort partially typed or executing command |
M-x recover-session |
Recover files lost by a system crash |
C-x u``C-_``C-/ |
Undo an unwanted change |
M-x revert-buffer |
Restore a buffer to its original contents |
C-l |
Redraw garbaged screen |
Files
- | - |
---|---|
C-x C-f |
Read a file into Emacs |
C-x C-s |
Save a file back to disk |
C-x s |
Save all files |
C-x i |
Insert contents of another file into this buffer |
C-x C-v |
Replace this file with your file |
C-x C-w |
Write buffer to a specified file |
C-x C-q |
Toggle read-only status of buffer |
Case Change
- | - |
---|---|
M-u |
Uppercase word |
M-l |
Lowercase word |
M-c |
Capitalize word |
C-x C-u |
Uppercase region |
C-x C-l |
Lowercase region |
Motion
Backward | Forward | Entity to move over |
---|---|---|
C-b |
C-f |
Haracter |
M-b |
M-f |
Word |
C-p |
C-n |
Line |
C-a |
C-e |
Line beginning(or end) |
M-a |
M-e |
Sentence |
M-{ |
M-} |
Paragraph |
C-x [ |
C-x ] |
Page |
C-M-b |
C-M-f |
Sexp |
C-M-a |
C-M-e |
Function |
M-< |
M-> |
Buffer beginning(or end) |
Global Description
- | - |
---|---|
C-<key> |
Means hold the control, and press <key> |
M-<key> |
Means press the Esc once, and press <key> |
NOTICE: This cheatsheet follows the above rules. |
Starting Emacs
To enter Emacs, just type its name:
$ emacs
- | - |
---|---|
C-z |
Suspend Emacs |
C-x C-c |
Exit Emacs permanently |
Comments