Tuesday, June 25, 2019

My own Emacs Reference Sheet

It's my own obligatory Emacs Cheat Sheet.  This is for my own future reference, but here for anyone else that may find it more useful than the multitude of other guides out there.

Modes


  • Emacs works in modes, both major and minor  
  • You can only have one major mode active at a time
  • You can open multiple minor modes
  • Major modes are usually auto-selected based on file type that you opened, but you can manually switch it with M-x <name>
  • Modes usually end in "-mode", e.g., web-mode.el
  • List of modes on Emacswiki
  • More modes can be installed with ELPA / MELPA

Moving Around

  • C-f / M-f ⇒ Forward (char) / Forward (word)
  • C-b / M-b ⇒ Backward (char) / Backward (word)
  • C-p ⇒ Previous (line, i.e., up)
  • C-n ⇒ Next (line, i.e., down)
  • C-v / M-v ⇒ Page down / Page up
  • C-a ⇒ Beginning of line (i.e., "Home" key)
  • C-e ⇒ End of line (i.e., "End" key)

Files

  • C-x C-f ⇒ find (open) file... creates file if it doesn't exist
  • C-x C-s ⇒ Save (current buffer)
  • C-x s ⇒ Save (all buffers)
  • C-x C-c ⇒ Exit w/o saving

Windows

  • C-x 2 ⇒ split screen into 2, horizontally
  • C-x 1 ⇒ close all other windows
  • C-x o ⇒ jump to other window
  • C-x 4 f ⇒ open file into other window (split)

Buffers

  • C-x C-b ⇒ List all buffers
  • C-x b ⇒ Switch to buffer (TAB for auto-complete)
  • C-x k ⇒ Kill (close) buffer (default: current buffer) 

No comments:

Post a Comment