*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~* * W e l c o m e t o V I T u t o r - V e r s i o n 1.3 * *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~* ************** * Lesson 1.0 * ************** VI is a very powerful editor that has many commands, too many to explain in a tutor such as this. This tutor is designed to describe enough of the commands that you will be able to easily use VI as an all-purpose editor. (See end of this file for more advanced tutors.) The approximate time required to complete the tutor is 25-30 minutes, depending upon how much time is spent with experimentation. It is important to remember that this tutor is set up to teach by use. That means that the student needs to execute the commands to learn them properly. Now, make sure that your Shift-Lock key is NOT depressed and press the j key enough times to move the cursor so that Lesson 1.1 completely fills the screen. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ************** * Lesson 1.1 * ************** =====>>>>> MOVING THE CURSOR <<<<<===== ** To move the cursor, press the h,j,k,l keys as indicated. ** ^ k < h l > j v 1. Move the cursor around the screen until you are comfortable. 2. Hold down the down key (j) until it repeats. ---> Now you know how to move to the next lesson. 3. Using the down key, move to Lesson 1.2. Note: If you are ever unsure about something you typed, press [Esc] to place you in Command Mode. Then retype the command you wanted. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ************** * Lesson 1.2 * ************** =====>>>>> ENTERING AND EXITING VI <<<<<===== !! NOTE: Before executing any of the steps below, read this entire lesson!! 1. Press the [Esc] key (to make sure you are in Command Mode). 2. Type :q![Ret] (i.e., press the Return or Enter key after typing '!') ---> This exits the editor WITHOUT saving any changes you have made. If you want to save the changes and exit type :wq[Ret] 3. When you see the shell prompt (%) type: vi tutor.vi (followed by [Ret]). ---> 'vi' means enter the vi editor, 'tutor.vi' is the file you wish to edit, and '[Ret]' means to type the Enter or Return key. 4. If you have these steps memorized and are confident, execute steps 1 through 3 to exit and re-enter the editor. Then cursor down to Lesson 1.3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ************** * Lesson 1.3 * ************** =====>>>>> TEXT EDITING - DELETION <<<<<===== ** While in Command Mode press x to delete the character under the cursor. ** 1. Move the cursor to the line below marked --->. 2. To fix the errors, move the cursor until it is on top of the character to be deleted. 3. Press the x key to delete the unwanted character. 4. Repeat steps 2 through 4 until the sentence is correct. ---> The ccow jumpedd ovverr thhe mooon. 5. Now that the line is correct, go on to Lesson 1.4. NOTE: As you go through this tutor, do not try to memorize, learn by usage. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ************** * Lesson 1.4 * ************** =====>>>>> TEXT EDITING - INSERTION <<<<<===== ** While in Command Mode press i to insert text. ** 1. Move the cursor to the first line below marked --->. 2. To make the first line the same as the second, move the cursor on top of the first character AFTER where the text is to be inserted. 3. Press i and type in the necessary additions. 4. As each error is fixed press [Esc] to return to Command Mode. Repeat steps 2 through 4 to correct the sentence. ---> There is text misng this . ---> There is some text missing from this line. 5. When you are comfortable inserting text move to the summary below. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ******************** * LESSON 1 SUMMARY * ******************** 1. The cursor is moved using either the arrow keys or the h,j,k,l keys. h (left) j (down) k (up) l (right) 2. To enter VI (from the % prompt) type: % vi FILENAME[Ret] 3. To exit VI type: :q![Ret] OR type: :wq[Ret] to save the changes. 4. To delete a character under the cursor in Command Mode type: x 5. To insert text at the cursor while in Command Mode type: i type in text finish with [Esc] NOTE: Pressing [Esc] will place you in Command Mode or will cancel an unwanted and partially completed command. Now continue with Lesson 2. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ************** * Lesson 2.1 * ************** =====>>>>> DELETION COMMANDS <<<<<===== ** Type dw to delete to the end of a word. ** 1. Press [Esc] to make sure you are in Command Mode. 2. Move the cursor to the line below marked --->. 3. Move the cursor to the beginning of a word that needs to be deleted. 4. Type dw to make the word disappear. NOTE: The letters dw will not appear on the screen as you type them, so if you are unsure what you typed, press [Esc] and start over. ---> There are a some words fun that don't belong paper in this sentence. 5. Repeat steps 3 and 4 until the sentence is correct and go to Lesson 2.2. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ************** * Lesson 2.2 * ************** =====>>>>> MORE DELETION COMMANDS <<<<<===== ** Type d$ to delete to the end of the line. ** 1. Press [Esc] to make sure you are in Command Mode. 2. Move the cursor to the line below marked --->. 3. Move the cursor to the end of the correct line (AFTER the first . ). 4. Type d$ or D to delete to the end of the line. ---> Somebody typed the end of this line twice. end of this line twice. 5. Move on to Lesson 2.3 to understand what is happening. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ************** * Lesson 2.3 * ************** =====>>>>> ON COMMANDS AND OBJECTS <<<<<===== The format for the d delete command is as follows: [number] d object OR d [number] object Where: number - is how many times to execute the command (optional, default=1). d - is the command to delete. object - is what the command will operate on (listed below). A short list of objects: w - from the cursor to the end of the word, including the space. e - from the cursor to the end of the word, NOT including the space. $ - from the cursor to the end of the line. NOTE: For the adventurous, pressing just the object while in Command Mode without a command will move the cursor as specified in the object list. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ************** * Lesson 2.4 * ************** =====>>>>> AN UNUSUAL 'COMMAND-OBJECT' <<<<<===== ** Type dd to delete a whole line. ** Due to the frequency of whole line deletion, the designers of VI decided to use d to denote the whole line as object of a deletion command. 1. Move the cursor to the second line in the phrase below. 2. Type dd to delete the line. 3. Now move to the fourth line. 4. Type 2dd (remember number-command-object) to delete the two lines. 1) Roses are red, 2) Mud is fun, 3) Violets are blue, 4) I have a car, 5) Clocks tell time, 6) Sugar is sweet 7) And so are you. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ************** * Lesson 2.5 * ************** =====>>>>> THE UNDO COMMAND <<<<<===== ** Press u to undo the last command, U to fix a whole line. ** 1. Move the cursor to the line below marked ---> and place it on the first error. 2. Type x to delete the unwanted character. 3. Now type u to undo the last command executed. 4. This time fix all the errors on the line using the x command. 5. Now type a capital U to return the line to its original state. ---> Fiix the errors oon thhis line and reeplace them witth undo. 6. This is a very useful command. Now move on to the Lesson 2 Summary. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ******************** * LESSON 2 SUMMARY * ******************** 1. To delete from the cursor to the end of a word type: dw 2. To delete from the cursor to the end of a line type: d$ 3. To delete a whole line type: dd 4. The format for a command in command mode is: [number] command object OR command [number] object where: number - is how many times to repeat the command command - is what to do, such as d for delete object - is what the command should act upon, such as w (word), $ (to the end of line), etc. 5. To undo the last action only, type: u (lowercase u) To undo all the changes on a line type: U (capital U) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ************** * Lesson 3.1 * ************** =====>>>>> THE PUT COMMAND <<<<<===== ** Type p to put the last deletion after the cursor. ** 1. Move the cursor to the first line in the set below. 2. Type dd to delete the line and store it in VI's buffer. 3. Move the cursor to the line ABOVE where the deleted line should go. 4. While in Command Mode, type p to replace the line. 5. Repeat steps 2 through 4 to put all the lines in correct order. d) Can you learn too? b) Violets are blue, c) Intelligence is learned, a) Roses are red, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ************** * Lesson 3.1'* ************** =====>>>>> MORE ON PUT COMMAND <<<<<===== ** Type xp to interchange two characters. ** 1. Move the cursor to the first line below marked --->. 2. Move the cursor so that it is on top of the first error. 3. Type xp . 4. Repeat steps 2 and 3 until the first line is correct. ---> Wehn thsi line was ytped in, soemone ytped too fast! ---> When this line was typed in, someone typed too fast! 5. Now move on to Lesson 3.2. NOTE: Remember that you should be learning by use, not memorization. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ************** * Lesson 3.2 * ************** =====>>>>> THE REPLACE COMMAND <<<<<===== ** Type r and a character to replace the character under the cursor. ** 1. Move the cursor to the first line below marked --->. 2. Move the cursor so that it is on top of the first error. 3. Type r and then the character which should replace the error. 4. Repeat steps 2 and 3 until the first line is correct. ---> Whan this lime was tuoed in, someone presswd some wrojg keys! ---> When this line was typed in, someone pressed some wrong keys! 5. Now move on to Lesson 3.3. NOTE: Remember that you should be learning by use, not memorization. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ************** * Lesson 3.3 * ************** =====>>>>> THE CHANGE COMMAND <<<<<===== ** To change part or all of a word, type cw . ** 1. Move the cursor to the first line below marked --->. 2. Place the cursor on the u in lubw. 3. Type cw and the correct word (in this case, type 'ine'), then [Esc] . 4. Press and move to the next error (the first character to be changed.) 5. Repeat steps 3 and 4 until the first sentence is the same as the second. ---> This lubw has a few wptfd that mrrf changing usf the change command. ---> This line has a few words that need changing using the change command. Notice that cw not only replaces the word, but also places you in insert. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ************** * Lesson 3.4 * ************** =====>>>>> MORE CHANGES USING c <<<<<===== ** The change command is used with the same objects as delete. ** 1. The change command works in the same way as delete. The format is: [number] c object OR c [number] object 2. The objects are also the same, such as w (word), $ (end of line), etc. 3. Move to the first line below marked --->. 4. Move the cursor to the first error. 5. Type c$ to make the rest of the line like the second and press . ---> The end of this line needs some help to make it like the second. ---> The end of this line needs to be corrected using the c$ command. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ******************** * LESSON 3 SUMMARY * ******************** 1. To replace text that has already been deleted, type p . This Puts the deleted text AFTER the cursor (if a line was deleted it will go on the line below the cursor). If just one character was deleted, by the command x then p puts it back after the next character, an interchange in effect. 2. To replace the character under the cursor, type r and then the character which will replace the original. 3. The change command allows you to change the specified object from the cursor to the end of the object. E.g., type cw to change from the cursor to the end of the word, c$ to change to the end of a line. 4. The format for change is: [number] c object OR c [number] object Now go on to the next lesson. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ************** * Lesson 4.1 * ************** =====>>>>> LOCATION AND FILE STATUS <<<<<===== ** Type CTRL-g to show your location in the file and the file status. Type SHIFT-G to move to a line in the file. ** Note: Read this entire lesson before executing any of the steps!! 1. Hold down the Ctrl key and press g . A status line will appear at the bottom of the page with the filename and the line you are on. Remember the line number for Step 3. 2. Press shift-G to move you to the bottom of the file. 3. Type in the number of the line you were on and then shift-G. This will return you to the line you were on when you first pressed Ctrl-g. (When you type in the numbers, they will NOT be displayed on the screen.) 4. If you feel confident to do this, execute steps 1 through 3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ************** * Lesson 4.2 * ************** =====>>>>> THE SEARCH COMMAND <<<<<===== ** Type / followed by a phrase to search for the phrase, followed by [Ret]. ** 1. In command mode type the / character. Notice that it and the cursor appear at the bottom of the screen as with the : command. 2. Now type 'errroor', then [Ret]. This is the word you want to search for. 3. To search for the same phrase again, simply type n . To search for the same phrase in the opposite direction, type Shift-N . 4. If you want to search for a phrase in the backwards direction, use the command ? instead of /. ---> When the search reaches the end of the file it will continue at the start. "errroor" is not the way to spell error; errroor is an error. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ************** * Lesson 4.3 * ************** =====>>>>> MATCHING FENCES SEARCH <<<<<===== ** Type % to find a matching ),], or } . ** 1. Place the cursor on any (, [, or { in the line below marked --->. 2. Now type the % character. 3. The cursor should be on the matching parenthesis, bracket, or brace. 4. Type % to move the cursor back (by matching) to where it was . ---> This ( is a test line with ('s, ['s ] and {'s } in it. )) Note: This is very useful in debugging a program with unmatched parentheses! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ************** * Lesson 4.4 * ************** =====>>>>> A WAY TO CHANGE ERRORS <<<<<===== ** Type :s/old/new/g[Ret] to substitute 'new' for 'old'. ** 1. Move the cursor to the line below marked --->. 2. Type :s/thee/the[Ret] . Note that this command only changes the first occurrence on the line. 3. Now type :s/thee/the/g[Ret] meaning substitute globally on the line. This changes all occurrences on the line. ---> thee best time to see thee flowers is in thee spring. 4. To change every occurrence of a character string between two lines, type :#,#s/old/new/g[Ret] where #,# are the numbers of the two lines. Type :%s/old/new/g[Ret] to change every occurrence in the whole file. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ******************** * LESSON 4 SUMMARY * ******************** 1. Ctrl-g displays your location in the file and the file status. Shift-G moves to the end of the file. A line number followed by Shift-G moves to that line number. 2. Typing / followed by a phrase (and [Ret]) searches FORWARD for the phrase. Typing ? followed by a phrase (and [Ret]) searches BACKWARD for the phrase. After a search, type n to find the next occurrence in the same direction or Shift-N to search in the opposite direction. 3. Typing % while the cursor is on a (,),[,],{, or } locates its matching pair. What happens when the cursor is not on a fence? 4. To substitute new for the first old on a line type :s/old/new[Ret] To substitute new for all 'old's on a line type :s/old/new/g[Ret] To substitute phrases between two line #'s type :#,#s/old/new/g[Ret] To substitute all occurrences in the file type :%s/old/new/g[Ret] To ask for confirmation each time add 'c' :%s/old/new/gc[Ret] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ************** * Lesson 5.1 * ************** =====>>>>> HOW TO EXECUTE A UNIX COMMAND <<<<<===== ** Type :! followed by a UNIX command (and [Ret]) to execute that command. ** 1. Type the familiar command : to set the cursor at the bottom of the screen. This allows you to enter a command. 2. Now type the ! (exclamation point) character. This allows you to execute a UNIX shell command. 3. As an example type ls[Ret] following the !. This will show you a listing of your directory, just as if you were at the % prompt. ---> Note: It is possible to execute any shell command this way. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ************** * Lesson 5.2 * ************** =====>>>>> MORE ON WRITING FILES <<<<<===== ** To save the changes made to the file, type :w FILENAME[Ret]** 1. Type :!ls[Ret] to get a listing of your directory. 2. Choose a filename that is not already in your directory, such as TEST. 3. Now type: :w TEST[Ret] (where TEST is the filename you chose.) 4. This saves the whole file (VI Tutor) under the name TEST. To verify this, type :!ls[Ret] again to see your directory ---> Note that if you were to exit VI and enter again with the filename TEST, the file would be an exact copy of the tutor when you saved it. 5. Now remove the file from your area by typing: :!rm TEST[Ret] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ************** * Lesson 5.3 * ************** =====>>>>> A SELECTIVE WRITE COMMAND <<<<<===== ** To save part of the file, type :#,# w FILENAME[Ret] ** 1. Once again, type :!ls[Ret] to obtain a listing of your directory and choose a suitable filename such as TEST. 2. Move the cursor to the top of this page and type Ctrl-g to find the number of that line. REMEMBER THIS NUMBER! 3. Now move to the bottom of the page and type Ctrl-g again. REMEMBER THIS LINE NUMBER ALSO! 4. To save ONLY a section to a file, type :#,# w TEST[Ret] where #,# are the two numbers you remembered (top,bottom) and TEST is your filename. 5. Again, see that the file is there with :!ls[Ret] but DO NOT remove it. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ************** * Lesson 5.4 * ************** =====>>>>> RETRIEVING AND MERGING FILES <<<<<===== ** To insert the contents of a file, type :r FILENAME[Ret] ** 1. Type :!ls[Ret] to make sure your TEST filename is present from before. 2. Place the cursor at the top of this page. NOTE: After executing Step 3 you will see Lesson 5.3. Then move DOWN to this lesson again. 3. Now retrieve your TEST file using the command :r TEST[Ret] where TEST is the name of the file. NOTE: The file you retrieve is placed starting where the cursor is located. 4. To verify that a file was retrieved, cursor back and notice that there are now two copies of Lesson 5.3, the original and the file version. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ******************** * LESSON 5 SUMMARY * ******************** 1. :!command[Ret] executes a unix system command. Some useful examples are: :!ls[Ret] - shows a directory listing of your area. :!rm FILENAME[Ret] - removes file FILENAME from your area. 2. :w FILENAME[Ret] writes the current VI file to disk with name FILENAME. 3. :#,# FILENAME[Ret] saves the lines # through # in file FILENAME. 4. :r FILENAME[Ret] retrieves disk file FILENAME and inserts it into the current file following the cursor position. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ************** * Lesson 6.1 * ************** =====>>>>> THE OPEN COMMAND <<<<<===== ** Type o to open a line below the cursor and place you in insert mode. ** 1. Move the cursor to the line below marked --->. 2. Type o (lowercase) to open up a line BELOW the cursor and place you in insert mode. 3. Now copy the line marked ---> and press [Esc] to exit insert mode. ---> After typing o the cursor is placed on the open line in insert mode. 4. To open up a line ABOVE the cursor, simply type a capital O , rather than a lowercase o. Try this on the line below. Open up a line above this by typing Shift-O while the cursor is on this line. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ************** * Lesson 6.2 * ************** =====>>>>> THE APPEND COMMAND <<<<<===== ** Type a to insert text AFTER the cursor. ** 1. Move the cursor to the end of the first line below marked ---> by typing $ in Command mode. 2. Type an a (lowercase) to append text AFTER the character under the cursor. (Uppercase A appends to the end of the line.) Note: This avoids typing i , the last character, the text to insert, , cursor-right, and finally, x , just to append to the end of a line! 3. Now complete the first line. Note also that append is exactly the same as insert mode, except for the location where text is inserted. ---> This line will allow you to practice ---> This line will allow you to practice appending text to the end of a line. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ************** * Lesson 6.3 * ************** =====>>>>> ANOTHER VERSION OF REPLACE <<<<<===== ** Type a capital R to replace more than one character. ** 1. Move the cursor to the first line below marked --->. 2. Place the cursor at the beginning of the first word that is different from the second line marked ---> (the word 'last'). 3. Now type R and replace the remainder of the text on the first line by typing over the old text to make the first line the same as the second. ---> To make the first line the same as the last on this page use the keys. ---> To make the first line the same as the second, type R and the new text. 4. Note that when you press [Esc] to exit, any unaltered text remains. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ************** * Lesson 6.4 * ************** =====>>>>> SET ENVIRONMENT VARIABLE <<<<<===== ** Change environment so a search or substitute ignores case ** 1. Search for 'ignore' by entering: /Ignore (note upper case I) Repeat several times by hitting the n key 2. Set the 'ic' (Ignore case) variable by typing: :set ic[Ret] 3. Now search for 'ignore' again by entering: n Repeat search several more times by hitting the n key ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ******************** * LESSON 6 SUMMARY * ******************** 1. Typing o opens a line BELOW the cursor and places the cursor on the open line in insert mode. Typing a capital O opens the line ABOVE the line the cursor is on. 2. Type an a to insert text AFTER the character the cursor is on. Typing a capital A automatically appends text to the end of the line. 3. Typing a capital R enters replace mode until [Esc] is pressed to exit. 4. Typing ":set xxx[Ret]" sets the environment variable "xxx" (To find out about all possible environment variables, type ":set all".) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This concludes the VI Tutor. It was intended to give a brief overview of the VI editor, just enough to allow you to use the editor fairly easily. It is far from complete, as VI has many many more commands. For more information on UNIX and the VI editor please refer to: UNIX Primer Plus, by Mitchell Waite, Donald Martin, and Stephen Prata, Howard W. Sams & Co., Inc. (Indianapolis, Indiana) 1985 UNIX and XENIX A Step-By-Step Guide, by Douglas Topham and Hai Truong, Brady Communications Company (Bowie, Maryland) 1985 Or read the on-line manuals: 'man vi' or 'man ex' (also, see unauthorized comment below) This tutorial was written by Michael C. Pierce and Robert K. Ware, Colorado School of Mines, using ideas supplied by Charles Smith, Colorado State University. E-mail: bware@mines.colorado.edu. It was emended without permission by Carl de Boor. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ comment: BSD 4.x has a more intensive and detailed on-screen tutorial which comes in two parts, and these are available via http://www.cs.wisc.edu/~deboor/vi.beginner http://www.cs.wisc.edu/~deboor/vi.advanced There is also an intense 19-page organized description of vi called viva_vi!, by Carl de Boor, available at http://ftp.cs.wisc.edu/Approx/viva_vi.ps