GNU Emacs
Cheat sheet
File operations
- C-x C-f: Find or open a file
- C-x C-s: Save the current file
- C-x C-w: Save the current file with a new name
- C-x k: Close the current file (buffer)
- C-x b: Switch between open files (buffers)
- C-x C-b: List all open files (buffers)
Navigation
- C-a: Go to the beginning of the line
- C-e: Go to the end of the line
- M-<: Go to the beginning of the file
- M->: Go to the end of the file
- C-n: Move to the next line
- C-p: Move to the previous line
- C-f: Move forward one character
- C-b: Move backward one character
- M-f: Move forward one word
- M-b: Move backward one word
Editing
- C-d: Delete the character under the cursor
- M-d: Delete the word after the cursor
- M-DEL: Delete the word before the cursor
- C-k: Kill (cut) from the cursor to the end of the line
- M-k: Kill (cut) from the cursor to the end of the sentence
- C-y: Yank (paste) the most recently killed (cut/copied) text
- C-_ or C-x u: Undo the last action
Searching
- C-s: Incremental search forward
- C-r: Incremental search backward
- M-%: Query replace
Window management
- C-x 2: Split the window vertically
- C-x 3: Split the window horizontally
- C-x 1: Close all other windows
- C-x o: Switch to the other window