Before you begin working with the vi editor, you should know that there are two modes in vi - the command mode and the insert mode.
Command mode is used to move through text, search for words, save a file, etc.
This mode covers everything except inserting code. Insert mode is only for inserting text into a file. Using i , I , a , A , cw , o , O , or R will place you into insert mode from command mode. These commands are described further here. Use the escape key to return to command mode from insert mode.