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

Help

  • C-h: Access help
  • C-h t: Emacs tutorial
  • C-h k: Describe the function of a key
  • C-h f: Describe the function of a command

Note: In this cheat sheet: C stands for the “Control” key M stands for the “Meta” key, which is usually the “Alt” key or “Esc” key

🔗 Home 🔗 posts

Author: madam

Created: 2024-01-15 Mo 15:17