![]() |
Computer Systems Lab CS1000 |
![]() Wiscinfo |
![]() CS Home |
![]() CSL |
![]() CS1000 |
![]() Feedback |
Vi is a somewhat archaic editor popular with many hackers. Its popularity stems from familiarity, speed, low memory usage, and because it works on a standard screen. Vi's unpopularity stems from the three modes Vi works in. Only certain things can be done in each mode, hence you must constantly switch modes to edit text. The three modes are insert, command, and command line (ex) mode. Your initial mode will usually be the command mode. Insert mode is used for entering text, that is all. The only editing that can be done in insert mode is usage of the backspace. Pressing the esc key brings you back to command mode. Command mode is used for moving the cursor and a majority of editing commands. Commandline mode offers more advanced features.
If your editing session is aborted prematurely you can recover everything you created up to the last time you saved by typing:
vega1% vi -r filename
To exit from vi first enter command mode, then type ZZ if you want to save your changes or :q! if you do NOT want to save the changes you've made.