============================ The VI (VIM) Editor (Review) ============================ -IAN! idallen@ncf.ca 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 better your mark will be on tests and exams. VI skill is essential to you 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. Avoid using the stock "vi" command on ACADUNIX. Use "vim" instead. The "vi" command is the IBM standard version of "vi" and it has none of the advanced features of the open-source "vim" editor. Use "vim". Some people like to have "set number" in their .exrc. The corresponding file for VIM is ".vimrc" and some people like to have "syntax off" in it. -------- WARNING! -------- Make sure your terminal is correctly configured before you enter VI! Be careful when you resize a window. A remote session of VI on another machine may not pick up the new window size, and what you see on your screen may get garbled. (If this happens, quit VI and start over.) If you use telnet from under Windows to connect to a Unix machine, make sure you have NO SCROLL BARS VISIBLE! Set the correct number of lines and correct terminal type. (This won't be a problem for people working from a Unix machine, since Unix is good about passing the window size to VI.) -------- TUTORIAL -------- Complete a short VIM tutorial by copying the "tutor" file into your Linux directory and editing it. You can find the "tutor" file under this directory in the Linux Lab (and nearby on other Linux machines): /usr/share/vim/vim58/tutor/ Read the README.txt file in the above directory. Follow the instructions in the tutorial (in the file named "tutor"). --------------------------------------- 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 and get you better marks in less time. Some of the other VI commands make the editing much, much faster. [Compare "dd" (delete a whole line) with typing 80 "x" commands!] ------------------------ 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 :syntax off To improve your skill, learn a new command every week!