Table of Content
This blog is design to build up Emacs muscle memory for beginners and casual Emacs users.
This is an attempt to deal with use-it-or-lose-it memory decay issue. I design this page to recall core features in the least amount of time.
I expect to review this periodically through these steps.
- Read the intent in each section
- Answer the intent in my mind. This include recall the key binding and command.
Basic: Cancel, Undo, and Recover
Intent |
Key Binding |
Command |
Cancel current key binding progress |
C-g |
keyboard-quit |
|
|
|
Undo |
C-_ |
undo |
Redo after undo |
C-g C-_ |
|
|
|
|
Restore previous session |
M-x recover-session |
recover-session |
Getting help
This section focus on Emacs build in help.
Intent |
Key Binding |
Command |
List all possible help options |
C-h ? |
help-for-help |
List all binded keys |
C-h b |
describe-binding |
|
|
|
Describe key binding and assigned function |
C-h k {keys} |
describe-key |
|
|
|
Describe a function purpose |
C-h f {function} |
describe-function |
Where is a function bind to |
C-h w {function} |
where-is |
|
|
|
Describe current buufer mode |
C-h m |
describe-mode |
|
|
|
Search help by similar keyword |
C-h a |
apropos-command |
Working with Files
Intent |
Key Binding |
Command |
Open a file |
C-x C-f |
find-file |
Find alternative file and replace current buffer |
C-x C-v |
find-alternative-file |
|
|
|
Insert other file content at cursor |
C-x i |
insert-file |
|
|
|
Save current buffer to file |
C-x C-s |
save-buffer |
Save content as other file |
C-x C-w |
write-file |
Files and Windows
Intent |
Key Binding |
Command |
Find file in other window |
C-x 4 f |
find-file-other-window |
|
|
|
Find file read-only in other window |
C-x 4 r |
find-file-read-only-other-window |
Files and Frames
Intent |
Key Binding |
Command |
Find file in other frame |
C-x 5 f |
find-file-other-frame |
|
|
|
Find file read-only in other frame |
C-x 5 r |
find-file-read-only-other-frame |
Buffers
Baisc: Working with Buffers
Intent |
Key Binding |
Command |
List all buffers |
C-x C-b |
list-buffers |
|
|
|
Switch to a new or existing buffer |
C-x b {buffer name} |
switch-to-buffer |
|
|
|
Kill a buffer |
C-x k |
kill-buffer |
|
|
|
Toggle read only buffer |
C-x C-q |
read-only-mode |
|
|
|
Revert buffer change |
M-x revert-buffer |
revert-buffer |
Cursor Motion
Inside a Buffer
This section focus on cursor navigation inside a buffer.
Intent - Move Cursor to… |
Key Binding |
Command |
Forward one character |
C-f |
forward-char |
Backward one character |
C-b |
backward-char |
|
|
|
Forward one word |
M-f |
forward-word |
Backward one word |
M-b |
backwoard-word |
|
|
|
Next line |
C-n |
next-line |
Previous line |
C-p |
previous-line |
|
|
|
View next screen |
C-v |
scroll-down-command |
View previous screen |
M-v |
scroll-up-command |
|
|
|
Clear center screen to bottom/top/center |
C-l |
recenter-top-bottom |
|
|
|
Begin of line |
C-a |
move-beginning-of-line |
End of line |
C-e |
move-end-of-line |
|
|
|
Begin of sentence |
M-a |
backward-sentence |
End of sentence |
M-e |
forward-sentence |
|
|
|
Begin of paragraph |
M-{ |
backward-paragraph |
End of paragraph |
M-} |
forward-paragraph |
|
|
|
Begin of page |
C-x [ |
backward-page |
End of page |
C-x ] |
forward-page |
|
|
|
Begin of buffer |
M-< |
beginning-of-buffer |
End of buffer |
M-> |
end-of-buffer |
|
|
|
Begin of function |
C-M-a |
beginning-of-defun |
End of function |
C-M-e |
end-of-defun |
|
|
|
Begin of sexp |
C-M-b |
backward-sexp |
End of sexp |
C-M-f |
forward-sexp |
Editing
Search and Replace
Intent |
Key Binding |
Command |
Search forward |
C-s |
isearch-forward |
Search forward regex |
M-C-s |
isearch-forward-regexp |
|
|
|
Search backward |
C-r |
isearch-backward |
Search backward regex |
M-C-r |
isearch-backward-regexp |
|
|
|
Replace forward |
M-% |
query-replace |
Replace forward regex |
M-C-% |
query-replace-regexp |
Within Search or Replace Ring
Intent |
Key Binding |
Command |
Find next search |
M-n |
|
Find previous search |
M-p |
|
Complete search phrase |
C-M-i |
|
Line
Intent |
Key Binding |
Command |
Insert new line below |
C-o |
open-line |
Insert new line with rest of line |
C-M-o |
split-line |
|
|
|
Delete blank line around point |
C-x C-o |
delete-blank-lines |
|
|
|
Join 2 lines |
M-^ |
delete-indentation |
Deleting
Intent |
Key Binding |
Command |
Delete forward a character |
C-d |
delete-forward-char |
Delete forward a character |
DEL |
org-delete-char |
|
|
|
Delete forward word |
M-d |
kill-word |
Delete backward word |
M-DEL |
backward-kill-word |
|
|
|
Delete from cursor to end of line |
C-k |
org-kill-line |
|
|
|
Delete current sentence |
M-k |
kill-sentence |
|
|
|
Delete white space |
M-\ |
delete-horizontal-space |
Indentation
Intent |
Key Binding |
Command |
Indent region |
C-M-\ |
indent-region |
|
|
|
Indent sexp |
|
indent-sexp |
|
|
|
Indent rigid |
C-x TAB |
indent-rigidly |
Mark and Region
Intent |
Key Binding |
Command |
Start marking a region |
M-SPC |
set-mark-command |
|
|
|
Mark a word |
M-@ |
mark-word |
Mark a paragraph |
M-h |
org-mark-element |
Mark page |
C-x C-p |
mark-page |
Mark sexp |
C-M-@ |
mark-sexp |
Mark function |
C-M-h |
mark-defun |
Mark entire buffer |
C-x h |
mark-whole-buffer |
|
|
|
Swap cursor poistion |
C-x C-x |
exchange-point-and-mark |
|
|
|
Delete marked region |
C-w |
kill-region |
Windows
Intent |
Key Binding |
Command |
Split windows below |
C-x 2 |
split-window-below |
Split windows sideway |
C-x 3 |
split-window-right |
|
|
|
Delete other windows |
C-x 1 |
delete-other-windows |
Delete this window |
C-x 0 |
delete-window |
Working with Other Windows
Intent |
Key Binding |
Command |
Switch to other window |
C-x o |
other-window |
|
|
|
Scroll other window down |
C-M-v |
scroll-other-window-down |
(Alternative) |
M-PGDN |
|
|
|
|
Scroll other window up |
C-M-S-v |
scroll-other-window |
(Alternative) |
M-PGUP |
|
|
|
|
Switch buffer in other window |
C-x 4 b |
switch-to-buffer-other-window |
|
|
|
Display buffer in other window |
C-x 4 C-o |
display-buffer |
Frames
Intent |
Key Binding |
Command |
Split frame below |
C-x 5 2 |
make-frame-command |
|
|
|
Delete other frames |
C-x 5 1 |
delete-other-frames |
Delete this frame |
C-x 5 0 |
delete-frame |
Working with Other Frames
Intent |
Key Binding |
Command |
Switch to other frame |
C-x 5 o |
other-frame |
|
|
|
Scroll other frame down |
C-M-v |
scroll-other-window-down |
(Alternative) |
M-PGDN |
|
|
|
|
Scroll other frame up |
C-M-S-v |
scroll-other-window |
(Alternative) |
M-PGUP |
|
|
|
|
Switch buffer in other frame |
C-x 5 b |
switch-to-buffer-other-frame |
|
|
|
Display buffer in other frame |
C-x 5 C-o |
display-buffer-other-frame |