diff --git a/tutor/tutor b/tutor/tutor deleted file mode 100644 index 64a27d1c0..000000000 --- a/tutor/tutor +++ /dev/null @@ -1,970 +0,0 @@ -=============================================================================== -= W e l c o m e t o t h e V I M T u t o r - Version 1.7 = -=============================================================================== - - Vim 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 Vim as - an all-purpose editor. - - The approximate time required to complete the tutor is 25-30 minutes, - depending upon how much time is spent with experimentation. - - ATTENTION: - The commands in the lessons will modify the text. Make a copy of this - file to practise on (if you started "vimtutor" this is already a copy). - - It is important to remember that this tutor is set up to teach by - use. That means that you need to execute the commands to learn them - properly. If you only read the text, you will forget the commands! - - 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 Hint: The h key is at the left and moves left. - < h l > The l key is at the right and moves right. - j The j key looks like a down arrow. - 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 to place - you in Normal mode. Then retype the command you wanted. - -NOTE: The cursor keys should also work. But using hjkl you will be able to - move around much faster, once you get used to it. Really! - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lesson 1.2: EXITING VIM - - - !! NOTE: Before executing any of the steps below, read this entire lesson!! - - 1. Press the key (to make sure you are in Normal mode). - - 2. Type: :q! . - This exits the editor, DISCARDING any changes you have made. - - 3. Get back here by executing the command that got you into this tutor. That - might be: vimtutor - - 4. If you have these steps memorized and are confident, execute steps - 1 through 3 to exit and re-enter the editor. - -NOTE: :q! discards any changes you made. In a few lessons you - will learn how to save the changes to a file. - - 5. Move the cursor down to Lesson 1.3. - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lesson 1.3: TEXT EDITING - DELETION - - - ** 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 - - - ** 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 to return to Normal 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 lesson 1.5. - - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lesson 1.5: TEXT EDITING - APPENDING - - - ** Press A to append text. ** - - 1. Move the cursor to the first line below marked --->. - It does not matter on what character the cursor is in that line. - - 2. Press A and type in the necessary additions. - - 3. As the text has been appended press to return to Normal mode. - - 4. Move the cursor to the second line marked ---> and repeat - steps 2 and 3 to correct this sentence. - ----> There is some text missing from th - There is some text missing from this line. ----> There is also some text miss - There is also some text missing here. - - 5. When you are comfortable appending text move to lesson 1.6. - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lesson 1.6: EDITING A FILE - - ** Use :wq to save a file and exit. ** - - !! NOTE: Before executing any of the steps below, read this entire lesson!! - - 1. Exit this tutor as you did in lesson 1.2: :q! - Or, if you have access to another terminal, do the following there. - - 2. At the shell prompt type this command: vim tutor - 'vim' is the command to start the Vim editor, 'tutor' is the name of the - file you wish to edit. Use a file that may be changed. - - 3. Insert and delete text as you learned in the previous lessons. - - 4. Save the file with changes and exit Vim with: :wq - - 5. If you have quit vimtutor in step 1 restart the vimtutor and move down to - the following summary. - - 6. After reading the above steps and understanding them: do it. - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lesson 1 SUMMARY - - - 1. The cursor is moved using either the arrow keys or the hjkl keys. - h (left) j (down) k (up) l (right) - - 2. To start Vim from the shell prompt type: vim FILENAME - - 3. To exit Vim type: :q! to trash all changes. - OR type: :wq to save the changes. - - 4. To delete the character at the cursor type: x - - 5. To insert or append text type: - i type inserted text insert before the cursor - A type appended text append after the line - -NOTE: Pressing will place you in Normal mode or will cancel - an unwanted and partially completed command. - -Now continue with Lesson 2. - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lesson 2.1: DELETION COMMANDS - - - ** Type dw to delete a word. ** - - 1. Press to make sure you are in Normal 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 letter d will appear on the last line of the screen as you type - it. Vim is waiting for you to type w . If you see another character - than d you typed something wrong; press 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 to make sure you are in Normal 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$ 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 OPERATORS AND MOTIONS - - - Many commands that change text are made from an operator and a motion. - The format for a delete command with the d delete operator is as follows: - - d motion - - Where: - d - is the delete operator. - motion - is what the operator will operate on (listed below). - - A short list of motions: - w - until the start of the next word, EXCLUDING its first character. - e - to the end of the current word, INCLUDING the last character. - $ - to the end of the line, INCLUDING the last character. - - Thus typing de will delete from the cursor to the end of the word. - -NOTE: Pressing just the motion while in Normal mode without an operator will - move the cursor as specified. - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lesson 2.4: USING A COUNT FOR A MOTION - - - ** Typing a number before a motion repeats it that many times. ** - - 1. Move the cursor to the start of the line marked ---> below. - - 2. Type 2w to move the cursor two words forward. - - 3. Type 3e to move the cursor to the end of the third word forward. - - 4. Type 0 (zero) to move to the start of the line. - - 5. Repeat steps 2 and 3 with different numbers. - ----> This is just a line with words you can move around in. - - 6. Move on to Lesson 2.5. - - - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lesson 2.5: USING A COUNT TO DELETE MORE - - - ** Typing a number with an operator repeats it that many times. ** - - In the combination of the delete operator and a motion mentioned above you - insert a count before the motion to delete more: - d number motion - - 1. Move the cursor to the first UPPER CASE word in the line marked --->. - - 2. Type d2w to delete the two UPPER CASE words - - 3. Repeat steps 1 and 2 with a different count to delete the consecutive - UPPER CASE words with one command - ----> this ABC DE line FGHI JK LMN OP of words is Q RS TUV cleaned up. - - - - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lesson 2.6: OPERATING ON LINES - - - ** Type dd to delete a whole line. ** - - Due to the frequency of whole line deletion, the designers of Vi decided - it would be easier to simply type two d's to delete a line. - - 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 to delete 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.7: THE UNDO COMMAND - - - ** Press u to undo the last commands, 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 first 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. - 6. Now type u a few times to undo the U and preceding commands. - 7. Now type CTRL-R (keeping CTRL key pressed while hitting R) a few times - to redo the commands (undo the undo's). - ----> Fiix the errors oon thhis line and reeplace them witth undo. - - 8. These are very useful commands. Now move on to the Lesson 2 Summary. - - - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lesson 2 SUMMARY - - - 1. To delete from the cursor up to the next 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. To repeat a motion prepend it with a number: 2w - 5. The format for a change command is: - operator [number] motion - where: - operator - is what to do, such as d for delete - [number] - is an optional count to repeat the motion - motion - moves over the text to operate on, such as w (word), - $ (to the end of line), etc. - - 6. To move to the start of the line use a zero: 0 - - 7. To undo previous actions, type: u (lowercase u) - To undo all the changes on a line, type: U (capital U) - To undo the undo's, type: CTRL-R - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lesson 3.1: THE PUT COMMAND - - - ** Type p to put previously deleted text after the cursor. ** - - 1. Move the cursor to the first ---> line below. - - 2. Type dd to delete the line and store it in a Vim register. - - 3. Move the cursor to the c) line, ABOVE where the deleted line should go. - - 4. Type p to put the line below the cursor. - - 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.2: THE REPLACE COMMAND - - - ** Type rx to replace the character at the cursor with x . ** - - 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 be there. - - 4. Repeat steps 2 and 3 until the first line is equal to the second one. - ----> 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 doing, not memorization. - - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lesson 3.3: THE CHANGE OPERATOR - - - ** To change until the end of a word, type ce . ** - - 1. Move the cursor to the first line below marked --->. - - 2. Place the cursor on the u in lubw. - - 3. Type ce and the correct word (in this case, type ine ). - - 4. Press and move to the next character that needs 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 operator. ----> This line has a few words that need changing using the change operator. - -Notice that ce deletes the word and places you in Insert mode. - - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lesson 3.4: MORE CHANGES USING c - - - ** The change operator is used with the same motions as delete. ** - - 1. The change operator works in the same way as delete. The format is: - - c [number] motion - - 2. The motions are the same, such as w (word) and $ (end of line). - - 3. Move to the first line below marked --->. - - 4. Move the cursor to the first error. - - 5. Type c$ and type 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. - -NOTE: You can use the Backspace key to correct mistakes while typing. - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lesson 3 SUMMARY - - - 1. To put back text that has just 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). - - 2. To replace the character under the cursor, type r and then the - character you want to have there. - - 3. The change operator allows you to change from the cursor to where the - motion takes you. eg. Type ce 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: - - c [number] motion - -Now go on to the next lesson. - - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lesson 4.1: CURSOR LOCATION AND FILE STATUS - - ** Type CTRL-G to show your location in the file and the file status. - Type 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 . We call this CTRL-G. - A message will appear at the bottom of the page with the filename and the - position in the file. Remember the line number for Step 3. - -NOTE: You may see the cursor position in the lower right corner of the screen - This happens when the 'ruler' option is set (see :help 'ruler' ) - - 2. Press G to move you to the bottom of the file. - Type gg to move you to the start of the file. - - 3. Type the number of the line you were on and then G . This will - return you to the line you were on when you first pressed CTRL-G. - - 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. ** - - 1. In Normal 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' . 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 N . - - 4. To search for a phrase in the backward direction, use ? instead of / . - - 5. To go back to where you came from press CTRL-O (Keep Ctrl down while - pressing the letter o). Repeat to go back further. CTRL-I goes forward. - ----> "errroor" is not the way to spell error; errroor is an error. -NOTE: When the search reaches the end of the file it will continue at the - start, unless the 'wrapscan' option has been reset. - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lesson 4.3: MATCHING PARENTHESES 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 will move to the matching parenthesis or bracket. - - 4. Type % to move the cursor to the other matching bracket. - - 5. Move the cursor to another (,),[,],{ or } and see what % does. - ----> 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: THE SUBSTITUTE COMMAND - - - ** Type :s/old/new/g to substitute 'new' for 'old'. ** - - 1. Move the cursor to the line below marked --->. - - 2. Type :s/thee/the . Note that this command only changes the - first occurrence of "thee" in the line. - - 3. Now type :s/thee/the/g . Adding the g flag means to substitute - globally in the line, change all occurrences of "thee" in 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 where #,# are the line numbers of the range - of lines where the substitution is to be done. - Type :%s/old/new/g to change every occurrence in the whole file. - Type :%s/old/new/gc to find every occurrence in the whole file, - with a prompt whether to substitute or not. - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lesson 4 SUMMARY - - - 1. CTRL-G displays your location in the file and the file status. - G moves to the end of the file. - number G moves to that line number. - gg moves to the first line. - - 2. Typing / followed by a phrase searches FORWARD for the phrase. - Typing ? followed by a phrase searches BACKWARD for the phrase. - After a search type n to find the next occurrence in the same direction - or N to search in the opposite direction. - CTRL-O takes you back to older positions, CTRL-I to newer positions. - - 3. Typing % while the cursor is on a (,),[,],{, or } goes to its match. - - 4. To substitute new for the first old in a line type :s/old/new - To substitute new for all 'old's on a line type :s/old/new/g - To substitute phrases between two line #'s type :#,#s/old/new/g - To substitute all occurrences in the file type :%s/old/new/g - To ask for confirmation each time add 'c' :%s/old/new/gc - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lesson 5.1: HOW TO EXECUTE AN EXTERNAL COMMAND - - - ** Type :! followed by an external command 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-line command. - - 2. Now type the ! (exclamation point) character. This allows you to - execute any external shell command. - - 3. As an example type ls following the ! and then hit . This - will show you a listing of your directory, just as if you were at the - shell prompt. Or use :!dir if ls doesn't work. - -NOTE: It is possible to execute any external command this way, also with - arguments. - -NOTE: All : commands must be finished by hitting - From here on we will not always mention it. - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lesson 5.2: MORE ON WRITING FILES - - - ** To save the changes made to the text, type :w FILENAME. ** - - 1. Type :!dir or :!ls to get a listing of your directory. - You already know you must hit after this. - - 2. Choose a filename that does not exist yet, such as TEST. - - 3. Now type: :w TEST (where TEST is the filename you chose.) - - 4. This saves the whole file (the Vim Tutor) under the name TEST. - To verify this, type :!dir or :!ls again to see your directory. - -NOTE: If you were to exit Vim and start it again with vim TEST , the file - would be an exact copy of the tutor when you saved it. - - 5. Now remove the file by typing (MS-DOS): :!del TEST - or (Unix): :!rm TEST - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lesson 5.3: SELECTING TEXT TO WRITE - - - ** To save part of the file, type v motion :w FILENAME ** - - 1. Move the cursor to this line. - - 2. Press v and move the cursor to the fifth item below. Notice that the - text is highlighted. - - 3. Press the : character. At the bottom of the screen :'<,'> will appear. - - 4. Type w TEST , where TEST is a filename that does not exist yet. Verify - that you see :'<,'>w TEST before you press . - - 5. Vim will write the selected lines to the file TEST. Use :!dir or :!ls - to see it. Do not remove it yet! We will use it in the next lesson. - -NOTE: Pressing v starts Visual selection. You can move the cursor around - to make the selection bigger or smaller. Then you can use an operator - to do something with the text. For example, d deletes the text. - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lesson 5.4: RETRIEVING AND MERGING FILES - - - ** To insert the contents of a file, type :r FILENAME ** - - 1. Place the cursor just above this line. - -NOTE: After executing Step 2 you will see text from Lesson 5.3. Then move - DOWN to see this lesson again. - - 2. Now retrieve your TEST file using the command :r TEST where TEST is - the name of the file you used. - The file you retrieve is placed below the cursor line. - - 3. 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. - -NOTE: You can also read the output of an external command. For example, - :r !ls reads the output of the ls command and puts it below the - cursor. - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lesson 5 SUMMARY - - - 1. :!command executes an external command. - - Some useful examples are: - (MS-DOS) (Unix) - :!dir :!ls - shows a directory listing. - :!del FILENAME :!rm FILENAME - removes file FILENAME. - - 2. :w FILENAME writes the current Vim file to disk with name FILENAME. - - 3. v motion :w FILENAME saves the Visually selected lines in file - FILENAME. - - 4. :r FILENAME retrieves disk file FILENAME and puts it below the - cursor position. - - 5. :r !dir reads the output of the dir command and puts it below 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 the lowercase letter o to open up a line BELOW the cursor and place - you in Insert mode. - - 3. Now type some text and press 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 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 start of the line below marked --->. - - 2. Press e until the cursor is on the end of li . - - 3. Type an a (lowercase) to append text AFTER the cursor. - - 4. Complete the word like the line below it. Press to exit Insert - mode. - - 5. Use e to move to the next incomplete word and repeat steps 3 and 4. - ----> This li will allow you to pract appendi text to a line. ----> This line will allow you to practice appending text to a line. - -NOTE: a, i and A all go to the same Insert mode, the only difference is where - the characters are inserted. - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lesson 6.3: ANOTHER WAY TO REPLACE - - - ** Type a capital R to replace more than one character. ** - - 1. Move the cursor to the first line below marked --->. Move the cursor to - the beginning of the first xxx . - - 2. Now press R and type the number below it in the second line, so that it - replaces the xxx . - - 3. Press to leave Replace mode. Notice that the rest of the line - remains unmodified. - - 4. Repeat the steps to replace the remaining xxx. - ----> Adding 123 to xxx gives you xxx. ----> Adding 123 to 456 gives you 579. - -NOTE: Replace mode is like Insert mode, but every typed character deletes an - existing character. - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lesson 6.4: COPY AND PASTE TEXT - - - ** Use the y operator to copy text and p to paste it ** - - 1. Go to the line marked with ---> below and place the cursor after "a)". - - 2. Start Visual mode with v and move the cursor to just before "first". - - 3. Type y to yank (copy) the highlighted text. - - 4. Move the cursor to the end of the next line: j$ - - 5. Type p to put (paste) the text. Then type: a second . - - 6. Use Visual mode to select " item.", yank it with y , move to the end of - the next line with j$ and put the text there with p . - ----> a) this is the first item. - b) - - NOTE: you can also use y as an operator; yw yanks one word. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lesson 6.5: SET OPTION - - - ** Set an option so a search or substitute ignores case ** - - 1. Search for 'ignore' by entering: /ignore - Repeat several times by pressing n . - - 2. Set the 'ic' (Ignore case) option by entering: :set ic - - 3. Now search for 'ignore' again by pressing n - Notice that Ignore and IGNORE are now also found. - - 4. Set the 'hlsearch' and 'incsearch' options: :set hls is - - 5. Now type the search command again and see what happens: /ignore - - 6. To disable ignoring case enter: :set noic - -NOTE: To remove the highlighting of matches enter: :nohlsearch -NOTE: If you want to ignore case for just one search command, use \c - in the phrase: /ignore\c -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lesson 6 SUMMARY - - 1. Type o to open a line BELOW the cursor and start Insert mode. - Type O to open a line ABOVE the cursor. - - 2. Type a to insert text AFTER the cursor. - Type A to insert text after the end of the line. - - 3. The e command moves to the end of a word. - - 4. The y operator yanks (copies) text, p puts (pastes) it. - - 5. Typing a capital R enters Replace mode until is pressed. - - 6. Typing ":set xxx" sets the option "xxx". Some options are: - 'ic' 'ignorecase' ignore upper/lower case when searching - 'is' 'incsearch' show partial matches for a search phrase - 'hls' 'hlsearch' highlight all matching phrases - You can either use the long or the short option name. - - 7. Prepend "no" to switch an option off: :set noic - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lesson 7.1: GETTING HELP - - - ** Use the on-line help system ** - - Vim has a comprehensive on-line help system. To get started, try one of - these three: - - press the key (if you have one) - - press the key (if you have one) - - type :help - - Read the text in the help window to find out how the help works. - Type CTRL-W CTRL-W to jump from one window to another. - Type :q to close the help window. - - You can find help on just about any subject, by giving an argument to the - ":help" command. Try these (don't forget pressing ): - - :help w - :help c_CTRL-D - :help insert-index - :help user-manual -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lesson 7.2: CREATE A STARTUP SCRIPT - - - ** Enable Vim features ** - - Vim has many more features than Vi, but most of them are disabled by - default. To start using more features you have to create a "vimrc" file. - - 1. Start editing the "vimrc" file. This depends on your system: - :e ~/.vimrc for Unix - :e $VIM/_vimrc for MS-Windows - - 2. Now read the example "vimrc" file contents: - :r $VIMRUNTIME/vimrc_example.vim - - 3. Write the file with: - :w - - The next time you start Vim it will use syntax highlighting. - You can add all your preferred settings to this "vimrc" file. - For more information type :help vimrc-intro - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lesson 7.3: COMPLETION - - - ** Command line completion with CTRL-D and ** - - 1. Make sure Vim is not in compatible mode: :set nocp - - 2. Look what files exist in the directory: :!ls or :!dir - - 3. Type the start of a command: :e - - 4. Press CTRL-D and Vim will show a list of commands that start with "e". - - 5. Press and Vim will complete the command name to ":edit". - - 6. Now add a space and the start of an existing file name: :edit FIL - - 7. Press . Vim will complete the name (if it is unique). - -NOTE: Completion works for many commands. Just try pressing CTRL-D and - . It is especially useful for :help . - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Lesson 7 SUMMARY - - - 1. Type :help or press or to open a help window. - - 2. Type :help cmd to find help on cmd . - - 3. Type CTRL-W CTRL-W to jump to another window - - 4. Type :q to close the help window - - 5. Create a vimrc startup script to keep your preferred settings. - - 6. When typing a : command, press CTRL-D to see possible completions. - Press to use one completion. - - - - - - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - This concludes the Vim Tutor. It was intended to give a brief overview of - the Vim editor, just enough to allow you to use the editor fairly easily. - It is far from complete as Vim has many many more commands. Read the user - manual next: ":help user-manual". - - For further reading and studying, this book is recommended: - Vim - Vi Improved - by Steve Oualline - Publisher: New Riders - The first book completely dedicated to Vim. Especially useful for beginners. - There are many examples and pictures. - See http://iccf-holland.org/click5.html - - This book is older and more about Vi than Vim, but also recommended: - Learning the Vi Editor - by Linda Lamb - Publisher: O'Reilly & Associates Inc. - It is a good book to get to know almost anything you want to do with Vi. - The sixth edition also includes information on Vim. - - 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. - - Modified for Vim by Bram Moolenaar. - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tutor/tutor.ja b/tutor/tutor.ja deleted file mode 100644 index 99cc7d463..000000000 --- a/tutor/tutor.ja +++ /dev/null @@ -1,976 +0,0 @@ -=============================================================================== -= V I M 教 本 (チュートリアル) へ よ う こ そ - Version 1.7 = -=============================================================================== - - Vim は、このチュートリアルで説明するには多すぎる程のコマンドを備えた非常 - に強力なエディターです。このチュートリアルは、あなたが Vim を万能エディ - ターとして使いこなせるようになるのに十分なコマンドについて説明をするよう - なっています。 - - チュートリアルを完了するのに必要な時間は、覚えたコマンドを試すのにどれだ - け時間を使うのかにもよりますが、およそ25から30分です。 - - ATTENTION: - 以下の練習用コマンドにはこの文章を変更するものもあります。練習を始める前 - にコピーを作成しましょう("vimtutor"したならば、既にコピーされています)。 - - このチュートリアルが、使うことで覚えられる仕組みになっていることを、心し - ておかなければなりません。正しく学習するにはコマンドを実際に試さなければ - ならないのです。文章を読んだだけならば、きっと忘れてしまいます!。 - - さぁ、Capsロック(Shift-Lock)キーが押されていないことを確認した後、画面に - レッスン1.1 が全部表示されるところまで、j キーを押してカーソルを移動しま - しょう。 -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 1.1: カーソルの移動 - - - ** カーソルを移動するには、示される様に h,j,k,l を押します ** - ^ - k ヒント: h キーは左方向に移動します。 - < h l > l キーは右方向に移動します。 - j j キーは下矢印キーのようなキーです。 - v - 1. 移動に慣れるまで、スクリーンでカーソル移動させましょう。 - - 2. 下へのキー(j)を押しつづけると、連続して移動できます。 - これで次のレッスンに移動する方法がわかりましたね。 - - 3. 下へのキーを使って、レッスン1.2 に移動しましょう。 - -NOTE: 何をタイプしているか判らなくなったら、を押してノーマルモードにし - ます。それから入力しようとしていたコマンドを再入力しましょう。 - -NOTE: カーソルキーでも移動できます。しかし hjkl に一度慣れてしまえば、はるか - に速く移動することができるでしょう。いやマジで! - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 1.2: VIM の起動と終了 - - - !! NOTE: 以下のあらゆるステップを行う前に、このレッスンを読みましょう!! - - 1. キーを押しましょう。(確実にノーマルモードにするため) - - 2. 次のようにタイプ: :q! - これにより編集した内容を保存せずにエディタが終了します。 - - 3. このチュートリアルを始める為のコマンドを実行すると、ここに戻れます。 - そのコマンドは: vimtutor - - 4. これまでのステップを覚え自信がついたならば、ステップ 1 から 3 までを実 - 際に試して、Vim を1度終了してから再び起動しましょう。 - -NOTE: :q! は全ての変更を破棄します。レッスンにて変更をファイルに保 - 存する方法についても勉強していきましょう。 - - 5. 1.3までカーソルを移動させましょう。 - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 1.3: テキスト編集 - 削除 - - - ** ノーマルモードにてカーソルの下の文字を削除するには x を押します ** - - 1. 以下の ---> と示された行にカーソルを移動しましょう。 - - 2. 間違いを修正するために、削除する最初の文字までカーソルを移動します。 - - 3. 不必要な文字を x を押して削除しましょう。 - - 4. 文が正しくなるまで ステップ 2 から 4 を繰り返しましょう。 - ----> その ううさぎ は つつきき を こええてて とびはねたた - - 5. 行が正しくなったら、レッスン 1.4 へ進みましょう。 - -NOTE: 全てのレッスンを通じて、覚えようとするのではなく実際にやってみましょう。 - - - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 1.4: テキスト編集 - 挿入 - - - ** ノーマルモードにてテキストを挿入するには i を押します ** - - 1. 以下の ---> と示された最初の行にカーソルを移動しましょう。 - - 2. 1行目を2行目と同じ様にするために、テキストを挿入しなければならない位置 - の次の文字にカーソルを移動します。 - - 3. i キーを押してから、追加が必要な文字をタイプしましょう。 - - 4. 間違いを修正したら を押してコマンドモードに戻り、正しい文になる様 - にステップ 2 から 4 を繰り返しましょう。 - ----> この には 足りない テキスト ある。 ----> この 行 には 幾つか 足りない テキスト が ある。 - - 5. 挿入の方法がわかったらレッスン 1.5 へ進みましょう。 - - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 1.5: テキスト編集 - 追加 - - - ** テキストを追加するには A を押しましょう ** - - 1. 以下の ---> と示された最初の行にカーソルを移動しましょう。 - カーソルがその文字上にあってもかまいません。 - - 2. 追加が必要な場所で A をタイプしましょう。 - - 3. テキストを追加し終えたら、 を押してノーマルモードに戻りましょう。 - - 4. 2行目の ---> と示された場所へ移動し、ステップ 2 から 3 を繰り返して文法 - を修正しましょう。 - ----> ここには間違ったテキストがあり - ここには間違ったテキストがあります。 ----> ここにも間違ったテキス - ここにも間違ったテキストがあります。 - - 5. テキストの追加が軽快になってきたらレッスン 1.6 へ進みましょう。 - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 1.6: ファイルの編集 - - - ** ファイルを保存して終了するには :wq とタイプします ** - - !! NOTE: 以下のステップを実行する前に、まず全体を読んでください!! - - 1. レッスン 1.2 でやったように :q! をタイプして、このチュートリアルを終了 - します。あるいは、別の端末がある場合はそこで以下の内容を行ってもかまい - ません。 - - 2. シェルプロンプトでこのコマンドをタイプします: vim tutor - 'vim'が Vim エディタを起動するコマンド、'tutor' は編集したいファイルの - 名前です。変更してもよいファイルを使いましょう。 - - 3. 前のレッスンで学んだように、テキストを挿入、削除します。 - - 4. 変更をファイルに保存します: :wq - - 5. ステップ 1 で vimtutuor を終了した場合は vimtutor を再度起動し、以下の - 要約へ進みましょう。 - - 6. 以上のステップを読んで理解した上でこれを実行しましょう。 - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 1 要約 - - - 1. カーソルは矢印キーもしくは hjkl キーで移動します。 - h (左) j (下) k (上) l (右) - - 2. Vim を起動するにはプロンプトから vim ファイル名 とタイプします。 - - 3. Vim を終了するには :q! とタイプします(変更を破棄)。 - もしくは :wq とタイプします(変更を保存)。 - - 4. カーソルの下の文字を削除するには、ノーマルモードで x とタイプします。 - - 5. カーソルの位置に文字を挿入するには、ノーマルモードで i とタイプします。 - i テキストのタイプ カーソル位置に追加 - A テキストの追加 行末に追加 - -NOTE: キーを押すとノーマルモードに移行します。その際、間違ったり入力途 - 中のコマンドを取り消すことができます。 - -さて、続けてレッスン 2 を始めましょう。 - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 2.1: 削除コマンド - - - ** 単語の末尾までを削除するには dw とタイプしましょう ** - - 1. ノーマルモードであることを確認するために を押しましょう。 - - 2. 以下の ---> と示された行にカーソルを移動しましょう。 - - 3. 消したい単語の先頭にカーソルを移動しましょう。 - - 4. 単語を削除するために dw とタイプしましょう。 - - NOTE: タイプすると、dw という文字がスクリーンの最下行に現われます。 - タイプを間違ってしまった時には を押してやり直しましょう。 - ----> この 文 紙 には いくつかの たのしい 必要のない 単語 が 含まれて います。 - - 5. 3 から 4 までを文が正しくなるまで繰り返し、レッスン 2.2 へ進みましょう。 - - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 2.2: その他の削除コマンド - - - ** 行の末尾までを削除するには d$ とタイプしましょう ** - - 1. ノーマルモードであることを確認するのに を押しましょう。 - - 2. 以下の ---> と示された行にカーソルを移動しましょう。 - - 3. 正しい文の末尾へカーソルを移動しましょう(最初の 。 の後です)。 - - 4. 行末まで削除するのに d$ とタイプしましょう。 - ----> 誰かがこの行の最後を2度タイプしました。 2度タイプしました。 - - - 5. どういうことか理解するために、レッスン 2.3 へ進みましょう。 - - - - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 2.3: オペレータとモーション - - - 多くのコマンドはオペレータとモーションからテキストに変更を加えます。 - 削除コマンド d のオペレータは次の様になっています: - - d モーション - - それぞれ: - d - 削除コマンド。 - モーション - 何に対して働きかけるか(以下に挙げます)。 - - オペレータの一部一覧: - w - カーソル位置から空白を含む単語の末尾まで。 - e - カーソル位置から空白を含まない単語の末尾まで。 - $ - カーソル位置から行末まで。 - - つまり de とタイプすると、カーソル位置から単語の終わりまでを削除します。 - -NOTE: 冒険したい人は、ノーマルモードにてコマンドなしにモーションを押して - みましょう。カーソルが目的語一覧で示される位置に移動するはずです。 - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 2.4: モーションにカウントを使用する - - - ** 何回も行いたい繰り返しのモーションの前に数値をタイプします。 ** - - 1. 以下の ---> と示された行の先頭にカーソルを移動します。 - - 2. 2w をタイプして単語2つ分前に移動します。 - - 3. 3e をタイプして3つ目の単語の終端に移動します。 - - 4. 0 (ゼロ)をタイプして行頭に移動します。 - - 5. ステップ 2 と 3 を違う数値を使って繰り返します。 - ----> This is just a line with words you can move around in. - - 6. レッスン 2.5 に進みましょう。 - - - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 2.5: より多くを削除するためにカウントを使用する - - - ** オペレータとカウントをタイプすると、その操作が複数回繰り返されます。 ** - - 既述の削除のオペレータとモーションの組み合わせにカウントを追加することで、 - より多くの削除が行えます: - d 数値 モーション - - 1. ---> と示された行の行頭部分にカーソルを移動しましょう。 - - 2. UPPER CASE の単語2つを d2w とタイプして削除します。 - - 3. UPPER CASE という連続した単語を、1つのコマンドと異なるカウントを指定し、 - ステップ 1 と 2 を繰り返します。 - ----> このABC DE行のFGHI JK LMN OP単語はQ RS TUV綺麗になった。 - -NOTE: オペレータ d とモーションの間にカウントを使った場合、オペレータのない - 場合のモーションのように動作します。 - 例: 3dw と d3w は同等で、3w を削除します。 - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 2.6: 行の操作 - - - ** 行全体を削除するには dd とタイプします ** - - 行全体を削除する頻度が多いので、Viのデザイナーは行の削除を d の2回タイプと - いう簡単なものに決めました。 - - 1. 以下の句の2行目にカーソルを移動します。 - 2. dd とタイプして行を削除します。 - 3. さらに4行目に移動します。 - 4. 2dd とタイプして2行を削除します。 - ----> 1) バラは赤い、 ----> 2) つまらないものは楽しい、 ----> 3) スミレは青い、 ----> 4) 私は車をもっている、 ----> 5) 時計が時刻を告げる、 ----> 6) 砂糖は甘い ----> 7) オマエモナー - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 2.7: やり直しコマンド - - - ** 最後のコマンドを取り消すには u を押します。U は行全体の取消です。 ** - - 1. 以下の ---> と示された行にカーソルを移動し、最初の間違いにカーソル - を移動しましょう。 - 2. x をタイプしていらない先頭の文字を削除しましょう。 - 3. さぁ、u をタイプして最後に実行したコマンドを取り消しましょう。 - 4. 今度は、x を使用して誤りを全て修正しましょう。 - 5. 大文字の U をタイプして、行を元の状態に戻しましょう。 - 6. u をタイプして直前の U コマンドを取消しましょう。 - 7. ではコマンドを再実行するのに CTRL-R (CTRL を押したまま R を打つ)を数回 - タイプしてみましょう(取消の取消)。 - ----> このの行のの間違いを修正々し、後でそれらの修正をを取消しまますす。 - - 8. これはとても便利なコマンドです。さぁレッスン 2 要約へ進みましょう。 - - - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 2 要約 - - - 1. カーソル位置から単語の末尾までを削除するには dw とタイプします。 - 2. カーソル位置から行の末尾までを削除するには d$ とタイプします。 - 3. 行全体を削除するには dd とタイプします。 - - 4. モーションを繰り返すには数値を付与します: 2w - 5. 変更に用いるコマンドの形式は - オペレータ [数値] モーション - - それぞれ: - オペレータ - 削除 d の類で何をするか。 - 数値 - そのコマンドを何回繰り返すか。 - モーション - w (単語)や $ (行末)などの類で、テキストの何に対して働きか - けるか。 - - 6. 行の先頭に移動するにはゼロを使用します: 0 - - 7. 前回の動作を取消す: u (小文字 u) - 行全体の変更を取消す: U (大文字 U) - 取消しの取消し: CTRL-R -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 3.1: 貼り付けコマンド - - - ** 最後に削除された行をカーソルの後に貼り付けるには p をタイプします ** - - 1. 以下の段落の最初の行にカーソルを移動しましょう。 - - 2. dd とタイプして行を削除し、Vim のバッファに格納しましょう。 - - 3. 削除した行が本来あるべき位置の上の行まで、カーソルを移動させましょう。 - - 4. ノーマルモードで p をタイプして格納した行を画面に戻します。 - - 5. 順番が正しくなる様にステップ 2 から 4 を繰り返しましょう。 - - d) 貴方も学ぶことができる? - b) スミレは青い、 - c) 知恵とは学ぶもの、 - a) バラは赤い、 - - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 3.2: 置き換えコマンド - - - ** カーソルの下の文字を置き換えるには r をタイプします ** - - 1. 以下の ---> と示された最初の行にカーソルを移動しましょう。 - - 2. 最初の間違いの先頭にカーソルを移動しましょう。 - - 3. r とタイプし、間違っている文字を置き換える、正しい文字をタイプしましょう。 - - 4. 最初の行が正しくなるまでステップ 2 から 3 を繰り返しましょう。 - ----> この合を人力した時ね、その人は幾つか問違ったキーを押しもした! ----> この行を入力した時に、その人は幾つか間違ったキーを押しました! - - 5. さぁ、レッスン 3.3 へ進みましょう。 - -NOTE: 実際に試しましょう。決して覚えるだけにはしないこと。 - - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 3.3: 変更コマンド - - - ** 単語の一部、もしくは全体を変更するには cw とタイプします ** - - 1. 以下の ---> と示された最初の行にカーソルを移動しましょう。 - - 2. lubw の u の位置にカーソルを移動しましょう。 - - 3. cw とタイプし、正しい単語をタイプしましょう(この場合 'ine' とタイプ)。 - - 4. 次の間違い(変更すべき文字の先頭)に移動するために をタイプします。 - - 5. 最初の行が次の行の様になるまでステップ 3 と 4 を繰り返します。 - ----> This lubw has a few wptfd that mrrf changing usf the change operator. ----> This line has a few words that need changing using the change operator. - -cw は単語を変更するだけでなく、挿入も行えることに注意しましょう。 - - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 3.4: c を使用したその他の変更 - - - ** 変更コマンドは、削除コマンドと同じ様にオブジェクトを使用します ** - - 1. 変更コマンドは、削除コマンドと同じような動作をします。その形式は - - c [数値] モーション - - 2. オブジェクトも同じで、w は単語、 $ は行末などといったものです。 - - 3. 以下の ---> と示された行にカーソルを移動しましょう。 - - 4. 最初の間違いへカーソルを移動しましょう。 - - 5. c$ とタイプして行の残りを2行目の様にし、 を押しましょう。 - ----> 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. - -NOTE: タイプ中の間違いはバックスペースキーを使って直すこともできます。 - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 3 要約 - - - 1. 既に削除されたテキストを再配置するには、p をタイプします。これは削除さ - れたテキストをカーソルの後に挿入します(行単位で削除されたのならば、カー - ソルのある次の行に挿入されます)。 - - 2. カーソルの下の文字を置き換えるには、r をタイプした後、それを置き換える - 文字をタイプします。 - - 3. 変更コマンドではカーソル位置から特定のモーションで指定される終端までを変 - 更することが可能です。例えば cw ならばカーソル位置から単語の終わりまで、 - c$ ならば行の終わりまでを変更します。 - - 4. 変更コマンドの形式は - - c [数値] モーション - -さぁ、次のレッスンへ進みましょう。 - - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 4.1: 位置とファイルの情報 - - ** ファイル内での位置とファイルの状態を表示するには CTRL-G をタイプします。 - ファイル内のある行に移動するには G をタイプします ** - - NOTE: ステップを実行する前に、このレッスン全てに目を通しましょう!! - - 1. CTRL を押したまま g を押しましょう。この操作を CTRL-G と呼んでいます。 - ページの一番下にファイル名と行番号が表示されるはずです。 ステップ 3のため - に行番号を覚えておきましょう。 - -NOTE: 画面の右下隅にカーソルの位置が表示されているかもしれません。これは - 'ruler' オプション(:help 'ruler' を参照)を設定することで表示されます。 - - 2. 最下行に移動するために G をタイプしましょう。 - ファイルの先頭に移動するには gg とタイプしましょう。 - - 3. 先ほどの行の番号をタイプし G をタイプしましょう。最初に CTRL-G を押した行 - に戻って来るはずです。 - - 4. 自信が持てたらステップ 1 から 3 を実行しましょう。 - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 4.2: 検索コマンド - - - ** 語句を検索するには / と、前方検索する語句をタイプします。** - - 1. ノーマルモードで / という文字をタイプします。画面一番下に : コマンドと - 同じ様に / が現れることに気づくでしょう。 - - 2. では、'errroor' とタイプしましょう。これが検索したい単語です。 - - 3. 同じ語をもう一度検索するときは 単に n をタイプします。 - 逆方向に語句を検索するときは N をタイプします。 - - 4. 逆方向に語句を検索する場合は、/ の代わりに ? コマンドを使用します。 - - 5. 元の場所に戻るには CTRL-O (Ctrl を押し続けながら o 文字タイプ)をタイプし - ます。さらに戻るにはこれを繰り返します。CTRL-I は前方向です。 - ----> "errroor" は error とスペルが違います; errroor はいわゆる error です。 -NOTE: 検索がファイルの終わりに達すると、オプション 'wrapscan' が設定されている - 場合は、ファイルの先頭から検索を続行します。 - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 4.3: 対応する括弧を検索 - - - ** 対応する ),] や } を検索するには % をタイプします ** - - 1. 下の ---> で示された行で (,[ か { のどれかにカーソルを移動しましょう。 - - 2. そこで % とタイプしましょう。 - - 3. カーソルは対応する括弧に移動するはずです。 - - 4. 最初の括弧に移動するには % とタイプしましょう。 - - 5. 他の (,),[,],{ や } でカーソルを移動し、% が何をしているか確認しましょう。 - ----> This ( is a test line with ('s, ['s ] and {'s } in it. )) - - -NOTE: この機能は括弧が一致していないプログラムをデバッグするのにとても役立ち - ます。 - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 4.4: 間違いを変更する方法 - - - ** 'old' を 'new' に置換するには :s/old/new/g とタイプします ** - - 1. 以下の ---> と示された行にカーソルを移動しましょう。 - - 2. :s/thee/the とタイプしましょう。このコマンドはその行で最初に見 - つかったものにだけ行なわれることに気をつけましょう。 - - 3. では :s/thee/the/g とタイプしましょう。行全体を置換することを意味します。 - この変更はその行で見つかった全ての箇所に対して行なわれます。 - ----> thee best time to see thee flowers is in thee spring. - - 4. 複数行から見つかる文字を変更するには - :#,#s/old/new/g #,# には置き換える範囲の開始と終了の行番号を指定しま - す。 - :%s/old/new/g ファイル全体で見つかるものに対して変更する。 - :%s/old/new/gc ファイル全体で見つかるものに対して、1つ1つ確認をとりな - がら変更する。 - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 4 要約 - - - 1. CTRL-G はファイルでの位置とファイルの詳細を表示します。 - G はファイルの最下行に移動します。 - 数値 G はその行に移動します。 - gg は先頭行に移動します。 - - 2. / の後に語句をタイプすると前方に語句を検索します。 - ? の後に語句をタイプすると後方に語句を検索します。 - 検索の後の n は同じ方向の次の検索を、N は逆方向の検索をします。 - CTRL-O は場所を前に移し、CTRL-I は場所を次に移動します。 - - 3. (,),[,],{, もしくは } 上にカーソルがある状態で % をタイプすると対になる文 - 字へ移動します。 - - 4. 現在行の最初の old を new に置換する。 :s/old/new - 現在行の全ての old を new に置換する。 :s/old/new/g - 2つの # 間で語句を置換する。 :#,#s/old/new/g - ファイルの中の全ての検索語句を置換する。 :%s/old/new/g - 'c' を加えると置換の度に確認を求める。 :%s/old/new/gc - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 5.1: 外部コマンドを実行する方法 - - - ** :! の後に実行する外部コマンドをタイプします ** - - 1. 画面の最下部にカーソルが移動するよう、慣れ親しんだ : をタイプしましょう。 - これでコマンドがタイプできる様になります。 - - 2. ここで ! という文字(感嘆符)をタイプしましょう。 - これで外部シェルコマンドが実行できる様になります。 - - 3. 例として ! に続けて ls とタイプし を押しましょう。 - シェルプロンプトのようにディレクトリの一覧が表示されるはずです。 - もしくは ls が動かないならば :!dir を使用しましょう。 - -NOTE: この方法によってあらゆるコマンドが実行することができます。もちろん引数 - も与えられます。 - -NOTE: 全ての : コマンドは を押して終了しなければなりません。 - 以降ではこのことに言及しません。 - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 5.2: その他のファイルへ書き込み - - - ** ファイルへ変更を保存するには :w ファイル名 とタイプします ** - - 1. ディレクトリの一覧を得るために :!dir もしくは :!ls とタイプしましょう。 - このあと を押すのは既にご存知ですね。 - - 2. TEST のように、そのディレクトリに無いファイル名を一つ選びます。 - - 3. では :w TEST とタイプしましょう (TEST は、選んだファイル名です)。 - - 4. これによりファイル全体が TEST という名前で保存されます。 - もう一度 :!dir もしくは :!ls とタイプして確認してみましょう。 - -NOTE: ここで Vim を終了し、ファイル名 TEST と共に起動すると、保存した時の - チュートリアルの複製ができ上がるはずです。 - - 5. さらに、次のようにタイプしてファイルを消しましょう(MS-DOS): :!del TEST - もしくは(Unix): :!rm TEST - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 5.3: 選択した書き込み - - -** ファイルの位置を保存するには、v モーションと :w FILENAME をタイプします。 ** - - 1. この行にカーソルを移動します。 - - 2. v を押し、以下の第5項目にカーソルを移動します。テキストが強調表示されるの - に注目して下さい。 - - 3. 文字 : を押すと、画面の最下部に :'<,'> が現れます。 - - 4. w TEST (TEST は存在しないファイル名)をタイプします。 - を押す前に :'<,'>w TEST となっていることを確認して下さい。 - - 5. Vim は TEST というファイルに選択された行を書き込むでしょう。 - !dir もしくは !ls でそれを確認します。 - それは削除しないでおいて下さい。次のレッスンで使用します。 - -NOTE: v を押すと、Visual 選択が始まります。カーソルを動かすことで、選択範囲を - 大きくも小さくもできます。さらに、その選択範囲に対してオペレータを適用 - きます。例えば d はテキストを削除します。 - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 5.4: ファイルの取込と合併 - - - ** ファイルの中身を挿入するには :r ファイル名 とタイプします ** - - 1. カーソルを以下の行に合わせます。 - -NOTE: ステップ 2 の実行後、レッスン 5.3 のテキストが現れます。下に下がってこ - のレッスンに移動しましょう。 - - 2. では TEST というファイルを :r TEST というコマンドで読み込みましょう。 - ここでいう TEST は使うファイルの名前のことです。 - 読み込まれたファイルは、カーソル行の下にあります。 - - 3. 取込んだファイルを確認してみましょう。カーソルを戻すと、レッスン5.3 の - オリジナルとファイルによるものの2つがあることがわかります。 - -NOTE: 外部コマンドの出力を読み込むことも出来ます。例えば、 - :r !ls は ls コマンドの出力をカーソル以下に読み込みます。 - - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 5 要約 - - - 1. :!command によって 外部コマンドを実行します。 - - よく使う例: - (MS-DOS) (Unix) - :!dir :!ls - ディレクトリ内の一覧を見る。 - :!del FILENAME :!rm FILENAME - ファイルを削除する。 - - 2. :w ファイル名 によってファイル名というファイルがディスクに書き込まれる。 - - 3. v モーションで :w FILENAME とすると、ビジュアル選択行がファイルに保存さ - れる。 - - 4. :r ファイル名 によりファイル名というファイルがディスクより取込まれ、 - カーソル位置の下に挿入される。 - - 5. :r !dir は dir コマンドの出力をカーソル位置以下に読み込む。 - - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 6.1: オープンコマンド - - - ** o をタイプすると、カーソルの下の行が開き、挿入モードに入ります ** - - 1. 以下の ---> と示された行にカーソルを移動しましょう。 - - 2. o (小文字) をタイプして、カーソルの下の行を開き、挿入モードに入ります。 - - 3. さらに挿入モードを終了する為に をタイプします。 - ----> o をタイプするとカーソルは開いた行へ移動し挿入モードに入ります。 - - 4. カーソルの上の行に挿入するには、小文字の o ではなく、単純に大文字の O - をタイプします。次の行で試してみましょう。 - ----> この行の上へ挿入するには、この行へカーソルを置いて O をタイプします。 - - - - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 6.2: 追加コマンド - - - ** カーソルの次の位置からテキストを追加するには a とタイプします ** - - 1. カーソルを ---> で示された行へ移動しましょう。 - - 2. e を押して li の終端部までカーソルを移動します。 - - 3. カーソルの後ろにテキストを追加するために a (小文字) をタイプします。 - - 4. その下の行のような単語に完成させます。挿入モードを抜ける為に を押 - します。 - - 5. e を使って次の不完全な単語へ移動し、ステップ 3 と 4 を繰り返します。 - ----> This li will allow you to pract appendi text to a line. ----> This line will allow you to practice appending text to a line. - -NOTE: a, i と A は同じ挿入モードへ移りますが、文字が挿入される位置だけが異なり - ます。 - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 6.3: その他の置換方法 - - - ** 1文字以上を置き換えるには大文字の R とタイプしましょう ** - - 1. 以下の ---> と示された行にカーソルを移動します。最初の xxx の先頭に移動し - ます。 - - 2. R を押して、2行目の数値をタイプすることで、xxx が置換されます。 - - 3. 置換モードを抜けるには を押します。行の残りが変更されていないままに - なることに注意してください。 - - 4. 残った xxx をステップを繰り返して置換しましょう。 - ----> Adding 123 to xxx gives you xxx. ----> Adding 123 to 456 gives you 579. - -NOTE: 置換モードは挿入モードに似ていますが、全てのタイプされた文字は既存の文字 - を削除します。 - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 6.4: テキストのコピーとペースト - - - ** テキストのコピーにはオペレータ y を、ペーストには p を使います ** - - 1. ---> と示された行へ移動し、カーソルを "a)" の後に置いておきます。 - - 2. v でビジュアルモードを開始し、"first"の手前までカーソルを移動します。 - - 3. y をタイプして強調表示されたテキストを yank (コピー)します。 - - 4. 次の行の行末までカーソルを移動します: j$ - - 5. p を押して貼り付け(put)てから、次をタイプします: a second - - 6. ビジュアルモードで " item." を選択し、y でヤンク、次の行の行末まで j$ で - 移動し、 p でテキストをそこに put します。 - ----> a) this is the first item. - b) - - NOTE: 単語を1つ yank するのに y をオペレータとして yw とすることも出来ます。 -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 6.5: オプションの設定 - - - ** 検索や置換の際に大文字/小文字を無視するには、オプションを設定します ** - - 1. 次の様に入力して 'ignore' を検索しましょう: /ignore - n を押して何度か検索を繰り返します。 - - 2. 次の様に入力して 'ic' (Ignore Case の略) オプションを設定します: :set ic - - 3. では n によってもう1度 'ignore' を検索します。 - n を押してさらに数回検索を繰り返しましょう。 - - 4. 'hlsearch' と 'incsearch' オプションを設定しましょう: :set hls is - - 5. 検索コマンドを再入力して、何が起こるか見てみましょう: /ignore - - 6. 大文字小文字の区別を無効にするには次の様に入力します: :set noic - -NOTE: マッチの強調表示をやめるには次の様に入力します: :nohlsearch -NOTE: 1つの検索コマンドだけ大文字小文字の区別をやめたいならば、フレーズに \c - を使用します: /ignore\c -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 6 要約 - - 1. o をタイプするとカーソルの下の行を開けて、そこで挿入モードになる。 - O (大文字) をタイプするとカーソルの上の行で挿入モードになる。 - - 2. カーソル上の文字の次からテキストを追加するには a とタイプする。 - 行末に自動でテキストを挿入するには大文字 A をタイプする。 - - 3. e コマンドは単語の終端部カーソルを移動する。 - - 4. y オペレータはテキストを yank (コピー)し、p はそれを put (ペースト)する。 - - 5. 大文字の R をタイプすると置換モードに入り、を押すと抜ける。 - - 6. ":set xxx" とタイプするとオプション "xxx" が設定される。 - 'ic' 'ignorecase' 検索時に大文字小文字の区別しない - 'is' 'incsearch' 検索フレーズに部分マッチしている部分を表示する - 'hls' 'hlsearch' マッチするすべを強調表示する - 長い方、短い方、どちらのオプション名でも使用できます。 - - 7. "no" を付与し、オプションを無効にします: :set noic - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 7.1: オンラインヘルプコマンド - - - ** オンラインヘルプを使用しましょう ** - - Vim には広範にわたるオンラインヘルプシステムがあります。 - ヘルプを開始するには、これら3つのどれか1つを試してみましょう: - - ヘルプキー を押す(もしあるならば)。 - - キーを押す(もしあるならば)。 - - :help とタイプする。 - - ヘルプウィンドウのテキストを読むと、ヘルプの動作が理解できます。 - CTRL-W CTRL-W とタイプすると ヘルプウィンドウへジャンプします。 - :q とタイプすると ヘルプウィンドウが閉じられます。 - - ":help" コマンドに引数を与えることにより、あらゆる題名のヘルプを見つけること - ができます。これらを試してみましょう( をタイプし忘れないように): - - :help w - :help c_CTRL-D - :help insert-index - :help user-manual -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 7.2: 起動スクリプトの作成 - - ** Vim の特徴を発揮する ** - - Vim には Vi よりも多くの特徴を踏まえていますが、そのほとんどは初期状態にて - 使用不可となっています。より多くの特徴を使いはじめるには "vimrc" ファイル - を作成します。 - - 1. "vimrc" ファイルの編集を開始する。これはシステムに依存します。 - :edit ~/.vimrc UNIX 向け - :edit $VIM/_vimrc MS-Windows 向け - - 2. ここでサンプルの "vimrc" を読み込みます。 - :read $VIMRUNTIME/vimrc_example.vim - - 3. 以下のようにファイルへ書き込みます。 - :write - - 次回 Vim を起動すると、色づけ構文が使えるようになるでしょう。 - この "vimrc" ファイルへ、お好みの設定を追加することができます。 - より多くの情報を得るには :help vimrc-intro とタイプします。 - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 7.3: 補完 - - - ** CTRL-D と でコマンドラインを補完する ** - - 1. 互換モードでないことを確認します: :set nocp - - 2. 現在のディレクトリに在るファイルを :!ls か :!dir で確認します。 - - 3. コマンドの開始をタイプします: :e - - 4. CTRL-D を押すと Vim は "e" から始まるコマンドの一覧を表示します。 - - 5. を押すと Vim は ":edit" というコマンド名を補完します。 - - 6. さらに空白と、既存のファイル名の始まりを加えます: :edit FIL - - 7. を押すと Vim は名前を補完します。(もし一つしか無かった場合) - -NOTE: 補完は多くのコマンドで動作します。そして CTRL-D と 押してみてくだ - さい。特に :help の際に役立ちます。 - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - レッスン 7 要約 - - - 1. ヘルプウィンドウを開くには :help とするか もしくは を押す。 - - 2. コマンド(cmd)のヘルプを検索するには :help cmd とタイプする。 - - 3. 別のウィンドウへジャンプするには CTRL-W CTRL-W とタイプする。 - - 4. ヘルプウィンドウを閉じるには :q とタイプする。 - - 5. お好みの設定を保つには vimrc 起動スクリプトを作成する。 - - 6. : command で可能な補完を見るには CTRL-D をタイプする。 - 補完を使用するには を押す。 - - - - - - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - これにて Vim のチュートリアルを終わります。エディタを簡単に、しかも充分に - 使うことができるようにと、Vim の持つ概念の要点のみを伝えようとしました。 - Vim にはさらに多くのコマンドがあり、ここで全てを説明することはできません。 - 以降はユーザーマニュアルを参照ください: ":help user-manual" - - これ以後の学習のために、次の本を推薦します。 - Vim - Vi Improved - by Steve Oualline - 出版社: New Riders - 最初の本は完全に Vim のために書かれました。とりわけ初心者にはお奨めです。 - 多くの例題や図版が掲載されています。 - 次のURLを参照して下さい http://iccf-holland.org/click5.html - - 次は Vim よりも Vi について書かれた古い本ですが推薦します: - Learning the Vi Editor - by Linda Lamb - 出版社: O'Reilly & Associates Inc. - Vi でやりたいと思うことほぼ全てを知ることができる良書です。 - 第6版では、Vim についての情報も含まれています。 - - このチュートリアルは Colorado State University の Charles Smith のアイデア - を基に、Colorado School of Mines の Michael C. Pierce と Robert K. Ware の - 両名によって書かれました。 E-mail: bware@mines.colorado.edu. - - Modified for Vim by Bram Moolenaar. - - 日本語訳 松本 泰弘 - 監修 村岡 太郎 - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - vi:set ts=8 sts=4 sw=4 tw=78: