Skip to content

Instantly share code, notes, and snippets.

@valyakuttan
Last active August 30, 2022 17:58
Show Gist options
  • Save valyakuttan/d2f7e7b736f4f2a8de68aa11bc4cfbc8 to your computer and use it in GitHub Desktop.
Save valyakuttan/d2f7e7b736f4f2a8de68aa11bc4cfbc8 to your computer and use it in GitHub Desktop.

Emacs Commands List

collected from here and here

Queried search and replace

  • M-% prompt for search and replace strings
  • Spacebar Replace text and find the next occurrence
  • Del Leave text as is and find the next occurrence
  • . (period) Replace text, then stop looking for occurrences
  • ! (exclamation) Replace all occurrences without asking
  • ^ (caret) Return the cursor to previously replaced text

Basics

  • C-x C-f "find" file i.e. open/create a file in buffer

  • C-x C-s save the file

  • C-x C-w write the text to an alternate name

  • C-x C-v Read a different file into emacs, replacing the current buffer

  • C-x i insert file at cursor position

  • C-x b create/switch buffers

  • C-x C-b show buffer list

  • C-x k kill buffer

  • C-z suspend emacs

  • C-X C-c close down emacs

Cursor Motion

  • M-< Go to the beginning of the buffer
  • M-> Go to the end of the buffer

Editing

  • C- Set mark

  • C-x C-x Exchange cursor and mark(used to verify you have marked the desired region)

  • M-h Mark current paragraph

  • C-x C-p Mark current page

  • C-x h Mark entire buffer

  • C-w Kill the marked region

  • M-w Copy the marked region

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment