Skip to content

Instantly share code, notes, and snippets.

@southpawfishel
Last active June 16, 2016 22:49
Show Gist options
  • Save southpawfishel/4972182 to your computer and use it in GitHub Desktop.
Save southpawfishel/4972182 to your computer and use it in GitHub Desktop.
Emacs shortcuts

Emacs Control Keys

Control

Commands using control will always look of the form C-? where ? is some key that you're to press while holding control.

Meta

Commands using meta will always look of the form M-? where ? is some key that you're to press while holding the meta key (most often this is the alt key in modern terminals). Pressing ESC will also activate the meta key.

Cancelling a command input in progress

If you mess up a command and want to stop it, use C-g.

If you mess up while editing

C-x u: Undo

Basic Navigational Commands

Paging through text

C-v: Page down by one screen
M-v: Page up by one screen
C-x l: Scroll the page appropriately so that the line containing the cursor is positioned in the middle of the screen.

Navigating through text blocks

C-f: Move (f)orward by one character
C-b: Move (b)ackward by one character
M-f: Move (f)orward by one word
M-b: Move (b)ackward by one word

C-n: Move to the (n)ext line
C-p: Move to the (p)revious line

C-a: Move to the beginning of the line (home)
C-e: Move to the (e)nd of the line (end)
M-a: Move to the beginning of the current sentence
M-e: Move to the (e)nd of the current sentence

Copy/Pasting

C-SPC: Mark text (set mark, then navigate to the end of the text)
C-w: Cut text
M-w: Copy text
C-y: Paste text

Buffer Related Commands

C-x C-f: Find(open) file, or create file if it doesn't exist
C-x C-s: Save buffer
C-x C-w: Write file (save as)
C-x b: Select buffer
C-x C-b: List buffers

Window Management Commands

C-x o: Cycle between windows (if in split-window mode)
C-x 0: Close current window
C-x 1: Make current buffer the only window
C-x 2: Split window vertically
C-x 3: Split window horizontally

Miscellaneous Config

M-x customize-themes: Use this to change color schemes.

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