As soon as you enter a file, you are in vi command mode, and the editor is waiting for you to enter a command. Commands enable you to move anywhere in the file, to perform edits, or to enter insert mode to add new text. Commands can also be given to exit the file in order to return to the UNIX prompt.
One of the most used vi commands is 'i' (for 'insert'). The "i" doesn't appear on the screen, but after you press it whatever you type will appear on the screen and will be entered into the buffer. The cursor marks the current insertion point. To tell vi that you want to stop inserting text, press <Esc>. Pressing <Esc> moves the cursor back one space and returns vi to command mode.
If you have opened a new file and want to insert the words
this is a new file type the keystrokes:
i this is a new file
What appears on the screen is:
this is a new file
To break a line press <Return>.
If you don't know whether you are in vi command mode or text input mode press <Esc> once or twice to enter vi command mode. When you hear a beep, you are in vi command mode.