Emacs Cheatsheet

September 11, 2015

Tags:

These bindings should work for emacs from 24 upwards.
My emacs config is in my dotfiles.

Key bindingNamePurposePackageFrom emacs version
C-x SPC(rectangle-mark-mode)Select a rectangular region.None24.4
C-c SPC(ace-jump mode)Jump to a letter at start of a word.ace-jumpunknown
C-s C-w(write-file)Save current file as a different fileNoneunknown
C-g C-/RedoRedo something you've undone.Noneunknown
C-/UndoUndo something you've done.Noneunknown
C-x k(kill-buffer)Close the current buffer.Noneunknown
C-x C-f(find-file)Visit a fileNoneunknown
C-x C-v(find-alternate-file)Visit a different fileNoneunknown
C-x C-r(find-file-read-only)Visit a file as read-onlyNoneunknown
C-x 4 f(find-file-other-window)Visit a file in another window/bufferNoneunknown
C-x 5 f(find-file-other-frame)Visit a file in a new frameNoneunknown
C-aJump to start of lineNot emacs specific but IBM homeNoneall
C-eJump to end of lineNot emacs specific but IBM endNoneall
C-s M-%Queried search and replaceNoneall

Handy information

  • For redo keep repeating C-/ to keep redoing, C-g isn't repeated.
  • If you “visit” a file that is actually a directory, Emacs invokes Dired, the Emacs directory browser. See Dired. You can disable this behavior by setting the variable find-file-run-dired to nil; in that case, it is an error to try to visit a directory.
  • When the emacs version is unknown it will most likely work for your version of emacs.
  • Here's an awesome emacs manual
  • Update emacs packages with M-x package-list-packages RET U x then follow the prompts as you wish.

To learn

  • General indentation
  • Indenting blocks.

Handy emacs packages I like

  • ace-jump
  • auto-complete

Extra

  • Updating emacs packages: M-x package-list-packages U x then follow the prompts
  • emacs-nox: In the arch repos there's emacs-nox described as "The extensible, customizable, self-documenting real-time display editor, without X11 support" Good for SSH.
  • My emacs config
  • Installing packages: "i" mark for install. "x" to install
  • M-x to run any command. e.g M-x erc to IRC from emacs.