vi is a text editor found on almost every Linux and Unix system, and vim is its improved version. It is very fast once you know it, but it works differently from other editors, so it helps to learn a few keys first.
Opening and quitting
vi file.txt
Opens file.txt, or creates it when you save if it doesn't exist.
:wq
Saves and quits. Type it in normal mode and press Enter. :x does the same.
:q!
Quits without saving your changes.
Stuck in vi? Press Esc a couple of times, then type :q! and press Enter to quit without saving.
Modes
vi has modes. In normal mode the keys are commands. In insert mode the keys type text. Press Esc to go back to normal mode at any time.