Aide-mémoire pour GNU Emacs

Cette page est un (non exhaustive & usage personnel) aide-mémoire sur les raccourcis de GNU Emacs. Mais ce serait super si cela pouvait aider quelqu’un d’autre.

Misc

Shortcut Description
C-x C-f Open file
C-x C-s Save the buffer to file
C-x C-w Write the buffer to new file
C-/ undo (alternative: C-x u)
C-h ? View help options
C-h i View the Emacs manual

Navigation

Shortcut Description
M-. elpy-goto-definition
M-0 treemacs-select-window

Selection

Shortcut Description
C-Space Begin selection (set mark)
C-g Cancel selection
C-x h mark-whole-buffer, put the whole buffer in selection

Deletion

Shortcut Description
Backspace Delete the previous character or selection
C-d Delete the next character (delete-char)
M-d Delete current or next word
M-\ Delete spaces and tabs around point (delete-horizontal-space)

Killing and Yanking

Shortcut Description
C-w Cut selection
C-k Kill (or cut ) rest of line or multiple lines (kill-line)
C-S-Backspace Kill an entire line at once (kill-whole-line)
C-y Yank (or paste) the last kill into the buffer
M-y Yank earlier kills, or replace the text just yanked with an earlier kill

Buffers

Shortcut Description
C-x C-b List available buffers
C-x b <buffer_name> Switch to <buffer_name>
C-x k Kill a buffer
C-x Right Arrow Move to next buffer
C-x Left Arrow Move to previous buffer

Multiple windows

Shortcut Description
C-x 0 delete-window
C-x 1 maximize-buffer
C-x 2 split-window-below
C-x 3 split-window-right
C-x o Move the cursor to the other window (“o” for “others”).
Shortcut Description
C-s Incremental search forward
C-r Incremental search backward
Alt % Query replace keywords

Example usage:

Type C-s <keyword> to start a search for <keyword>. Type C-s again to search for the next occurrence of <keyword>. Type <DEL> to go back to an earlier location of the <keyword>. If there are no earlier occurrences, the <DEL> erases the last character in the search string. Type <Return> (or C-g) to terminate the search.

Backward search: use C-r instead of C-s. Everything that we have said about C-s also applies to C-r, except that the direction of the search is reversed.

Type Alt % to do query-replace, then y to confirm the replacement at each occurrence, n to skip, ! to confirm without asking, and C-g to cancel the search.

Comments