VI cheatsheet: h,j,k,l movement w,b move word-wise 0,$ move to start, end of line ^ another way to move to the start of a line / search ? search backwards % match bracket Ctrl+f Move forward 1 page Ctrl+b Move backward 1 page Ctrl+] Jump to tag (e.g. in help or programming) Ctrl+T Return after jumping to tag ma Set mark a (can use any letter) `a Go to mark a (can be used to delete from cursor to mark) f Go to the next occurrance of t Go to just before the next occurrance of i insert a append after cursor (good for end of line) A append at end of line r replace with next letter R replace a bunch of characters x delete character X delete previous character d cut dd cut line P paste p paste after cursor (weird) y Yank (copy) o open line below cursor O open line above cursor u undo U undo everything on current line Ctrl+R redo c change object . repeat last delete or change command (including insertion) ~ change case and move to next character qa Record macro a (can use any letter) @a Execute macro a > Shift lines right >i{ Shift inside {} < Shift lines left = Indent lines properly !! Put the output of at the cursor !motion Pipe the text specified by motion through and replace it with the output v visual mode (select characters) V visual mode (select lines) Ctrl+V visual mode (select a box) K Look up man page objects: w word e word not including space $ end of line 0 start of line Ctrl+g file status G move to line (default end) gg move to line (default start) :!command external command :q close window :wq save & close window :w FILE write to FILE :r FILE insert contents of FILE :s/old/new/g replace on line :%s/old/new/g replace in whole file :s/old/new/gc ask for confirmation for each replacement :s/old/new/ replace next occurrance :set