---------------------------------------------- DAT2330 - Unix - Winter 2000 - Prof. Ian Allen ---------------------------------------------- Here are questions you should be able to answer. You will likely find questions similar to these on tests and exams. Chapter 8 - The VI Editor. Note: The Linux version of VI is more advanced that the VI on ACADAIX. You may find that some of the features described in the text do not work on ACADAIX (e.g. the "Getting Help" commands). Omit the "optional" material in this chapter on first reading. You can get by in VI with knowing how to read in a file, delete and append single characters and lines, and write the file back out. Advice: The more you learn about VI, the faster you will edit files and the more useful you will be as a Unix programmer. Almost every letter, upper and lower case, is a VI command. The more you learn, the faster you can edit. While you may begin by learning to delete a word using ten "x" commands, eventually you should evolve into knowing how to use the single "dw" command. Recommended: Create a file named .exrc in your home directory containing this command (see the text, p.229): set showmode That will enable VI to remind you when you are in INPUT MODE. Some people also like to have "set number" in their .exrc. -------- WARNING! -------- Make sure your terminal is correctly configured! If you use telnet, make sure you have NO SCROLL BARS! Set the correct number of lines and correct terminal type. (This won't be a problem for Floppix, since the Floppix console isn't a telnet window.) On ACADSIX, the "resize" command is useful to set the number of lines correctly. --------------------------------------- Absolute bare minimum basic VI commands --------------------------------------- ESC a i x dd :w file :q! The above commands, plus the arrow keys, will perform most any edit on any file you have. All the other things in VI simply make the editing faster. Some of the other VI commands make the editing much, much faster. ------------------------ What to learn Next in VI ------------------------ Other useful things to know in VI, in vague order of importance: u . p P r o O 5dd 10x h j k l 0 ^ $ H L M A I U cc s f F !! :x :$r file :set showmode :set autoindent :set wrapmargin=5 :set number Learn a new command every week from Chapter 8. ---------------- Review Questions ---------------- - Chapter 8 non-Advanced Review Questions: On ACADAIX or Linux: 1 - 10 (all) - Chapter 8 Advanced Review Questions: none (but read the paragraph Advice, above)