Types of key bindings
- navigate in a buffer
- edit a buffer
- query a buffer
- manage buffers, frames, and windows
- manage commands
Key bindings I frequently use
key binding | command | description | type | comment | ||
---|---|---|---|---|---|---|
C-a | move to the beginning of line | navigate | ||||
C-e | move to the end of line | navigate | ||||
M-> | move to the bottom of the buffer | navigate | ||||
M-< | move to the top of the buffer | navigate | ||||
goto-line |
move to a certain line | navigate | ||||
M-f | move forward to next word | navigate | ||||
M-b | move backward to previous word | navigate | ||||
C-v | move to the next screen of the buffer | navigate | ||||
M-v | move to the previous screen of the buffer | navigate | ||||
C-x o | move curser to different windows | navigate | ||||
C-x b | switching between open buffers in current frame | navigate | ||||
C-x C-b | list open buffers | navigate | ||||
C-x r l | list bookmarks | navigate | ||||
C-x r m | add a bookmark for the current buffer | navigate | ||||
C-x 8 Enter | insert a Unicode character by its Unicode name, e.g. "em dash" or hexidecimal number, e.g. "0x2E3B" | edit | ||||
C-x r t
xxx |
string-rectangle |
enter xxx on multiple lines in a rectangle
area |
edit | the rectangle area can be defined/selected by M-@ | ||
M-; | comment-dwin |
comment multiple lines | edit | |||
C-_ or C-x u | undo | edit | ||||
C-y | yank, reinsert the most recent killed text | edit | the kill ring | |||
C-u 3 C-y | yank, reinsert the third most recent killed text | edit | ||||
C-k | delete characters after cursur of the current line | edit | ||||
C-d | delete the next characters after cursur | edit | ||||
C-x i | insert content of another file | edit | ||||
C-@ | set-mark-command |
set the mark where the point is | edit | |||
M-% | query-replace |
Query replace | edit | |||
C-M-% | query-replace-regexp |
Query replace regexp | edit | |||
C-u C-x Tab | ? |
indent a block of text rightward by a tab | edit | |||
C-x C-i | ? |
indent a block of text rightward by a whitespace | edit | To select a block of text, move cursor to the front, C-Space to activate the selection, then move the cursor to the end, C-Space to end the selection. | ||
C-u 5
C-x Tab |
? |
indent a block of text rightward by 5 spaces | edit | |||
C-u 5
C-x C-i |
? |
indent a block of text rightward by 5 spaces | edit | |||
M-l | convert the following word to lower case | edit | ||||
M-Tab (with cursor near an English word) | check dictionary for alternative spellings | edit | ||||
M-q (with a highlight region) | fill-paragraph |
automatically line wraps a pragraph of text | edit | |||
C-M-@ | mark-sexp |
undo | edit | 1) move cursor to the beginning of a block of text by mouse or
up arrow key 2) C-M-@ to mark the beginning of the block 3) move cursor to the end of the block 4) operate on the block, e.g. indent rightward by 1 whitespace with C-x C-i, or indent rightward by 4 whitespaces with C-u -4 C-x C-i |
||
C-s | isearch-forward |
I-search | query | |||
C-r | isearch-backward |
I-search backward | query | |||
C-M-s | isearch-forward-regexp |
Regexp I-search | query | |||
C-M-r | isearch-backward-regexp |
Regexp I-search backward | query | |||
C-x C-b |
list-buffers |
list open buffers | manage buffer | |||
C-r | recentf-open-files |
list recently opened files | manage buffer | |||
C-x C-f | find-file |
load file to current buffer | manage buffer | |||
C-x C-w | write current buffer to a file | manage buffer | ||||
C-x C-v Ret | find-another-file |
load another file to current buffer, by default reload the same file | manage buffer | |||
revert-buffer |
get rid of extensive changes made to current buffer and revert back to | manage buffer | "Reverting a buffer." GNU Emacs Manual. | |||
C-x b | switch-to-buffer |
switch to buffer | manage buffer | |||
C-x C-w | save buffer to another file | manage buffer | ||||
C-x C-+ | increase font size | manage buffer | ||||
C-x C-+ | decrease font size | manage buffer | ||||
C-x b arrow key | select buffer to load into current frame | manage buffer | ||||
C-x 0 | close current window | manage frame/window | ||||
C-x 0 5 | close current frame | manage frame/window | ||||
C-x 3 | split frame vertically | manage frame/window | ||||
C-x 2 | split frame horizontally | manage frame/window | ||||
C-x 5 2 | open a new frame | manage frame/window | ||||
C-x o | other-window |
move cursor to other window in the current frame | manage frame/window | |||
C-q | cancel current command | manage commands | ||||
C-l C-\
chinese-punct |
type Chinese punctuation | misc | Type C-l C-\ to turn on/off the input method | |||
C-x C-h | get help text in another buffer | misc | ||||
M-Tab | find possible word completion | misc |
Modifier keys
-
C-
: Ctrl -
M-
: Meta, M, which is usually the Alt key on most keyboards, and possibly Esc on Mac computers -
s-
: Super, s, which can be typed in with C-x @ s -
H-
: Hyper, H, which can be typed in with C-x @ h -
A-
: Alt, A, which can be typed in with C-x @ a