Emacs Cheatsheet
Table of Contents
1 Emacs general
1.1 Help
Key binding | Description | Command |
---|---|---|
C-h t | Tutorial | help-with-tutorial |
C-h m | Help for active mode | describe-mode |
C-h k | Help for key sequence | describe-key |
C-h f | Help for function | describe-function |
C-h v | Help for variable | describe-varialbe |
C-h a | Search help | apropos |
C-h i | Info reader | info |
C-h p | Find help by keyword | finder-by-keyword |
q | Close help buffer | quit-window |
1.2 General
Key binding | Description | Command |
---|---|---|
C-g | Cancel | keyboard-quit |
C-0 to C-9, M-0 to M-9, C-u <num> | Numeric argument | digit-argument |
C-u | Universal argument (same as numerical argument 4) | universal-argument |
M–, C-M– | Negative argument | negative-argument |
1.3 Movement
Key binding | Description | Command |
---|---|---|
C-f | Next character | |
C-b | Previous character | |
M-f | Next word | |
M-b | Previous word | |
C-a | Beginning of line | |
C-e | End of line | |
M-a | Backward sentence | |
M-e | Forward sentence | |
C-up | Previous paragraph | backward-paragraph |
C-down | Nextt paragraph | forward-paragraph |
C-l | Center line on screen | |
C-n | Next line | |
C-p | Previous line | |
C-v | Next page | |
M-v | Previous page | |
C-M-v | Scroll other window/frame | |
C-M-S-v | Scroll other window/frame backwards | |
M-< | Beginning of document | |
M-> | End of document | |
C-M-f | Move forward by s-expression | |
C-M-b | Move backward by s-expression | |
C-M-d | Move down list | |
C-M-u | Move up list | |
M-g g | Go to line | |
M-g M-g | Go to line | |
M-m | Back to indentation | |
M-r | Cycle top/center/bottom of visible window | move-to-window-line-top-bottom |
C-x r SPC | Store point in register | point-to-register |
C-x r j | Jump to point stored in register | jump-to-register |
C-x C-x | Toggle point and mark | exchange-point-and-mark |
C-u C-SPC | Cycle mark ring | |
M-g M-n | Next error (in compile mode) | next-error |
M-g M-p | Previous error (in compile mode) | previous-error |
C-M-a | Beginning of function/class definition | beginning-of-defun |
C-M-e | End of function/class definition | end-of-defun |
1.4 Search
Key binding | Description | Command |
---|---|---|
C-s | Forward search | isearch-forward-regexp |
C-r | Backward search | isearch-backward-regexp |
C-s C-w | Add word after point to search |
1.5 Tags
Key binding | Description | Command |
---|---|---|
M-. | Go to symbol definition | find-tag |
M-* | Return to starting point | pop-tag-mark |
M-0 M-. | Go to next matching definition | |
M-x tag-search | Start a search | |
M-, | Go to next match | tags-loop-continue |
1.6 Frames
Key binding | Description | Command |
---|---|---|
M-x make-frame | New frame | |
C-x 5 0 | Close frame | delete-frame |
1.7 Windows
Key binding | Description | Command |
---|---|---|
C-x 0 | Close window | delete-window |
C-x 1 | Make current window only window | delete-other-windows |
C-x 2 | Split vertically | split-window-below |
C-x 3 | Split horizontally | split-window-right |
C-x o | Go to next window | other-window |
Shift+arrow key | Focus in direction | windmove-left/right/etc |
C-x M-f | Open file in new window |
1.8 Buffers
Key binding | Description | Command |
---|---|---|
C-x b | Switch buffer | |
C-x C-b | Buffer list | |
C-x k | Kill buffer | |
C-y | Send buffer to end of buffer list | |
C-x C-Right | Next buffer | |
C-x C-Left | Previous buffer |
1.9 Copy/paste/delete
Key binding | Description | Command |
---|---|---|
C-SPC | Set mark | |
C-x h | Select whole buffer | |
M-h | Select paragraph | |
C-w | Kill region | |
M-w | Copy region | |
C-y | Paste from kill ring | |
M-y | Cycle kill ring | |
C-k | Kill text to end of line | |
C-M-h | Kill previous word | |
C-u C-SPC | Jump to last mark | |
C-_ | Undo |
1.10 File management
Key binding | Description | Command |
---|---|---|
C-x C-f | Find file | |
C-x f | Find recent file | |
C-x s | Save file | |
C-c r | Revert to file on disk | revert-buffer |
1.11 Various
Key binding | Description | Command |
---|---|---|
C-x m | Emacs shell | |
M-; | (Un-)Comment region | |
M-/ | Completion (Hippie Expand) | |
C-x C-i | Ido function list | |
C-M \ | Reindent region | |
C-c n | Cleanup whitespace in ws mode | |
C-| | Shell command on region | |
C-u C-| | Like above, replace selection | |
C-u C-Spc | Pop mark |
1.12 Evaluate Elisp code
Key binding | Description | Command |
---|---|---|
C-c v | Evaluate buffer | |
C-x C-e | Evaluate last sexp |
2 Org-mode
Key binding | Description | Command |
---|---|---|
M-Shift-Ret | Insert TODO item | |
C-c C-t | Mark TODO as done | |
C-c C-o | Open link | |
C-c l | Store link | |
C-c C-l | Paste link | |
C-c C-s | Schedule task | |
Shift-Tab | Document overview |