Vim Quick Reference
===================

MODES
  i                 Insert mode (before cursor)
  a                 Insert mode (after cursor)
  o                 New line below + insert
  O                 New line above + insert
  v                 Visual mode
  V                 Visual line mode
  Ctrl+v            Visual block mode
  Esc / Ctrl+[      Normal mode
  :                 Command mode

NAVIGATION
  h j k l           Left, Down, Up, Right
  w / b             Next/prev word
  0 / $             Line start/end
  gg / G            File start/end
  Ctrl+d / Ctrl+u   Half-page down/up
  :N                Go to line N
  %                 Jump to matching bracket
  * / #             Search word under cursor fwd/back
  f{char}           Jump to char on line

EDITING
  x                 Delete character
  dd                Delete line
  dw                Delete word
  d$                Delete to end of line
  yy                Yank (copy) line
  yw                Yank word
  p / P             Paste after/before
  u                 Undo
  Ctrl+r            Redo
  .                 Repeat last change
  >>  / <<          Indent / outdent
  J                 Join lines
  ~                 Toggle case
  r{char}           Replace character

SEARCH & REPLACE
  /pattern          Search forward
  ?pattern          Search backward
  n / N             Next/prev match
  :%s/old/new/g     Replace all in file
  :%s/old/new/gc    Replace all with confirm
  :s/old/new/g      Replace in current line

FILE OPERATIONS
  :w                Save
  :q                Quit
  :wq / :x / ZZ     Save and quit
  :q!               Quit without saving
  :e filename       Open file
  :r filename       Insert file contents

USEFUL COMMANDS
  :set number       Show line numbers
  :set nonumber     Hide line numbers
  :set paste        Paste mode (no auto-indent)
  :noh              Clear search highlight
  :!command         Run shell command
  :%!xxd            Hex editor mode
  :%!xxd -r         Exit hex editor mode
  :set encoding=utf-8   Set encoding

MULTI-FILE
  :bn / :bp         Next/prev buffer
  :ls               List buffers
  :sp file          Horizontal split
  :vsp file         Vertical split
  Ctrl+w w          Switch window
  Ctrl+w q          Close window
