Vi is a great text editor. People will argue that emacs is a better option or that pico is easier, but I find that vi is a great solution for doing quick text modifications. Emacs is the big mature Unix editor and pico is a little too simple, so I use vi most of the time because it offers a lot of solid features without a huge learning curve. After reading this article you should read more about vi.
Start vi with a new or existing filename:
Youâ€™re now in the editor. Within the editor are two modes: command and insert. To enter command mode at any point hit the â€˜ESCâ€™ key. Most commands are prefixed with a colon â€˜:â€™ so to quit out of the program enter command mode and type â€˜:qâ€™ (without quotes) followed by the â€˜Returnâ€™ key. Fire up vi again and, this time, go into insert mode by pressing the â€˜aâ€™ key. You can start typing whatever you need just like in any other text editor. To save and quit hit the â€˜ESCâ€™ key to enter command mode and type â€˜:wqâ€™. The â€˜wâ€™ means write the file and â€˜qâ€™ means quit vi. If you wanted to quit and not save your changes you could type â€˜:q!â€™ in command mode. There are hundreds and hundreds of good keyboard shortcuts to use while in command and insert mode and you can read about them in the article I linked to above.