Useful vi commands

Only record some commonly used commands

Delete

  1. delete one line dd

  2. delete one line from the current cursor D

  3. delete all from current cursor dG

  4. delete whole file ggdG gg means move cursor to the front

Undo

  1. Undo last thing you did u
  1. Search forward /

  2. Search backward ?

  3. Repeat last search in the same direction n

  4. Repeat last search in the opposite direction N

  5. Set raw number set nu

  6. Replacing all matching strings g/search-string/s//replace-string/g