home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sources.misc
- From: mool@oce.nl (Bram Moolenaar)
- Subject: v37i014: vim - Vi IMitation editor v1.27, Part14/24
- Message-ID: <1993Apr25.013505.22444@sparky.imd.sterling.com>
- X-Md4-Signature: 379ec6bacb85a0779d5ca49c6b0054ab
- Date: Sun, 25 Apr 1993 01:35:05 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: mool@oce.nl (Bram Moolenaar)
- Posting-number: Volume 37, Issue 14
- Archive-name: vim/part14
- Environment: UNIX, AMIGA, MS-DOS
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 14 (of 23)."
- # Contents: vim/tutor/tutor
- # Wrapped by mool@oce-rd2 on Mon Apr 19 15:50:11 1993
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'vim/tutor/tutor' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'vim/tutor/tutor'\"
- else
- echo shar: Extracting \"'vim/tutor/tutor'\" \(28799 characters\)
- sed "s/^X//" >'vim/tutor/tutor' <<'END_OF_FILE'
- X*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
- X* W e l c o m e t o V I T u t o r - V e r s i o n 1 . 2 *
- X*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
- X **************
- X * Lesson 1.0 *
- X **************
- X
- X Vim is a very powerful editor that has many commands, too many to
- X explain in a tutor such as this. This tutor is designed to describe
- X enough of the commands that you will be able to easily use Vim as
- X an all-purpose editor.
- X
- X The approximate time required to complete the tutor is 25-30 minutes,
- X depending upon how much time is spent with experimentation.
- X
- X It is important to remember that this tutor is set up to teach by
- X use. That means that the student needs to execute the commands to
- X learn them properly.
- X
- X Now, make sure that your Shift-Lock key is NOT depressed and press
- X the j key enough times to move the cursor so that Lesson 1.1
- X completely fills the screen.
- X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- X **************
- X * Lesson 1.1 *
- X **************
- X =====>>>>> MOVING THE CURSOR <<<<<=====
- X
- X ** To move the cursor, press the h,j,k,l keys as indicated. **
- X ^
- X k
- X < h l >
- X j
- X v
- X 1. Move the cursor around the screen until you are comfortable.
- X
- X 2. Hold down the down key (j) until it repeats.
- X---> Now you know how to move to the next lesson.
- X
- X 3. Using the down key, move to Lesson 1.2.
- X
- XNote: If you are ever unsure about something you typed, press <ESC> to place
- X you in Command Mode. Then retype the command you wanted.
- X
- X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- X **************
- X * Lesson 1.2 *
- X **************
- X =====>>>>> ENTERING AND EXITING VIM <<<<<=====
- X
- X !! NOTE: Before executing any of the steps below, read this entire lesson!!
- X
- X 1. Press the <ESC> key (to make sure you are in Command Mode).
- X
- X 2. Type :q! <RETURN>.
- X
- X---> This exits the editor WITHOUT saving any changes you have made.
- X If you want to save the changes and exit type :wq <RETURN>
- X
- X 3. When you see the shell prompt (%) type: vim tutor <RETURN>.
- X
- X---> 'vim' means enter the vim editor, 'tutor' is the file you wish to edit.
- X
- X 4. If you have these steps memorized and are confident, execute steps
- X 1 through 3 to exit and re-enter the editor. Then cursor down to
- X Lesson 1.3.
- X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- X **************
- X * Lesson 1.3 *
- X **************
- X =====>>>>> TEXT EDITING - DELETION <<<<<=====
- X
- X** While in Command Mode press x to delete the character under the cursor. **
- X
- X 1. Move the cursor to the line below marked --->.
- X
- X 2. To fix the errors, move the cursor until it is on top of the
- X character to be deleted.
- X
- X 3. Press the x key to delete the unwanted character.
- X
- X 4. Repeat steps 2 through 4 until the sentence is correct.
- X
- X---> The ccow jumpedd ovverr thhe mooon.
- X
- X 5. Now that the line is correct, go on to Lesson 1.4.
- X
- XNOTE: As you go through this tutor, do not try to memorize, learn by usage.
- X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- X **************
- X * Lesson 1.4 *
- X **************
- X =====>>>>> TEXT EDITING - INSERTION <<<<<=====
- X
- X ** While in Command Mode press i to insert text. **
- X
- X 1. Move the cursor to the first line below marked --->.
- X
- X 2. To make the first line the same as the second, move the cursor on top
- X of the first character AFTER where the text is to be inserted.
- X
- X 3. Press i and type in the necessary additions.
- X
- X 4. As each error is fixed press <ESC> to return to Command Mode.
- X Repeat steps 2 through 4 to correct the sentence.
- X
- X---> There is text misng this .
- X---> There is some text missing from this line.
- X
- X 5. When you are comfortable inserting text move to the summary below.
- X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- X ********************
- X * LESSON 1 SUMMARY *
- X ********************
- X
- X 1. The cursor is moved using either the arrow keys or the h,j,k,l keys.
- X h (left) j (down) k (up) l (right)
- X
- X 2. To enter Vim (from the % prompt) type: % vim FILENAME <RETURN>
- X
- X 3. To exit Vim type: <ESC> :q! <RETURN>
- X OR type: <ESC> :wq <RETURN> to save the changes.
- X
- X 4. To delete a character under the cursor in Command Mode type: x
- X
- X 5. To insert text at the cursor while in Command Mode type:
- X i type in text <ESC>
- X
- XNOTE: Pressing <ESC> will place you in Command Mode or will cancel
- X an unwanted and partially completed command.
- X
- XNow continue with Lesson 2.
- X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- X **************
- X * Lesson 2.1 *
- X **************
- X =====>>>>> DELETION COMMANDS <<<<<=====
- X
- X ** Type dw to delete to the end of a word. **
- X
- X 1. Press <ESC> to make sure you are in Command Mode.
- X
- X 2. Move the cursor to the line below marked --->.
- X
- X 3. Move the cursor to the beginning of a word that needs to be deleted.
- X
- X 4. Type dw to make the word disappear.
- X
- X NOTE: The letters dw will appear on the last line of the screen as you type
- X them. If you typed something wrong, press <ESC> and start over.
- X
- X---> There are a some words fun that don't belong paper in this sentence.
- X
- X 5. Repeat steps 3 and 4 until the sentence is correct and go to Lesson 2.2.
- X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- X **************
- X * Lesson 2.2 *
- X **************
- X =====>>>>> MORE DELETION COMMANDS <<<<<=====
- X
- X ** Type d$ to delete to the end of the line. **
- X
- X 1. Press <ESC> to make sure you are in Command Mode.
- X
- X 2. Move the cursor to the line below marked --->.
- X
- X 3. Move the cursor to the end of the correct line (AFTER the first . ).
- X
- X 4. Type d$ to delete to the end of the line.
- X
- X---> Somebody typed the end of this line twice. end of this line twice.
- X
- X
- X 5. Move on to Lesson 2.3 to understand what is happening.
- X
- X
- X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- X **************
- X * Lesson 2.3 *
- X **************
- X =====>>>>> ON COMMANDS AND OBJECTS <<<<<=====
- X
- X The format for the d delete command is as follows:
- X
- X [number] d object OR d [number] object
- X Where:
- X number - is how many times to execute the command (optional, default=1).
- X d - is the command to delete.
- X object - is what the command will operate on (listed below).
- X
- X A short list of objects:
- X w - from the cursor to the end of the word, including the space.
- X e - from the cursor to the end of the word, NOT including the space.
- X $ - from the cursor to the end of the line.
- X
- XNOTE: For the adventurous, pressing just the object while in Command Mode
- X without a command will move the cursor as specified in the object list.
- X
- X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- X **************
- X * Lesson 2.4 *
- X **************
- X =====>>>>> AN EXCEPTION TO 'COMMAND-OBJECT' <<<<<=====
- X
- X ** Type dd to delete a whole line. **
- X
- X Due to the frequency of whole line deletion, the designers of Vim decided
- X it would be easier to simply type two d's in a row to delete a line.
- X
- X 1. Move the cursor to the second line in the phrase below.
- X
- X 2. Type dd to delete the line.
- X
- X 3. Now move to the fourth line.
- X
- X 4. Type 2dd (remember number-command-object) to delete the two lines.
- X
- X 1) Roses are red,
- X 2) Mud is fun,
- X 3) Violets are blue,
- X 4) I have a car,
- X 5) Clocks tell time,
- X 6) Sugar is sweet
- X 7) And so are you.
- X
- X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- X **************
- X * Lesson 2.5 *
- X **************
- X =====>>>>> THE UNDO COMMAND <<<<<=====
- X
- X ** Press u to undo the last commands, U to fix a whole line. **
- X
- X 1. Move the cursor to the line below marked ---> and place it on the
- X first error.
- X 2. Type x to delete the first unwanted character.
- X 3. Now type u to undo the last command executed.
- X 4. This time fix all the errors on the line using the x command.
- X 5. Now type a capital U to return the line to its original state.
- X 6. Now type u a few times to undo the U and preceding commands.
- X 7. Now type CTRL-R (keeping CTRL key pressed while hitting R) a few times
- X to redo the commands (undo the undo's).
- X
- X---> Fiix the errors oon thhis line and reeplace them witth undo.
- X
- X 8. These are very useful commands. Now move on to the Lesson 2 Summary.
- X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- X ********************
- X * LESSON 2 SUMMARY *
- X ********************
- X
- X 1. To delete from the cursor to the end of a word type: dw
- X
- X 2. To delete from the cursor to the end of a line type: d$
- X
- X 3. To delete a whole line type: dd
- X
- X 4. The format for a command in command mode is:
- X
- X [number] command object OR command [number] object
- X where:
- X number - is how many times to repeat the command
- X command - is what to do, such as d for delete
- X object - is what the command should act upon, such as w (word),
- X $ (to the end of line), etc.
- X
- X 5. To undo previous actions, type: u (lowercase u)
- X To undo all the changes on a line type: U (capital U)
- X To undo the undo's type: CTRL-R
- X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- X **************
- X * Lesson 3.1 *
- X **************
- X =====>>>>> THE PUT COMMAND <<<<<=====
- X
- X ** Type p to put the last deletion after the cursor. **
- X
- X 1. Move the cursor to the first line in the set below.
- X
- X 2. Type dd to delete the line and store it in Vim's buffer.
- X
- X 3. Move the cursor to the line ABOVE where the deleted line should go.
- X
- X 4. While in Command Mode, type p to replace the line.
- X
- X 5. Repeat steps 2 through 4 to put all the lines in correct order.
- X
- X d) Can you learn too?
- X b) Violets are blue,
- X c) Intelligence is learned,
- X a) Roses are red,
- X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- X **************
- X * Lesson 3.2 *
- X **************
- X =====>>>>> THE REPLACE COMMAND <<<<<=====
- X
- X ** Type r and a character to replace the character under the cursor. **
- X
- X 1. Move the cursor to the first line below marked --->.
- X
- X 2. Move the cursor so that it is on top of the first error.
- X
- X 3. Type r and then the character which should replace the error.
- X
- X 4. Repeat steps 2 and 3 until the first line is correct.
- X
- X---> Whan this lime was tuoed in, someone presswd some wrojg keys!
- X---> When this line was typed in, someone pressed some wrong keys!
- X
- X 5. Now move on to Lesson 3.2.
- X
- XNOTE: Remember that you should be learning by use, not memorization.
- X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- X **************
- X * Lesson 3.3 *
- X **************
- X =====>>>>> THE CHANGE COMMAND <<<<<=====
- X
- X ** To change part or all of a word, type cw . **
- X
- X 1. Move the cursor to the first line below marked --->.
- X
- X 2. Place the cursor on the u in lubw.
- X
- X 3. Type cw and the correct word (in this case, type 'ine'.)
- X
- X 4. Press <ESC> and move to the next error (the first character to be changed.)
- X
- X 5. Repeat steps 3 and 4 until the first sentence is the same as the second.
- X
- X---> This lubw has a few wptfd that mrrf changing usf the change command.
- X---> This line has a few words that need changing using the change command.
- X
- XNotice that cw not only replaces the word, but also places you in insert.
- X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- X **************
- X * Lesson 3.4 *
- X **************
- X =====>>>>> MORE CHANGES USING c <<<<<=====
- X
- X ** The change command is used with the same objects as delete. **
- X
- X 1. The change command works in the same way as delete. The format is:
- X
- X [number] c object OR c [number] object
- X
- X 2. The objects are also the same, such as w (word), $ (end of line), etc.
- X
- X 3. Move to the first line below marked --->.
- X
- X 4. Move the cursor to the first error.
- X
- X 5. Type c$ to make the rest of the line like the second and press <ESC>.
- X
- X---> The end of this line needs some help to make it like the second.
- X---> The end of this line needs to be corrected using the c$ command.
- X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- X ********************
- X * LESSON 3 SUMMARY *
- X ********************
- X
- X 1. To replace text that has already been deleted, type p . This Puts the
- X deleted text AFTER the cursor (if a line was deleted it will go on the
- X line below the cursor).
- X
- X 2. To replace the character under the cursor, type r and then the
- X character which will replace the original.
- X
- X 3. The change command allows you to change the specified object from the
- X cursor to the end of the object. eg. Type cw to change from the
- X cursor to the end of the word, c$ to change to the end of a line.
- X
- X 4. The format for change is:
- X
- X [number] c object OR c [number] object
- X
- XNow go on to the next lesson.
- X
- X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- X **************
- X * Lesson 4.1 *
- X **************
- X =====>>>>> LOCATION AND FILE STATUS <<<<<=====
- X
- X ** Type CTRL-g to show your location in the file and the file status.
- X Type SHIFT-G to move to a line in the file. **
- X
- X Note: Read this entire lesson before executing any of the steps!!
- X
- X 1. Hold down the Ctrl key and press g . A status line will appear at the
- X bottom of the page with the filename and the line you are on. Remember
- X the line number for Step 3.
- X
- X 2. Press shift-G to move you to the bottom of the file.
- X
- X 3. Type in the number of the line you were on and then shift-G. This will
- X return you to the line you were on when you first pressed Ctrl-g.
- X (When you type in the numbers, they will NOT be displayed on the screen.)
- X
- X 4. If you feel confident to do this, execute steps 1 through 3.
- X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- X **************
- X * Lesson 4.2 *
- X **************
- X =====>>>>> THE SEARCH COMMAND <<<<<=====
- X
- X ** Type / followed by a phrase to search for the phrase. **
- X
- X 1. In command mode type the / character. Notice that it and the cursor
- X appear at the bottom of the screen as with the : command.
- X
- X 2. Now type 'errroor' <RETURN>. This is the word you want to search for.
- X
- X 3. To search for the same phrase again, simply type n .
- X To search for the same phrase in the opposite direction, type Shift-N .
- X
- X 4. If you want to search for a phrase in the backwards direction, use the
- X command ? instead of /.
- X
- X---> When the search reaches the end of the file it will continue at the start.
- X
- X "errroor" is not the way to spell error; errroor is an error.
- X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- X **************
- X * Lesson 4.3 *
- X **************
- X =====>>>>> MATCHING PARENTHESES SEARCH <<<<<=====
- X
- X ** Type % to find a matching ),], or } . **
- X
- X 1. Place the cursor on any (, [, or { in the line below marked --->.
- X
- X 2. Now type the % character.
- X
- X 3. The cursor should be on the matching parenthesis or bracket.
- X
- X 4. Type % to move the cursor back to the first bracket (by matching).
- X
- X---> This ( is a test line with ('s, ['s ] and {'s } in it. ))
- X
- XNote: This is very useful in debugging a program with unmatched parentheses!
- X
- X
- X
- X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- X **************
- X * Lesson 4.4 *
- X **************
- X =====>>>>> A WAY TO CHANGE ERRORS <<<<<=====
- X
- X ** Type :s/old/new/g to substitute 'new' for 'old'. **
- X
- X 1. Move the cursor to the line below marked --->.
- X
- X 2. Type :s/thee/the <RETURN> . Note that this command only changes the
- X first occurrence on the line.
- X
- X 3. Now type :s/thee/the/g meaning substitute globally on the line.
- X This changes all occurrences on the line.
- X
- X---> thee best time to see thee flowers is in thee spring.
- X
- X 4. To change every occurrence of a character string between two lines,
- X type :#,#s/old/new/g where #,# are the numbers of the two lines.
- X Type :%s/old/new/g to change every occurrence in the whole file.
- X
- X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- X ********************
- X * LESSON 4 SUMMARY *
- X ********************
- X
- X 1. Ctrl-g displays your location in the file and the file status.
- X Shift-G moves to the end of the file. A line number followed
- X by Shift-G moves to that line number.
- X
- X 2. Typing / followed by a phrase searches FORWARD for the phrase.
- X Typing ? followed by a phrase searches BACKWARD for the phrase.
- X After a search type n to find the next occurrence in the same direction
- X or Shift-N to search in the opposite direction.
- X
- X 3. Typing % while the cursor is on a (,),[,],{, or } locates its
- X matching pair.
- X
- X 4. To substitute new for the first old on a line type :s/old/new
- X To substitute new for all 'old's on a line type :s/old/new/g
- X To substitute phrases between two line #'s type :#,#s/old/new/g
- X To substitute all occurrences in the file type :%s/old/new/g
- X To ask for confirmation each time add 'c' :%s/old/new/gc
- X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- X **************
- X * Lesson 5.1 *
- X **************
- X =====>>>>> HOW TO EXECUTE AN AMIGA COMMAND <<<<<=====
- X
- X ** Type :! followed by an Amiga command to execute that command. **
- X
- X 1. Type the familiar command : to set the cursor at the bottom of the
- X screen. This allows you to enter a command.
- X
- X 2. Now type the ! (exclamation point) character. This allows you to
- X execute an Amiga shell command.
- X
- X 3. As an example type ls following the !. This will show you a listing
- X of your directory, just as if you were at the % prompt.
- X
- X---> Note: It is possible to execute any shell command this way.
- X
- X
- X
- X
- X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- X **************
- X * Lesson 5.2 *
- X **************
- X =====>>>>> MORE ON WRITING FILES <<<<<=====
- X
- X ** To save the changes made to the file, type :w FILENAME. **
- X
- X 1. Type :!dir to get a listing of your directory.
- X
- X 2. Choose a filename that is not already in your area, such as TEST.
- X
- X 3. Now type: :w TEST (where TEST is the filename you chose.)
- X
- X 4. This saves the whole file (Vim Tutor) under the name TEST.
- X To verify this, type :!dir again to see your directory
- X
- X---> Note that if you were to exit Vim and enter again with the filename TEST,
- X the file would be an exact copy of the tutor when you saved it.
- X
- X 5. Now remove the file from your area by typing: :!delete TEST
- X
- X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- X **************
- X * Lesson 5.3 *
- X **************
- X =====>>>>> A SELECTIVE WRITE COMMAND <<<<<=====
- X
- X ** To save part of the file, type :#,# w FILENAME **
- X
- X 1. Once again, type :!dir to obtain a listing of your directory and
- X choose a suitable filename such as TEST.
- X
- X 2. Move the cursor to the top of this page and type Ctrl-g to find the
- X number of that line. REMEMBER THIS NUMBER!
- X
- X 3. Now move to the bottom of the page and type Ctrl-g again. REMEMBER THIS
- X LINE NUMBER ALSO!
- X
- X 4. To save ONLY a section to a file, type :#,# w TEST where #,# are
- X the two numbers you remembered (top,bottom) and TEST is your filename.
- X
- X 5. Again, see that the file is there with :!dir but DO NOT remove it.
- X
- X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- X **************
- X * Lesson 5.4 *
- X **************
- X =====>>>>> RETRIEVING AND MERGING FILES <<<<<=====
- X
- X ** To insert the contents of a file, type :r FILENAME **
- X
- X 1. Type :!dir to make sure your TEST filename is present from before.
- X
- X 2. Place the cursor at the top of this page.
- X
- XNOTE: After executing Step 3 you will see Lesson 5.3. Then move DOWN to
- X this lesson again.
- X
- X 3. Now retrieve your TEST file using the command :r TEST where TEST is
- X the name of the file.
- X
- XNOTE: The file you retrieve is placed starting where the cursor is located.
- X
- X 4. To verify that a file was retrieved, cursor back and notice that there
- X are now two copies of Lesson 5.3, the original and the file version.
- X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- X ********************
- X * LESSON 5 SUMMARY *
- X ********************
- X
- X 1. :!command executes an Amiga system command.
- X
- X Some useful examples are:
- X :!dir - shows a directory listing of your area.
- X :!delete FILENAME - removes file FILENAME from your area.
- X
- X 2. :w FILENAME writes the current Vim file to disk with name FILENAME.
- X
- X 3. :#,# FILENAME saves the lines # through # in file FILENAME.
- X
- X 4. :r FILENAME retrieves disk file FILENAME and inserts it into the
- X current file following the cursor position.
- X
- X
- X
- X
- X
- X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- X **************
- X * Lesson 6.1 *
- X **************
- X =====>>>>> THE OPEN COMMAND <<<<<=====
- X
- X ** Type o to open a line below the cursor and place you in insert mode. **
- X
- X 1. Move the cursor to the line below marked --->.
- X
- X 2. Type o (lowercase) to open up a line BELOW the cursor and place you in
- X insert mode.
- X
- X 3. Now copy the line marked ---> and press <ESC> to exit insert mode.
- X
- X---> After typing o the cursor is placed on the open line in insert mode.
- X
- X 4. To open up a line ABOVE the cursor, simply type a capital O , rather
- X than a lowercase o. Try this on the line below.
- XOpen up a line above this by typing Shift-O while the cursor is on this line.
- X
- X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- X **************
- X * Lesson 6.2 *
- X **************
- X =====>>>>> THE APPEND COMMAND <<<<<=====
- X
- X ** Type a to insert text AFTER the cursor. **
- X
- X 1. Move the cursor to the end of the first line below marked ---> by
- X typing $ in Command mode.
- X
- X 2. Type an a (lowercase) to append text AFTER the character under the
- X cursor. (Uppercase A appends to the end of the line.)
- X
- XNote: This avoids typing i , the last character, the text to insert, <ESC>,
- X cursor-right, and finally, x , just to append to the end of a line!
- X
- X 3. Now complete the first line. Note also that append is exactly the same
- X as insert mode, except for the location where text is inserted.
- X
- X---> This line will allow you to practice
- X---> This line will allow you to practice appending text to the end of a line.
- X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- X **************
- X * Lesson 6.3 *
- X **************
- X =====>>>>> ANOTHER VERSION OF REPLACE <<<<<=====
- X
- X ** Type a capital R to replace more than one character. **
- X
- X 1. Move the cursor to the first line below marked --->.
- X
- X 2. Place the cursor at the beginning of the first word that is different
- X from the second line marked ---> (the word 'last').
- X
- X 3. Now type R and replace the remainder of the text on the first line by
- X typing over the old text to make the first line the same as the second.
- X
- X---> To make the first line the same as the last on this page use the keys.
- X---> To make the first line the same as the second, type R and the new text.
- X
- X 4. Note that when you press <ESC> to exit, any unaltered text remains.
- X
- X
- X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- X **************
- X * Lesson 6.4 *
- X **************
- X =====>>>>> SET ENVIRONMENT VARIABLE <<<<<=====
- X
- X ** Change environment so a search or substitute ignores case **
- X
- X
- X 1. Search for 'ignore' by entering:
- X /ignore
- X Repeat several times by hitting the n key
- X
- X 2. Set the 'ic' (Ignore case) variable by typing:
- X :set ic
- X
- X 3. Now search for 'ignore' again by entering: n
- X Repeat search several more times by hitting the n key
- X
- X
- X
- X
- X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- X ********************
- X * LESSON 6 SUMMARY *
- X ********************
- X
- X 1. Typing o opens a line BELOW the cursor and places the cursor on the open
- X line in insert mode.
- X Typing a capital O opens the line ABOVE the line the cursor is on.
- X
- X 2. Type an a to insert text AFTER the character the cursor is on.
- X Typing a capital A automatically appends text to the end of the line.
- X
- X 3. Typing a capital R enters replace mode until <ESC> is pressed to exit.
- X
- X 4. Typing ":set xxx" sets the environment variable "xxx"
- X
- X
- X
- X
- X
- X
- X
- X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- X
- X This concludes the Vim Tutor. It was intended to give a brief overview of
- X the Vim editor, just enough to allow you to use the editor fairly easily.
- X It is far from complete as Vim has many many more commands.
- X
- X For more information on Vim editor please refer to:
- X
- X doc/reference.doc - a complete description of Vim
- X doc/index - a short summary of all commands
- X doc/difference.doc - summary of differences between vi and Vim
- X
- X Or hit the HELP key!
- X
- X This tutorial was written by Michael C. Pierce and Robert K. Ware,
- X Colorado School of Mines using ideas supplied by Charles Smith,
- X Colorado State University.
- X E-mail: bware@mines.colorado.edu.
- X
- X Modified for Vim by Bram Moolenaar.
- X
- X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- END_OF_FILE
- if test 28799 -ne `wc -c <'vim/tutor/tutor'`; then
- echo shar: \"'vim/tutor/tutor'\" unpacked with wrong size!
- fi
- # end of 'vim/tutor/tutor'
- fi
- echo shar: End of archive 14 \(of 23\).
- cp /dev/null ark14isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 23 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
- -------------8<----------------8<----------------8<---------------8<--------
- Bram Moolenaar | DISCLAIMER: This note does not
- Oce Nederland B.V., Research & Development | necessarily represent the position
- p.o. box 101, 5900 MA Venlo | of Oce-Nederland B.V. Therefore
- The Netherlands phone +31 77 594077 | no liability or responsibility for
- UUCP: mool@oce.nl fax +31 77 595450 | whatever will be accepted.
-
- exit 0 # Just in case...
-