Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | =============================================================================== |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 2 | = W e l c o m e t o t h e V I M T u t o r - Version 1.7 = |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3 | =============================================================================== |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 4 | = C H A P T E R ONE = |
| 5 | =============================================================================== |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 6 | |
| 7 | Vim is a very powerful editor that has many commands, too many to |
| 8 | explain in a tutor such as this. This tutor is designed to describe |
| 9 | enough of the commands that you will be able to easily use Vim as |
| 10 | an all-purpose editor. |
Bram Moolenaar | d1caa94 | 2020-04-10 22:10:56 +0200 | [diff] [blame] | 11 | The approximate time required to complete the tutor is 30 minutes, |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 12 | depending upon how much time is spent with experimentation. |
| 13 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 14 | ATTENTION: |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 15 | The commands in the lessons will modify the text. Make a copy of this |
Bram Moolenaar | 37c64c7 | 2017-09-19 22:06:03 +0200 | [diff] [blame] | 16 | file to practice on (if you started "vimtutor" this is already a copy). |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 17 | |
| 18 | It is important to remember that this tutor is set up to teach by |
| 19 | use. That means that you need to execute the commands to learn them |
| 20 | properly. If you only read the text, you will forget the commands! |
Bram Moolenaar | 7254067 | 2018-02-09 22:00:53 +0100 | [diff] [blame] | 21 | Now, make sure that your Caps-Lock key is NOT depressed and press |
Bram Moolenaar | 6dc819b | 2018-07-03 16:42:19 +0200 | [diff] [blame] | 22 | the j key enough times to move the cursor so that lesson 1.1 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 23 | completely fills the screen. |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 24 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 25 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 26 | Lesson 1.1.1: MOVING THE CURSOR |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 27 | |
| 28 | |
| 29 | ** To move the cursor, press the h,j,k,l keys as indicated. ** |
| 30 | ^ |
| 31 | k Hint: The h key is at the left and moves left. |
| 32 | < h l > The l key is at the right and moves right. |
Bram Moolenaar | 756ec0f | 2007-05-05 17:59:48 +0000 | [diff] [blame] | 33 | j The j key looks like a down arrow. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 34 | v |
| 35 | 1. Move the cursor around the screen until you are comfortable. |
| 36 | |
| 37 | 2. Hold down the down key (j) until it repeats. |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 38 | Now you know how to move to the next lesson. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 39 | |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 40 | 3. Using the down key, move to lesson 1.1.2. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 41 | |
Bram Moolenaar | 756ec0f | 2007-05-05 17:59:48 +0000 | [diff] [blame] | 42 | NOTE: If you are ever unsure about something you typed, press <ESC> to place |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 43 | you in Normal mode. Then retype the command you wanted. |
| 44 | |
Bram Moolenaar | 756ec0f | 2007-05-05 17:59:48 +0000 | [diff] [blame] | 45 | NOTE: The cursor keys should also work. But using hjkl you will be able to |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 46 | move around much faster, once you get used to it. Really! |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 47 | |
| 48 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 49 | Lesson 1.1.2: EXITING VIM |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 50 | |
| 51 | |
| 52 | !! NOTE: Before executing any of the steps below, read this entire lesson!! |
| 53 | |
| 54 | 1. Press the <ESC> key (to make sure you are in Normal mode). |
| 55 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 56 | 2. Type: :q! <ENTER>. |
| 57 | This exits the editor, DISCARDING any changes you have made. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 58 | |
Bram Moolenaar | dfb1841 | 2013-12-11 18:53:29 +0100 | [diff] [blame] | 59 | 3. Get back here by executing the command that got you into this tutor. That |
| 60 | might be: vimtutor <ENTER> |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 61 | |
| 62 | 4. If you have these steps memorized and are confident, execute steps |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 63 | 1 through 3 to exit and re-enter the editor. |
| 64 | |
| 65 | NOTE: :q! <ENTER> discards any changes you made. In a few lessons you |
| 66 | will learn how to save the changes to a file. |
| 67 | |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 68 | 5. Move the cursor down to lesson 1.1.3. |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 69 | |
| 70 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 71 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 72 | Lesson 1.1.3: TEXT EDITING - DELETION |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 73 | |
| 74 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 75 | ** Press x to delete the character under the cursor. ** |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 76 | |
| 77 | 1. Move the cursor to the line below marked --->. |
| 78 | |
| 79 | 2. To fix the errors, move the cursor until it is on top of the |
| 80 | character to be deleted. |
| 81 | |
| 82 | 3. Press the x key to delete the unwanted character. |
| 83 | |
| 84 | 4. Repeat steps 2 through 4 until the sentence is correct. |
| 85 | |
| 86 | ---> The ccow jumpedd ovverr thhe mooon. |
| 87 | |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 88 | 5. Now that the line is correct, go on to lesson 1.1.4. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 89 | |
| 90 | NOTE: As you go through this tutor, do not try to memorize, learn by usage. |
| 91 | |
| 92 | |
| 93 | |
| 94 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 95 | Lesson 1.1.4: TEXT EDITING - INSERTION |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 96 | |
| 97 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 98 | ** Press i to insert text. ** |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 99 | |
| 100 | 1. Move the cursor to the first line below marked --->. |
| 101 | |
| 102 | 2. To make the first line the same as the second, move the cursor on top |
Bram Moolenaar | 4c92e75 | 2019-02-17 21:18:32 +0100 | [diff] [blame] | 103 | of the character BEFORE which the text is to be inserted. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 104 | |
| 105 | 3. Press i and type in the necessary additions. |
| 106 | |
| 107 | 4. As each error is fixed press <ESC> to return to Normal mode. |
| 108 | Repeat steps 2 through 4 to correct the sentence. |
| 109 | |
| 110 | ---> There is text misng this . |
| 111 | ---> There is some text missing from this line. |
| 112 | |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 113 | 5. When you are comfortable inserting text move to lesson 1.1.5. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 114 | |
| 115 | |
| 116 | |
| 117 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 118 | Lesson 1.1.5: TEXT EDITING - APPENDING |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 119 | |
| 120 | |
| 121 | ** Press A to append text. ** |
| 122 | |
| 123 | 1. Move the cursor to the first line below marked --->. |
| 124 | It does not matter on what character the cursor is in that line. |
| 125 | |
| 126 | 2. Press A and type in the necessary additions. |
| 127 | |
| 128 | 3. As the text has been appended press <ESC> to return to Normal mode. |
| 129 | |
Bram Moolenaar | 6dc819b | 2018-07-03 16:42:19 +0200 | [diff] [blame] | 130 | 4. Move the cursor to the second line marked ---> and repeat |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 131 | steps 2 and 3 to correct this sentence. |
| 132 | |
| 133 | ---> There is some text missing from th |
| 134 | There is some text missing from this line. |
| 135 | ---> There is also some text miss |
| 136 | There is also some text missing here. |
| 137 | |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 138 | 5. When you are comfortable appending text move to lesson 1.1.6. |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 139 | |
| 140 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 141 | Lesson 1.1.6: EDITING A FILE |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 142 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 143 | ** Use :wq to save a file and exit. ** |
| 144 | |
| 145 | !! NOTE: Before executing any of the steps below, read this entire lesson!! |
| 146 | |
Bram Moolenaar | 89a9c15 | 2021-08-29 21:55:35 +0200 | [diff] [blame] | 147 | 1. If you have access to another terminal, do the following there. |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 148 | Otherwise, exit this tutor as you did in lesson 1.1.2: :q! |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 149 | |
Bram Moolenaar | 89a9c15 | 2021-08-29 21:55:35 +0200 | [diff] [blame] | 150 | 2. At the shell prompt type this command: vim file.txt <ENTER> |
| 151 | 'vim' is the command to start the Vim editor, 'file.txt' is the name of |
| 152 | the file you wish to edit. Use the name of a file that you can change. |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 153 | |
| 154 | 3. Insert and delete text as you learned in the previous lessons. |
| 155 | |
Bram Moolenaar | 6dc819b | 2018-07-03 16:42:19 +0200 | [diff] [blame] | 156 | 4. Save the file with changes and exit Vim with: :wq <ENTER> |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 157 | |
Bram Moolenaar | c1a11ed | 2008-06-24 22:09:24 +0000 | [diff] [blame] | 158 | 5. If you have quit vimtutor in step 1 restart the vimtutor and move down to |
| 159 | the following summary. |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 160 | |
| 161 | 6. After reading the above steps and understanding them: do it. |
Bram Moolenaar | 6dc819b | 2018-07-03 16:42:19 +0200 | [diff] [blame] | 162 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 163 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 164 | Lesson 1.1 SUMMARY |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 165 | |
| 166 | |
| 167 | 1. The cursor is moved using either the arrow keys or the hjkl keys. |
| 168 | h (left) j (down) k (up) l (right) |
| 169 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 170 | 2. To start Vim from the shell prompt type: vim FILENAME <ENTER> |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 171 | |
| 172 | 3. To exit Vim type: <ESC> :q! <ENTER> to trash all changes. |
| 173 | OR type: <ESC> :wq <ENTER> to save the changes. |
| 174 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 175 | 4. To delete the character at the cursor type: x |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 176 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 177 | 5. To insert or append text type: |
| 178 | i type inserted text <ESC> insert before the cursor |
| 179 | A type appended text <ESC> append after the line |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 180 | |
| 181 | NOTE: Pressing <ESC> will place you in Normal mode or will cancel |
| 182 | an unwanted and partially completed command. |
| 183 | |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 184 | Now continue with lesson 1.2. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 185 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 186 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 187 | Lesson 1.2.1: DELETION COMMANDS |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 188 | |
| 189 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 190 | ** Type dw to delete a word. ** |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 191 | |
| 192 | 1. Press <ESC> to make sure you are in Normal mode. |
| 193 | |
| 194 | 2. Move the cursor to the line below marked --->. |
| 195 | |
| 196 | 3. Move the cursor to the beginning of a word that needs to be deleted. |
| 197 | |
| 198 | 4. Type dw to make the word disappear. |
| 199 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 200 | NOTE: The letter d will appear on the last line of the screen as you type |
| 201 | it. Vim is waiting for you to type w . If you see another character |
| 202 | than d you typed something wrong; press <ESC> and start over. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 203 | |
| 204 | ---> There are a some words fun that don't belong paper in this sentence. |
| 205 | |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 206 | 5. Repeat steps 3 and 4 until the sentence is correct and go to lesson 1.2.2. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 207 | |
| 208 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 209 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 210 | Lesson 1.2.2: MORE DELETION COMMANDS |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 211 | |
| 212 | |
| 213 | ** Type d$ to delete to the end of the line. ** |
| 214 | |
| 215 | 1. Press <ESC> to make sure you are in Normal mode. |
| 216 | |
| 217 | 2. Move the cursor to the line below marked --->. |
| 218 | |
| 219 | 3. Move the cursor to the end of the correct line (AFTER the first . ). |
| 220 | |
| 221 | 4. Type d$ to delete to the end of the line. |
| 222 | |
| 223 | ---> Somebody typed the end of this line twice. end of this line twice. |
| 224 | |
| 225 | |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 226 | 5. Move on to lesson 1.2.3 to understand what is happening. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 227 | |
| 228 | |
| 229 | |
| 230 | |
| 231 | |
| 232 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 233 | Lesson 1.2.3: ON OPERATORS AND MOTIONS |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 234 | |
| 235 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 236 | Many commands that change text are made from an operator and a motion. |
| 237 | The format for a delete command with the d delete operator is as follows: |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 238 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 239 | d motion |
| 240 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 241 | Where: |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 242 | d - is the delete operator. |
| 243 | motion - is what the operator will operate on (listed below). |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 244 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 245 | A short list of motions: |
| 246 | w - until the start of the next word, EXCLUDING its first character. |
| 247 | e - to the end of the current word, INCLUDING the last character. |
| 248 | $ - to the end of the line, INCLUDING the last character. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 249 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 250 | Thus typing de will delete from the cursor to the end of the word. |
| 251 | |
| 252 | NOTE: Pressing just the motion while in Normal mode without an operator will |
| 253 | move the cursor as specified. |
| 254 | |
| 255 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 256 | Lesson 1.2.4: USING A COUNT FOR A MOTION |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 257 | |
| 258 | |
| 259 | ** Typing a number before a motion repeats it that many times. ** |
| 260 | |
Bram Moolenaar | 6dc819b | 2018-07-03 16:42:19 +0200 | [diff] [blame] | 261 | 1. Move the cursor to the start of the line below marked --->. |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 262 | |
| 263 | 2. Type 2w to move the cursor two words forward. |
| 264 | |
| 265 | 3. Type 3e to move the cursor to the end of the third word forward. |
| 266 | |
| 267 | 4. Type 0 (zero) to move to the start of the line. |
| 268 | |
| 269 | 5. Repeat steps 2 and 3 with different numbers. |
| 270 | |
| 271 | ---> This is just a line with words you can move around in. |
| 272 | |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 273 | 6. Move on to lesson 1.2.5. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 274 | |
| 275 | |
| 276 | |
| 277 | |
| 278 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 279 | Lesson 1.2.5: USING A COUNT TO DELETE MORE |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 280 | |
| 281 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 282 | ** Typing a number with an operator repeats it that many times. ** |
| 283 | |
| 284 | In the combination of the delete operator and a motion mentioned above you |
| 285 | insert a count before the motion to delete more: |
| 286 | d number motion |
| 287 | |
| 288 | 1. Move the cursor to the first UPPER CASE word in the line marked --->. |
| 289 | |
Bram Moolenaar | 6dc819b | 2018-07-03 16:42:19 +0200 | [diff] [blame] | 290 | 2. Type d2w to delete the two UPPER CASE words. |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 291 | |
| 292 | 3. Repeat steps 1 and 2 with a different count to delete the consecutive |
Bram Moolenaar | 6dc819b | 2018-07-03 16:42:19 +0200 | [diff] [blame] | 293 | UPPER CASE words with one command. |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 294 | |
| 295 | ---> this ABC DE line FGHI JK LMN OP of words is Q RS TUV cleaned up. |
| 296 | |
Bram Moolenaar | 756ec0f | 2007-05-05 17:59:48 +0000 | [diff] [blame] | 297 | |
| 298 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 299 | |
| 300 | |
| 301 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 302 | Lesson 1.2.6: OPERATING ON LINES |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 303 | |
| 304 | |
| 305 | ** Type dd to delete a whole line. ** |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 306 | |
| 307 | Due to the frequency of whole line deletion, the designers of Vi decided |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 308 | it would be easier to simply type two d's to delete a line. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 309 | |
| 310 | 1. Move the cursor to the second line in the phrase below. |
| 311 | 2. Type dd to delete the line. |
| 312 | 3. Now move to the fourth line. |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 313 | 4. Type 2dd to delete two lines. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 314 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 315 | ---> 1) Roses are red, |
| 316 | ---> 2) Mud is fun, |
| 317 | ---> 3) Violets are blue, |
| 318 | ---> 4) I have a car, |
| 319 | ---> 5) Clocks tell time, |
| 320 | ---> 6) Sugar is sweet |
| 321 | ---> 7) And so are you. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 322 | |
Bram Moolenaar | 4466ad6 | 2020-11-21 13:16:30 +0100 | [diff] [blame] | 323 | Doubling to operate on a line also works for operators mentioned below. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 324 | |
| 325 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 326 | Lesson 1.2.7: THE UNDO COMMAND |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 327 | |
| 328 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 329 | ** Press u to undo the last commands, U to fix a whole line. ** |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 330 | |
| 331 | 1. Move the cursor to the line below marked ---> and place it on the |
| 332 | first error. |
| 333 | 2. Type x to delete the first unwanted character. |
| 334 | 3. Now type u to undo the last command executed. |
| 335 | 4. This time fix all the errors on the line using the x command. |
| 336 | 5. Now type a capital U to return the line to its original state. |
| 337 | 6. Now type u a few times to undo the U and preceding commands. |
| 338 | 7. Now type CTRL-R (keeping CTRL key pressed while hitting R) a few times |
Bram Moolenaar | be4e016 | 2023-02-02 13:59:48 +0000 | [diff] [blame] | 339 | to redo the commands (undo the undos). |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 340 | |
| 341 | ---> Fiix the errors oon thhis line and reeplace them witth undo. |
| 342 | |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 343 | 8. These are very useful commands. Now move on to the lesson 1.2 Summary. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 344 | |
| 345 | |
| 346 | |
| 347 | |
| 348 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 349 | Lesson 1.2 SUMMARY |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 350 | |
Bram Moolenaar | 34cc7d8 | 2021-09-21 20:09:51 +0200 | [diff] [blame] | 351 | 1. To delete from the cursor up to the next word type: dw |
| 352 | 2. To delete from the cursor up to the end of the word type: de |
| 353 | 3. To delete from the cursor to the end of a line type: d$ |
| 354 | 4. To delete a whole line type: dd |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 355 | |
Bram Moolenaar | 34cc7d8 | 2021-09-21 20:09:51 +0200 | [diff] [blame] | 356 | 5. To repeat a motion prepend it with a number: 2w |
| 357 | 6. The format for a change command is: |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 358 | operator [number] motion |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 359 | where: |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 360 | operator - is what to do, such as d for delete |
| 361 | [number] - is an optional count to repeat the motion |
Bram Moolenaar | 756ec0f | 2007-05-05 17:59:48 +0000 | [diff] [blame] | 362 | motion - moves over the text to operate on, such as w (word), |
Bram Moolenaar | 34cc7d8 | 2021-09-21 20:09:51 +0200 | [diff] [blame] | 363 | e (end of word), $ (end of the line), etc. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 364 | |
Bram Moolenaar | 34cc7d8 | 2021-09-21 20:09:51 +0200 | [diff] [blame] | 365 | 7. To move to the start of the line use a zero: 0 |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 366 | |
Bram Moolenaar | 34cc7d8 | 2021-09-21 20:09:51 +0200 | [diff] [blame] | 367 | 8. To undo previous actions, type: u (lowercase u) |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 368 | To undo all the changes on a line, type: U (capital U) |
Bram Moolenaar | be4e016 | 2023-02-02 13:59:48 +0000 | [diff] [blame] | 369 | To undo the undos, type: CTRL-R |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 370 | |
| 371 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 372 | Lesson 1.3.1: THE PUT COMMAND |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 373 | |
| 374 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 375 | ** Type p to put previously deleted text after the cursor. ** |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 376 | |
Bram Moolenaar | b477af2 | 2018-07-15 20:20:18 +0200 | [diff] [blame] | 377 | 1. Move the cursor to the first line below marked --->. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 378 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 379 | 2. Type dd to delete the line and store it in a Vim register. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 380 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 381 | 3. Move the cursor to the c) line, ABOVE where the deleted line should go. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 382 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 383 | 4. Type p to put the line below the cursor. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 384 | |
| 385 | 5. Repeat steps 2 through 4 to put all the lines in correct order. |
| 386 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 387 | ---> d) Can you learn too? |
| 388 | ---> b) Violets are blue, |
| 389 | ---> c) Intelligence is learned, |
| 390 | ---> a) Roses are red, |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 391 | |
| 392 | |
| 393 | |
| 394 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 395 | Lesson 1.3.2: THE REPLACE COMMAND |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 396 | |
| 397 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 398 | ** Type rx to replace the character at the cursor with x . ** |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 399 | |
| 400 | 1. Move the cursor to the first line below marked --->. |
| 401 | |
| 402 | 2. Move the cursor so that it is on top of the first error. |
| 403 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 404 | 3. Type r and then the character which should be there. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 405 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 406 | 4. Repeat steps 2 and 3 until the first line is equal to the second one. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 407 | |
| 408 | ---> Whan this lime was tuoed in, someone presswd some wrojg keys! |
| 409 | ---> When this line was typed in, someone pressed some wrong keys! |
| 410 | |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 411 | 5. Now move on to lesson 1.3.3. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 412 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 413 | NOTE: Remember that you should be learning by doing, not memorization. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 414 | |
| 415 | |
| 416 | |
| 417 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 418 | Lesson 1.3.3: THE CHANGE OPERATOR |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 419 | |
| 420 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 421 | ** To change until the end of a word, type ce . ** |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 422 | |
| 423 | 1. Move the cursor to the first line below marked --->. |
| 424 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 425 | 2. Place the cursor on the u in lubw. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 426 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 427 | 3. Type ce and the correct word (in this case, type ine ). |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 428 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 429 | 4. Press <ESC> and move to the next character that needs to be changed. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 430 | |
| 431 | 5. Repeat steps 3 and 4 until the first sentence is the same as the second. |
| 432 | |
Bram Moolenaar | 756ec0f | 2007-05-05 17:59:48 +0000 | [diff] [blame] | 433 | ---> This lubw has a few wptfd that mrrf changing usf the change operator. |
| 434 | ---> This line has a few words that need changing using the change operator. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 435 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 436 | Notice that ce deletes the word and places you in Insert mode. |
Bram Moolenaar | 4466ad6 | 2020-11-21 13:16:30 +0100 | [diff] [blame] | 437 | cc does the same for the whole line. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 438 | |
| 439 | |
| 440 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 441 | Lesson 1.3.4: MORE CHANGES USING c |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 442 | |
| 443 | |
Bram Moolenaar | 756ec0f | 2007-05-05 17:59:48 +0000 | [diff] [blame] | 444 | ** The change operator is used with the same motions as delete. ** |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 445 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 446 | 1. The change operator works in the same way as delete. The format is: |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 447 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 448 | c [number] motion |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 449 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 450 | 2. The motions are the same, such as w (word) and $ (end of line). |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 451 | |
Bram Moolenaar | b477af2 | 2018-07-15 20:20:18 +0200 | [diff] [blame] | 452 | 3. Move the cursor to the first line below marked --->. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 453 | |
| 454 | 4. Move the cursor to the first error. |
| 455 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 456 | 5. Type c$ and type the rest of the line like the second and press <ESC>. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 457 | |
| 458 | ---> The end of this line needs some help to make it like the second. |
| 459 | ---> The end of this line needs to be corrected using the c$ command. |
| 460 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 461 | NOTE: You can use the Backspace key to correct mistakes while typing. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 462 | |
| 463 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 464 | Lesson 1.3 SUMMARY |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 465 | |
| 466 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 467 | 1. To put back text that has just been deleted, type p . This puts the |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 468 | deleted text AFTER the cursor (if a line was deleted it will go on the |
| 469 | line below the cursor). |
| 470 | |
| 471 | 2. To replace the character under the cursor, type r and then the |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 472 | character you want to have there. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 473 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 474 | 3. The change operator allows you to change from the cursor to where the |
| 475 | motion takes you. eg. Type ce to change from the cursor to the end of |
| 476 | the word, c$ to change to the end of a line. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 477 | |
| 478 | 4. The format for change is: |
| 479 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 480 | c [number] motion |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 481 | |
| 482 | Now go on to the next lesson. |
| 483 | |
| 484 | |
| 485 | |
| 486 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 487 | Lesson 1.4.1: CURSOR LOCATION AND FILE STATUS |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 488 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 489 | ** Type CTRL-G to show your location in the file and the file status. |
| 490 | Type G to move to a line in the file. ** |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 491 | |
Bram Moolenaar | 756ec0f | 2007-05-05 17:59:48 +0000 | [diff] [blame] | 492 | NOTE: Read this entire lesson before executing any of the steps!! |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 493 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 494 | 1. Hold down the Ctrl key and press g . We call this CTRL-G. |
| 495 | A message will appear at the bottom of the page with the filename and the |
| 496 | position in the file. Remember the line number for Step 3. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 497 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 498 | NOTE: You may see the cursor position in the lower right corner of the screen |
Bram Moolenaar | 756ec0f | 2007-05-05 17:59:48 +0000 | [diff] [blame] | 499 | This happens when the 'ruler' option is set (see :help 'ruler' ) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 500 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 501 | 2. Press G to move you to the bottom of the file. |
| 502 | Type gg to move you to the start of the file. |
| 503 | |
| 504 | 3. Type the number of the line you were on and then G . This will |
| 505 | return you to the line you were on when you first pressed CTRL-G. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 506 | |
| 507 | 4. If you feel confident to do this, execute steps 1 through 3. |
| 508 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 509 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 510 | Lesson 1.4.2: THE SEARCH COMMAND |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 511 | |
| 512 | |
| 513 | ** Type / followed by a phrase to search for the phrase. ** |
| 514 | |
| 515 | 1. In Normal mode type the / character. Notice that it and the cursor |
| 516 | appear at the bottom of the screen as with the : command. |
| 517 | |
| 518 | 2. Now type 'errroor' <ENTER>. This is the word you want to search for. |
| 519 | |
| 520 | 3. To search for the same phrase again, simply type n . |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 521 | To search for the same phrase in the opposite direction, type N . |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 522 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 523 | 4. To search for a phrase in the backward direction, use ? instead of / . |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 524 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 525 | 5. To go back to where you came from press CTRL-O (Keep Ctrl down while |
| 526 | pressing the letter o). Repeat to go back further. CTRL-I goes forward. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 527 | |
Bram Moolenaar | 756ec0f | 2007-05-05 17:59:48 +0000 | [diff] [blame] | 528 | ---> "errroor" is not the way to spell error; errroor is an error. |
| 529 | NOTE: When the search reaches the end of the file it will continue at the |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 530 | start, unless the 'wrapscan' option has been reset. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 531 | |
| 532 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 533 | Lesson 1.4.3: MATCHING PARENTHESES SEARCH |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 534 | |
| 535 | |
| 536 | ** Type % to find a matching ),], or } . ** |
| 537 | |
| 538 | 1. Place the cursor on any (, [, or { in the line below marked --->. |
| 539 | |
| 540 | 2. Now type the % character. |
| 541 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 542 | 3. The cursor will move to the matching parenthesis or bracket. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 543 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 544 | 4. Type % to move the cursor to the other matching bracket. |
| 545 | |
| 546 | 5. Move the cursor to another (,),[,],{ or } and see what % does. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 547 | |
| 548 | ---> This ( is a test line with ('s, ['s ] and {'s } in it. )) |
| 549 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 550 | |
Bram Moolenaar | 756ec0f | 2007-05-05 17:59:48 +0000 | [diff] [blame] | 551 | NOTE: This is very useful in debugging a program with unmatched parentheses! |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 552 | |
| 553 | |
| 554 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 555 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 556 | Lesson 1.4.4: THE SUBSTITUTE COMMAND |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 557 | |
| 558 | |
| 559 | ** Type :s/old/new/g to substitute 'new' for 'old'. ** |
| 560 | |
| 561 | 1. Move the cursor to the line below marked --->. |
| 562 | |
Bram Moolenaar | 6dc819b | 2018-07-03 16:42:19 +0200 | [diff] [blame] | 563 | 2. Type :s/thee/the <ENTER> . Note that this command only changes the |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 564 | first occurrence of "thee" in the line. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 565 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 566 | 3. Now type :s/thee/the/g . Adding the g flag means to substitute |
| 567 | globally in the line, change all occurrences of "thee" in the line. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 568 | |
| 569 | ---> thee best time to see thee flowers is in thee spring. |
| 570 | |
| 571 | 4. To change every occurrence of a character string between two lines, |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 572 | type :#,#s/old/new/g where #,# are the line numbers of the range |
Bram Moolenaar | 756ec0f | 2007-05-05 17:59:48 +0000 | [diff] [blame] | 573 | of lines where the substitution is to be done. |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 574 | Type :%s/old/new/g to change every occurrence in the whole file. |
| 575 | Type :%s/old/new/gc to find every occurrence in the whole file, |
Bram Moolenaar | 756ec0f | 2007-05-05 17:59:48 +0000 | [diff] [blame] | 576 | with a prompt whether to substitute or not. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 577 | |
| 578 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 579 | Lesson 1.4 SUMMARY |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 580 | |
| 581 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 582 | 1. CTRL-G displays your location in the file and the file status. |
| 583 | G moves to the end of the file. |
| 584 | number G moves to that line number. |
| 585 | gg moves to the first line. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 586 | |
| 587 | 2. Typing / followed by a phrase searches FORWARD for the phrase. |
| 588 | Typing ? followed by a phrase searches BACKWARD for the phrase. |
| 589 | After a search type n to find the next occurrence in the same direction |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 590 | or N to search in the opposite direction. |
| 591 | CTRL-O takes you back to older positions, CTRL-I to newer positions. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 592 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 593 | 3. Typing % while the cursor is on a (,),[,],{, or } goes to its match. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 594 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 595 | 4. To substitute new for the first old in a line type :s/old/new |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 596 | To substitute new for all 'old's on a line type :s/old/new/g |
| 597 | To substitute phrases between two line #'s type :#,#s/old/new/g |
| 598 | To substitute all occurrences in the file type :%s/old/new/g |
| 599 | To ask for confirmation each time add 'c' :%s/old/new/gc |
| 600 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 601 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 602 | Lesson 1.5.1: HOW TO EXECUTE AN EXTERNAL COMMAND |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 603 | |
| 604 | |
| 605 | ** Type :! followed by an external command to execute that command. ** |
| 606 | |
| 607 | 1. Type the familiar command : to set the cursor at the bottom of the |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 608 | screen. This allows you to enter a command-line command. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 609 | |
| 610 | 2. Now type the ! (exclamation point) character. This allows you to |
| 611 | execute any external shell command. |
| 612 | |
| 613 | 3. As an example type ls following the ! and then hit <ENTER>. This |
| 614 | will show you a listing of your directory, just as if you were at the |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 615 | shell prompt. Or use :!dir if ls doesn't work. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 616 | |
Bram Moolenaar | 756ec0f | 2007-05-05 17:59:48 +0000 | [diff] [blame] | 617 | NOTE: It is possible to execute any external command this way, also with |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 618 | arguments. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 619 | |
Bram Moolenaar | 756ec0f | 2007-05-05 17:59:48 +0000 | [diff] [blame] | 620 | NOTE: All : commands must be finished by hitting <ENTER> |
| 621 | From here on we will not always mention it. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 622 | |
| 623 | |
| 624 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 625 | Lesson 1.5.2: MORE ON WRITING FILES |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 626 | |
| 627 | |
Bram Moolenaar | 6dc819b | 2018-07-03 16:42:19 +0200 | [diff] [blame] | 628 | ** To save the changes made to the text, type :w FILENAME ** |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 629 | |
| 630 | 1. Type :!dir or :!ls to get a listing of your directory. |
| 631 | You already know you must hit <ENTER> after this. |
| 632 | |
| 633 | 2. Choose a filename that does not exist yet, such as TEST. |
| 634 | |
| 635 | 3. Now type: :w TEST (where TEST is the filename you chose.) |
| 636 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 637 | 4. This saves the whole file (the Vim Tutor) under the name TEST. |
| 638 | To verify this, type :!dir or :!ls again to see your directory. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 639 | |
Bram Moolenaar | 756ec0f | 2007-05-05 17:59:48 +0000 | [diff] [blame] | 640 | NOTE: If you were to exit Vim and start it again with vim TEST , the file |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 641 | would be an exact copy of the tutor when you saved it. |
| 642 | |
Bram Moolenaar | 6dc819b | 2018-07-03 16:42:19 +0200 | [diff] [blame] | 643 | 5. Now remove the file by typing (Windows): :!del TEST |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 644 | or (Unix): :!rm TEST |
| 645 | |
| 646 | |
| 647 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 648 | Lesson 1.5.3: SELECTING TEXT TO WRITE |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 649 | |
| 650 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 651 | ** To save part of the file, type v motion :w FILENAME ** |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 652 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 653 | 1. Move the cursor to this line. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 654 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 655 | 2. Press v and move the cursor to the fifth item below. Notice that the |
| 656 | text is highlighted. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 657 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 658 | 3. Press the : character. At the bottom of the screen :'<,'> will appear. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 659 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 660 | 4. Type w TEST , where TEST is a filename that does not exist yet. Verify |
Bram Moolenaar | 59c0395 | 2010-07-28 12:52:27 +0200 | [diff] [blame] | 661 | that you see :'<,'>w TEST before you press <ENTER>. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 662 | |
Bram Moolenaar | 97cc238 | 2012-10-03 21:46:54 +0200 | [diff] [blame] | 663 | 5. Vim will write the selected lines to the file TEST. Use :!dir or :!ls |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 664 | to see it. Do not remove it yet! We will use it in the next lesson. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 665 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 666 | NOTE: Pressing v starts Visual selection. You can move the cursor around |
| 667 | to make the selection bigger or smaller. Then you can use an operator |
| 668 | to do something with the text. For example, d deletes the text. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 669 | |
| 670 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 671 | Lesson 1.5.4: RETRIEVING AND MERGING FILES |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 672 | |
| 673 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 674 | ** To insert the contents of a file, type :r FILENAME ** |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 675 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 676 | 1. Place the cursor just above this line. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 677 | |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 678 | NOTE: After executing Step 2 you will see text from lesson 1.5.3. Then move |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 679 | DOWN to see this lesson again. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 680 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 681 | 2. Now retrieve your TEST file using the command :r TEST where TEST is |
| 682 | the name of the file you used. |
| 683 | The file you retrieve is placed below the cursor line. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 684 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 685 | 3. To verify that a file was retrieved, cursor back and notice that there |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 686 | are now two copies of lesson 1.5.3, the original and the file version. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 687 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 688 | NOTE: You can also read the output of an external command. For example, |
| 689 | :r !ls reads the output of the ls command and puts it below the |
| 690 | cursor. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 691 | |
| 692 | |
| 693 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 694 | Lesson 1.5 SUMMARY |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 695 | |
| 696 | |
| 697 | 1. :!command executes an external command. |
| 698 | |
| 699 | Some useful examples are: |
Bram Moolenaar | 6dc819b | 2018-07-03 16:42:19 +0200 | [diff] [blame] | 700 | (Windows) (Unix) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 701 | :!dir :!ls - shows a directory listing. |
| 702 | :!del FILENAME :!rm FILENAME - removes file FILENAME. |
| 703 | |
| 704 | 2. :w FILENAME writes the current Vim file to disk with name FILENAME. |
| 705 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 706 | 3. v motion :w FILENAME saves the Visually selected lines in file |
| 707 | FILENAME. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 708 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 709 | 4. :r FILENAME retrieves disk file FILENAME and puts it below the |
| 710 | cursor position. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 711 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 712 | 5. :r !dir reads the output of the dir command and puts it below the |
Bram Moolenaar | 756ec0f | 2007-05-05 17:59:48 +0000 | [diff] [blame] | 713 | cursor position. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 714 | |
| 715 | |
| 716 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 717 | Lesson 1.6.1: THE OPEN COMMAND |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 718 | |
| 719 | |
| 720 | ** Type o to open a line below the cursor and place you in Insert mode. ** |
| 721 | |
Bram Moolenaar | 6dc819b | 2018-07-03 16:42:19 +0200 | [diff] [blame] | 722 | 1. Move the cursor to the first line below marked --->. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 723 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 724 | 2. Type the lowercase letter o to open up a line BELOW the cursor and place |
| 725 | you in Insert mode. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 726 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 727 | 3. Now type some text and press <ESC> to exit Insert mode. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 728 | |
| 729 | ---> After typing o the cursor is placed on the open line in Insert mode. |
| 730 | |
| 731 | 4. To open up a line ABOVE the cursor, simply type a capital O , rather |
| 732 | than a lowercase o. Try this on the line below. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 733 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 734 | ---> Open up a line above this by typing O while the cursor is on this line. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 735 | |
| 736 | |
| 737 | |
| 738 | |
| 739 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 740 | Lesson 1.6.2: THE APPEND COMMAND |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 741 | |
| 742 | |
| 743 | ** Type a to insert text AFTER the cursor. ** |
| 744 | |
Bram Moolenaar | b477af2 | 2018-07-15 20:20:18 +0200 | [diff] [blame] | 745 | 1. Move the cursor to the start of the first line below marked --->. |
Bram Moolenaar | 6dc819b | 2018-07-03 16:42:19 +0200 | [diff] [blame] | 746 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 747 | 2. Press e until the cursor is on the end of li . |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 748 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 749 | 3. Type an a (lowercase) to append text AFTER the cursor. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 750 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 751 | 4. Complete the word like the line below it. Press <ESC> to exit Insert |
| 752 | mode. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 753 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 754 | 5. Use e to move to the next incomplete word and repeat steps 3 and 4. |
Bram Moolenaar | 6dc819b | 2018-07-03 16:42:19 +0200 | [diff] [blame] | 755 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 756 | ---> This li will allow you to pract appendi text to a line. |
| 757 | ---> This line will allow you to practice appending text to a line. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 758 | |
Bram Moolenaar | 756ec0f | 2007-05-05 17:59:48 +0000 | [diff] [blame] | 759 | NOTE: a, i and A all go to the same Insert mode, the only difference is where |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 760 | the characters are inserted. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 761 | |
| 762 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 763 | Lesson 1.6.3: ANOTHER WAY TO REPLACE |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 764 | |
| 765 | |
| 766 | ** Type a capital R to replace more than one character. ** |
| 767 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 768 | 1. Move the cursor to the first line below marked --->. Move the cursor to |
| 769 | the beginning of the first xxx . |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 770 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 771 | 2. Now press R and type the number below it in the second line, so that it |
| 772 | replaces the xxx . |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 773 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 774 | 3. Press <ESC> to leave Replace mode. Notice that the rest of the line |
| 775 | remains unmodified. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 776 | |
Bram Moolenaar | 756ec0f | 2007-05-05 17:59:48 +0000 | [diff] [blame] | 777 | 4. Repeat the steps to replace the remaining xxx. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 778 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 779 | ---> Adding 123 to xxx gives you xxx. |
| 780 | ---> Adding 123 to 456 gives you 579. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 781 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 782 | NOTE: Replace mode is like Insert mode, but every typed character deletes an |
| 783 | existing character. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 784 | |
| 785 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 786 | Lesson 1.6.4: COPY AND PASTE TEXT |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 787 | |
| 788 | |
Bram Moolenaar | 756ec0f | 2007-05-05 17:59:48 +0000 | [diff] [blame] | 789 | ** Use the y operator to copy text and p to paste it ** |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 790 | |
Bram Moolenaar | 6dc819b | 2018-07-03 16:42:19 +0200 | [diff] [blame] | 791 | 1. Move to the line below marked ---> and place the cursor after "a)". |
| 792 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 793 | 2. Start Visual mode with v and move the cursor to just before "first". |
Bram Moolenaar | 6dc819b | 2018-07-03 16:42:19 +0200 | [diff] [blame] | 794 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 795 | 3. Type y to yank (copy) the highlighted text. |
| 796 | |
| 797 | 4. Move the cursor to the end of the next line: j$ |
| 798 | |
| 799 | 5. Type p to put (paste) the text. Then type: a second <ESC> . |
| 800 | |
| 801 | 6. Use Visual mode to select " item.", yank it with y , move to the end of |
| 802 | the next line with j$ and put the text there with p . |
| 803 | |
| 804 | ---> a) this is the first item. |
| 805 | b) |
| 806 | |
Bram Moolenaar | 1c6737b | 2020-09-07 22:18:52 +0200 | [diff] [blame] | 807 | NOTE: You can also use y as an operator: yw yanks one word, |
Bram Moolenaar | 4466ad6 | 2020-11-21 13:16:30 +0100 | [diff] [blame] | 808 | yy yanks the whole line, then p puts that line. |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 809 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 810 | Lesson 1.6.5: SET OPTION |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 811 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 812 | |
| 813 | ** Set an option so a search or substitute ignores case ** |
| 814 | |
Bram Moolenaar | 6dc819b | 2018-07-03 16:42:19 +0200 | [diff] [blame] | 815 | 1. Search for 'ignore' by entering: /ignore <ENTER> |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 816 | Repeat several times by pressing n . |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 817 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 818 | 2. Set the 'ic' (Ignore case) option by entering: :set ic |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 819 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 820 | 3. Now search for 'ignore' again by pressing n |
| 821 | Notice that Ignore and IGNORE are now also found. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 822 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 823 | 4. Set the 'hlsearch' and 'incsearch' options: :set hls is |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 824 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 825 | 5. Now type the search command again and see what happens: /ignore <ENTER> |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 826 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 827 | 6. To disable ignoring case enter: :set noic |
| 828 | |
Bram Moolenaar | 6dc819b | 2018-07-03 16:42:19 +0200 | [diff] [blame] | 829 | NOTE: To remove the highlighting of matches enter: :nohlsearch |
Bram Moolenaar | 756ec0f | 2007-05-05 17:59:48 +0000 | [diff] [blame] | 830 | NOTE: If you want to ignore case for just one search command, use \c |
Bram Moolenaar | 6dc819b | 2018-07-03 16:42:19 +0200 | [diff] [blame] | 831 | in the phrase: /ignore\c <ENTER> |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 832 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 833 | Lesson 1.6 SUMMARY |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 834 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 835 | 1. Type o to open a line BELOW the cursor and start Insert mode. |
| 836 | Type O to open a line ABOVE the cursor. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 837 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 838 | 2. Type a to insert text AFTER the cursor. |
| 839 | Type A to insert text after the end of the line. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 840 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 841 | 3. The e command moves to the end of a word. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 842 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 843 | 4. The y operator yanks (copies) text, p puts (pastes) it. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 844 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 845 | 5. Typing a capital R enters Replace mode until <ESC> is pressed. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 846 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 847 | 6. Typing ":set xxx" sets the option "xxx". Some options are: |
| 848 | 'ic' 'ignorecase' ignore upper/lower case when searching |
| 849 | 'is' 'incsearch' show partial matches for a search phrase |
| 850 | 'hls' 'hlsearch' highlight all matching phrases |
| 851 | You can either use the long or the short option name. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 852 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 853 | 7. Prepend "no" to switch an option off: :set noic |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 854 | |
| 855 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 856 | Lesson 1.7.1: GETTING HELP |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 857 | |
| 858 | |
| 859 | ** Use the on-line help system ** |
| 860 | |
| 861 | Vim has a comprehensive on-line help system. To get started, try one of |
| 862 | these three: |
| 863 | - press the <HELP> key (if you have one) |
| 864 | - press the <F1> key (if you have one) |
| 865 | - type :help <ENTER> |
| 866 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 867 | Read the text in the help window to find out how the help works. |
Bram Moolenaar | 756ec0f | 2007-05-05 17:59:48 +0000 | [diff] [blame] | 868 | Type CTRL-W CTRL-W to jump from one window to another. |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 869 | Type :q <ENTER> to close the help window. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 870 | |
| 871 | You can find help on just about any subject, by giving an argument to the |
| 872 | ":help" command. Try these (don't forget pressing <ENTER>): |
| 873 | |
| 874 | :help w |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 875 | :help c_CTRL-D |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 876 | :help insert-index |
| 877 | :help user-manual |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 878 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 879 | Lesson 1.7.2: CREATE A STARTUP SCRIPT |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 880 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 881 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 882 | ** Enable Vim features ** |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 883 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 884 | Vim has many more features than Vi, but most of them are disabled by |
Bram Moolenaar | d2ea7cf | 2021-05-30 20:54:13 +0200 | [diff] [blame] | 885 | default. To start using more features you should create a "vimrc" file. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 886 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 887 | 1. Start editing the "vimrc" file. This depends on your system: |
| 888 | :e ~/.vimrc for Unix |
Bram Moolenaar | d2ea7cf | 2021-05-30 20:54:13 +0200 | [diff] [blame] | 889 | :e ~/_vimrc for Windows |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 890 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 891 | 2. Now read the example "vimrc" file contents: |
| 892 | :r $VIMRUNTIME/vimrc_example.vim |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 893 | |
| 894 | 3. Write the file with: |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 895 | :w |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 896 | |
| 897 | The next time you start Vim it will use syntax highlighting. |
| 898 | You can add all your preferred settings to this "vimrc" file. |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 899 | For more information type :help vimrc-intro |
| 900 | |
| 901 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 902 | Lesson 1.7.3: COMPLETION |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 903 | |
| 904 | |
| 905 | ** Command line completion with CTRL-D and <TAB> ** |
| 906 | |
| 907 | 1. Make sure Vim is not in compatible mode: :set nocp |
| 908 | |
| 909 | 2. Look what files exist in the directory: :!ls or :!dir |
| 910 | |
| 911 | 3. Type the start of a command: :e |
| 912 | |
| 913 | 4. Press CTRL-D and Vim will show a list of commands that start with "e". |
| 914 | |
Bram Moolenaar | 6dc819b | 2018-07-03 16:42:19 +0200 | [diff] [blame] | 915 | 5. Type d<TAB> and Vim will complete the command name to ":edit". |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 916 | |
| 917 | 6. Now add a space and the start of an existing file name: :edit FIL |
| 918 | |
| 919 | 7. Press <TAB>. Vim will complete the name (if it is unique). |
| 920 | |
| 921 | NOTE: Completion works for many commands. Just try pressing CTRL-D and |
| 922 | <TAB>. It is especially useful for :help . |
| 923 | |
| 924 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
RestorerZ | 6fa304f | 2024-12-02 20:19:52 +0100 | [diff] [blame] | 925 | Lesson 1.7 SUMMARY |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 926 | |
| 927 | |
Bram Moolenaar | 6dc819b | 2018-07-03 16:42:19 +0200 | [diff] [blame] | 928 | 1. Type :help or press <F1> or <HELP> to open a help window. |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 929 | |
| 930 | 2. Type :help cmd to find help on cmd . |
| 931 | |
Bram Moolenaar | 6dc819b | 2018-07-03 16:42:19 +0200 | [diff] [blame] | 932 | 3. Type CTRL-W CTRL-W to jump to another window. |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 933 | |
Bram Moolenaar | 6dc819b | 2018-07-03 16:42:19 +0200 | [diff] [blame] | 934 | 4. Type :q to close the help window. |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 935 | |
| 936 | 5. Create a vimrc startup script to keep your preferred settings. |
| 937 | |
| 938 | 6. When typing a : command, press CTRL-D to see possible completions. |
| 939 | Press <TAB> to use one completion. |
| 940 | |
| 941 | |
| 942 | |
| 943 | |
| 944 | |
| 945 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 946 | |
| 947 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 948 | |
Paul Desmond Parker | 17c71da | 2024-11-03 20:47:53 +0100 | [diff] [blame] | 949 | This concludes Chapter 1 of the Vim Tutor. Consider continuing with Chapter 2. |
| 950 | |
| 951 | It was intended to give a brief overview of the Vim editor, just enough to |
| 952 | allow you to use the editor fairly easily. It is far from complete as Vim |
| 953 | has many many more commands. |
| 954 | |
| 955 | Read the user manual next: ":help user-manual". |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 956 | |
| 957 | For further reading and studying, this book is recommended: |
| 958 | Vim - Vi Improved - by Steve Oualline |
| 959 | Publisher: New Riders |
| 960 | The first book completely dedicated to Vim. Especially useful for beginners. |
| 961 | There are many examples and pictures. |
Bram Moolenaar | 9da17d7 | 2022-02-09 21:50:44 +0000 | [diff] [blame] | 962 | See https://iccf-holland.org/click5.html |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 963 | |
| 964 | This book is older and more about Vi than Vim, but also recommended: |
| 965 | Learning the Vi Editor - by Linda Lamb |
| 966 | Publisher: O'Reilly & Associates Inc. |
| 967 | It is a good book to get to know almost anything you want to do with Vi. |
| 968 | The sixth edition also includes information on Vim. |
| 969 | |
| 970 | This tutorial was written by Michael C. Pierce and Robert K. Ware, |
| 971 | Colorado School of Mines using ideas supplied by Charles Smith, |
| 972 | Colorado State University. E-mail: bware@mines.colorado.edu. |
| 973 | |
| 974 | Modified for Vim by Bram Moolenaar. |
| 975 | |
| 976 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |