Skip to content

Instantly share code, notes, and snippets.

@marcorieser
Last active September 16, 2020 05:33
Show Gist options
  • Save marcorieser/86a7cddcaa8796f6dc9eaf134823997a to your computer and use it in GitHub Desktop.
Save marcorieser/86a7cddcaa8796f6dc9eaf134823997a to your computer and use it in GitHub Desktop.

VIM Cheat Sheet

Commands

  • i Start insert mode at current position
  • I Start insert mode beginning of line
  • a Start insert mode after current position (append)
  • A Start insert mode at end of line (append)
  • d Delete
  • dd Delete line
  • c Change (deletes and drops into insert mode)
  • cc Change line (deletes and drops into insert mode)
  • y Yank (copy)
  • yy Yank line (copy)
  • p Paste

Motions

  • h, j, k, l left, down, up, right
  • 0 beginning of line
  • ^,_ beginning of line (first non-whitespace char)
  • $ end of line
  • g__ end of line (last non-whitespace char)
  • t<char> till character
  • T<char> till character (backwards)
  • f<char> find character
  • F<char> find character (backwards)
  • gg Start of file
  • G End of file
  • <number>gg Go to line
  • Ctrl + e Move screen down one line (without moving cursor)
  • Ctrl + y Move screen up one line (without moving cursor)
  • Ctrl + b Move move up one screen (back)
  • Ctrl + f Move move down one screen (forward)
  • Ctrl + u Move move up 1/2 screen (up)
  • Ctrl + d Move move down 1/2 screen (down)
  • % Go to matching character (e.g. '()', '{}', '[]')

Text objects

  • iw/aw inner/around word
  • is/as inner/around sentence
  • ip/ap inner/around paragraph
  • it/at inner/around tag
  • i<delimiter>/a<delimiter> inner/around delimiter ((, ", [, etc)

Search

  • /<search> Search for ...
  • n Select next occurrence
  • N Select previous occurrence
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment