1 |
swift 08/05/19 19:57:20 |
2 |
|
3 |
Modified: vi-guide.xml |
4 |
Log: |
5 |
Coding style, trailing whitespace and double spaces |
6 |
|
7 |
Revision Changes Path |
8 |
1.15 xml/htdocs/doc/en/vi-guide.xml |
9 |
|
10 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/doc/en/vi-guide.xml?rev=1.15&view=markup |
11 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/doc/en/vi-guide.xml?rev=1.15&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/doc/en/vi-guide.xml?r1=1.14&r2=1.15 |
13 |
|
14 |
Index: vi-guide.xml |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo/xml/htdocs/doc/en/vi-guide.xml,v |
17 |
retrieving revision 1.14 |
18 |
retrieving revision 1.15 |
19 |
diff -u -r1.14 -r1.15 |
20 |
--- vi-guide.xml 21 Jul 2005 15:58:38 -0000 1.14 |
21 |
+++ vi-guide.xml 19 May 2008 19:57:20 -0000 1.15 |
22 |
@@ -1,5 +1,5 @@ |
23 |
<?xml version="1.0" encoding="UTF-8"?> |
24 |
-<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/vi-guide.xml,v 1.14 2005/07/21 15:58:38 neysx Exp $ --> |
25 |
+<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/vi-guide.xml,v 1.15 2008/05/19 19:57:20 swift Exp $ --> |
26 |
<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
27 |
|
28 |
<guide link="/doc/en/vi-guide.xml"> |
29 |
@@ -16,8 +16,8 @@ |
30 |
|
31 |
<abstract> |
32 |
This guide will teach you how to use vi, using a cheat sheet method to |
33 |
-accelerate the learning process. This will be the first guide for vi, |
34 |
-catering to beginners. |
35 |
+accelerate the learning process. This will be the first guide for vi, |
36 |
+catering to beginners. |
37 |
</abstract> |
38 |
|
39 |
<version>1.1.7</version> |
40 |
@@ -33,7 +33,7 @@ |
41 |
This tutorial will show you how to use vi, a powerful visual editor. |
42 |
Using a special accelerated <e>cheat sheet</e> method, this tutorial is |
43 |
designed to make you a proficient vi user without requiring a huge |
44 |
-time commitment. In this vi tutorial, you'll learn how to move |
45 |
+time commitment. In this vi tutorial, you'll learn how to move |
46 |
around, edit text, use insert mode, copy and paste text, and use |
47 |
important vim extensions like visual mode and multi-window editing. |
48 |
</p> |
49 |
@@ -52,20 +52,20 @@ |
50 |
|
51 |
<p> |
52 |
There's one thing in particular that makes it difficult to learn vi -- |
53 |
-vi has lots of commands. In order to use vi effectively, you need to |
54 |
-memorize quite a few. This can take a long time, and one of the goals |
55 |
-of this tutorial is not to take up a lot of your time. So, initially, |
56 |
+vi has lots of commands. In order to use vi effectively, you need to |
57 |
+memorize quite a few. This can take a long time, and one of the goals |
58 |
+of this tutorial is not to take up a lot of your time. So, initially, |
59 |
we have a challenge -- how exactly do I help you to memorize lots of |
60 |
commands in a short period of time? |
61 |
</p> |
62 |
|
63 |
<p> |
64 |
To tackle this challenge, as we proceed through this tutorial, we're |
65 |
-going to gradually put together a vi cheat sheet. This sheet will |
66 |
-contain all the important vi commands. After you've completed this |
67 |
+going to gradually put together a vi cheat sheet. This sheet will |
68 |
+contain all the important vi commands. After you've completed this |
69 |
tutorial, you'll be able to refer to this cheat sheet if you forget a |
70 |
-particular command. Over time, as you memorize commands, you'll |
71 |
-gradually become less and less dependent on the cheat sheet. By using |
72 |
+particular command. Over time, as you memorize commands, you'll |
73 |
+gradually become less and less dependent on the cheat sheet. By using |
74 |
the cheat-sheet technique, you'll be able to learn how to use vi |
75 |
faster than ever possible before! |
76 |
</p> |
77 |
@@ -78,10 +78,10 @@ |
78 |
|
79 |
<p> |
80 |
In this guide, I'm going to use several techniques to help you |
81 |
-learn. First, I'm going to describe how a particular command works, |
82 |
-as you'd expect. Then, I'm going to ask you to try to use the command |
83 |
+learn. First, I'm going to describe how a particular command works, |
84 |
+as you'd expect. Then, I'm going to ask you to try to use the command |
85 |
in vi (for practice), and then I'm going to ask you to transcribe the |
86 |
-command to the cheat sheet (for later reference.) If you want to |
87 |
+command to the cheat sheet (for later reference.) If you want to |
88 |
learn vi quickly, it's important that you perform all these steps. |
89 |
Trying out a command in vi and transcribing the command onto your |
90 |
cheat sheet will help you to memorize the command. |
91 |
@@ -95,11 +95,11 @@ |
92 |
|
93 |
<p> |
94 |
There are many versions of vi, and I'm going to be showing you how to |
95 |
-use a version of vi called <c>vim</c>. vim is very popular and has a |
96 |
+use a version of vi called <c>vim</c>. vim is very popular and has a |
97 |
number of extensions that make vi a lot nicer (whenever I demonstrate |
98 |
a vim-specific command, I'll make a note of it.) If you need to |
99 |
install vim, you can get it from <uri |
100 |
-link="http://www.vim.org/">www.vim.org</uri>. In addition to an |
101 |
+link="http://www.vim.org/">www.vim.org</uri>. In addition to an |
102 |
enhanced command-line vi, vim also comes with <c>gvim</c>, a nice graphical |
103 |
editor which can be configured to use the excellent GTK+ gui library. |
104 |
Here's a gvim screenshot from my system: |
105 |
@@ -108,7 +108,7 @@ |
106 |
<figure link="/images/vishot.png" short="screenshot" caption="VIM screenshot"/> |
107 |
|
108 |
<p> |
109 |
-If you're a vi newbie, try to get gvim running on your system. Using |
110 |
+If you're a vi newbie, try to get gvim running on your system. Using |
111 |
vi from a gui can make things a bit easier for beginners. |
112 |
</p> |
113 |
|
114 |
@@ -124,8 +124,8 @@ |
115 |
|
116 |
<p> |
117 |
Before using vi to edit files, you need to know how to use vi to move |
118 |
-around in a file. vi has a lot of movement commands, and we're going |
119 |
-to take a look at many of them. For this part of the tutorial, find |
120 |
+around in a file. vi has a lot of movement commands, and we're going |
121 |
+to take a look at many of them. For this part of the tutorial, find |
122 |
an unimportant text file and load it into vi by typing: |
123 |
</p> |
124 |
|
125 |
@@ -134,9 +134,9 @@ |
126 |
</pre> |
127 |
|
128 |
<p> |
129 |
-If you have vim installed, type <c>vim myfile.txt</c>. If you'd prefer to |
130 |
-use gvim, type <c>gvim myfile.txt</c>. <path>myfile.txt</path> should be the name of a |
131 |
-text file on your system. |
132 |
+If you have vim installed, type <c>vim myfile.txt</c>. If you'd prefer to |
133 |
+use gvim, type <c>gvim myfile.txt</c>. <path>myfile.txt</path> should be the |
134 |
+name of a text file on your system. |
135 |
</p> |
136 |
|
137 |
</body> |
138 |
@@ -147,13 +147,13 @@ |
139 |
|
140 |
<p> |
141 |
After vi loads, you should see a part of the text file you loaded |
142 |
-on your screen. Congratulations -- you're in vi! Unlike many |
143 |
+on your screen. Congratulations -- you're in vi! Unlike many |
144 |
editors, when vi starts up, it is in a special mode called <e>command |
145 |
-mode</e>. This means that if you press <c>l</c>on the keyboard, instead of |
146 |
+mode</e>. This means that if you press <c>l</c>on the keyboard, instead of |
147 |
inserting an <c>l</c> into the file at the current cursor position, the |
148 |
-cursor will move one character to the right instead. In command mode, |
149 |
+cursor will move one character to the right instead. In command mode, |
150 |
the characters on your keyboard are used to send commands to vi rather |
151 |
-than insert literal characters into the text. One of the most |
152 |
+than insert literal characters into the text. One of the most |
153 |
essential types of commands are movement commands; let's take a look |
154 |
at some. |
155 |
</p> |
156 |
@@ -171,15 +171,15 @@ |
157 |
<p> |
158 |
When in command mode, you can use the <c>h</c>,<c>j</c>,<c>k</c> and |
159 |
<c>l</c> keys to move the cursor left, down, up and right |
160 |
-respectively. If you're using a modern version of vi, you can also |
161 |
-use the arrow keys for this purpose. The <c>h</c>,<c>j</c>,<c>k</c> |
162 |
+respectively. If you're using a modern version of vi, you can also |
163 |
+use the arrow keys for this purpose. The <c>h</c>,<c>j</c>,<c>k</c> |
164 |
and <c>l</c> keys are handy because once you're comfortable with them, |
165 |
you'll be able to move around in the file without moving your fingers |
166 |
-from the home keyboard row. Try using <c>h</c>,<c>j</c>,<c>k</c> and |
167 |
-<c>l</c> (and the arrow keys) to move around in the text file. Try |
168 |
-using <c>h</c> until you get to the beginning of a line. Notice that |
169 |
+from the home keyboard row. Try using <c>h</c>,<c>j</c>,<c>k</c> and |
170 |
+<c>l</c> (and the arrow keys) to move around in the text file. Try |
171 |
+using <c>h</c> until you get to the beginning of a line. Notice that |
172 |
vi doesn't allow you to "wrap around" to the previous line by hitting |
173 |
-<c>h</c> while you're on the first character. Likewise, you can't |
174 |
+<c>h</c> while you're on the first character. Likewise, you can't |
175 |
"wrap around" to the next line by hitting <c>l</c> at the end of a |
176 |
line. |
177 |
</p> |
178 |
@@ -192,17 +192,17 @@ |
179 |
|
180 |
<p> |
181 |
vi offers special shortcuts for jumping to the beginning or end of the |
182 |
-current line. You can press <c>0</c> (zero) to jump to the first |
183 |
+current line. You can press <c>0</c> (zero) to jump to the first |
184 |
character of a line, and <c>$</c> to jump to the last character of the |
185 |
-line. Try 'em and see. Since vi has so many handy movement commands, |
186 |
-it makes a great "pager" (like the more or less commands.) Using vi |
187 |
+line. Try 'em and see. Since vi has so many handy movement commands, |
188 |
+it makes a great "pager" (like the more or less commands.) Using vi |
189 |
as a pager will also help you to learn all the movement commands very |
190 |
quickly. |
191 |
</p> |
192 |
|
193 |
<p> |
194 |
You can also use <c><CTR>F</c> and <c><CTR>B</c> to move |
195 |
-forwards and backwards a page at a time. Modern versions of vi (like |
196 |
+forwards and backwards a page at a time. Modern versions of vi (like |
197 |
vim) will also allow you to use the <c>PGUP</c> and <c>PGDOWN</c> keys for this |
198 |
purpose. |
199 |
</p> |
200 |
@@ -216,9 +216,9 @@ |
201 |
<p> |
202 |
vi also allows you to move to the left or right by word increments. |
203 |
To move to the <e>first</e> character of the next word, press |
204 |
-<c>w</c>. To move to the <e>last</e> character of the next word, |
205 |
-press <c>e</c>. To move to the first character of the <e>previous</e> |
206 |
-word, press <c>b</c>. Test 'em out. |
207 |
+<c>w</c>. To move to the <e>last</e> character of the next word, |
208 |
+press <c>e</c>. To move to the first character of the <e>previous</e> |
209 |
+word, press <c>b</c>. Test 'em out. |
210 |
</p> |
211 |
|
212 |
</body> |
213 |
@@ -230,15 +230,15 @@ |
214 |
<p> |
215 |
After playing around with the word movement commands, you may have |
216 |
noticed that vi considers words like <c>foo-bar-oni</c> as five separate |
217 |
-words! This is because by default, vi delimits words by spaces |
218 |
-<e>or</e> punctuation. <c>foo-bar-oni</c> is therefore considered five |
219 |
+words! This is because by default, vi delimits words by spaces |
220 |
+<e>or</e> punctuation. <c>foo-bar-oni</c> is therefore considered five |
221 |
words: <c>foo</c>, <c>-</c>, <c>bar</c>, <c>-</c> and <c>oni</c>. |
222 |
</p> |
223 |
|
224 |
<p> |
225 |
Sometimes, this is what you want, and sometimes it isn't. |
226 |
-Fortunately, vi also understands the concept of a "bigword". vi |
227 |
-delimits bigwords by <e>spaces or newlines only</e>. This means that |
228 |
+Fortunately, vi also understands the concept of a "bigword". vi |
229 |
+delimits bigwords by <e>spaces or newlines only</e>. This means that |
230 |
while <c>foo-bar-oni</c> is considered five vi words, it's considered only |
231 |
one vi bigword. |
232 |
</p> |
233 |
@@ -251,10 +251,10 @@ |
234 |
|
235 |
<p> |
236 |
To jump around to the next and previous bigword, you can use a |
237 |
-<e>capitalized</e> word move command. Use <c>W</c> to jump to the |
238 |
+<e>capitalized</e> word move command. Use <c>W</c> to jump to the |
239 |
first character of the next bigword, <c>E</c> to jump to the last |
240 |
character of the next bigword, and <c>B</c> to jump to the first |
241 |
-character of the previous bigword. Test 'em out, and compare the |
242 |
+character of the previous bigword. Test 'em out, and compare the |
243 |
matching word and bigword movement commands until you understand their |
244 |
differences. |
245 |
</p> |
246 |
@@ -267,9 +267,9 @@ |
247 |
|
248 |
<p> |
249 |
We just have a few more commands to cover before it's time to start |
250 |
-puting together our cheat sheet. You can use the <c>(</c> and |
251 |
+puting together our cheat sheet. You can use the <c>(</c> and |
252 |
<c>)</c> characters to move to the beginning of the previous and next |
253 |
-sentence. In addition, you can hit <c>{</c> or <c>}</c> to jump to |
254 |
+sentence. In addition, you can hit <c>{</c> or <c>}</c> to jump to |
255 |
the beginning of the current paragraph, and the beginning of the next. |
256 |
Test 'em out. |
257 |
</p> |
258 |
@@ -285,21 +285,21 @@ |
259 |
|
260 |
<p> |
261 |
We've covered the basic movement commands, but there are another |
262 |
-couple of commands that you need to know. Typing <c>:q</c> will quit |
263 |
-vi. If this doesn't work, then you probably accidentally modified the |
264 |
-file in some way. To tell vi to quit, throwing away any changes, type |
265 |
-<c>:q!</c>. You should now be at the command prompt. |
266 |
+couple of commands that you need to know. Typing <c>:q</c> will quit |
267 |
+vi. If this doesn't work, then you probably accidentally modified the |
268 |
+file in some way. To tell vi to quit, throwing away any changes, type |
269 |
+<c>:q!</c>. You should now be at the command prompt. |
270 |
</p> |
271 |
|
272 |
<p> |
273 |
In vi, any command that begins with a <c>:</c> is said to be an |
274 |
-<e>ex-mode</e> command. This is because vi has a built-in non-visual |
275 |
-editor called <e>ex</e>. It can be used similarly to sed to perform |
276 |
-line-based editing operations. In addition, it can also be used to |
277 |
-quit, as we've just seen. If you ever hit the <c>Q</c> key while in |
278 |
-command mode, you'll be transported to ex mode. If this ever happens |
279 |
-to you , you'll be confronted with a : prompt, and hitting enter will |
280 |
-scroll the entire screen upwards. To get back to good 'ol vi mode, |
281 |
+<e>ex-mode</e> command. This is because vi has a built-in non-visual |
282 |
+editor called <e>ex</e>. It can be used similarly to sed to perform |
283 |
+line-based editing operations. In addition, it can also be used to |
284 |
+quit, as we've just seen. If you ever hit the <c>Q</c> key while in |
285 |
+command mode, you'll be transported to ex mode. If this ever happens |
286 |
+to you, you'll be confronted with a : prompt, and hitting enter will |
287 |
+scroll the entire screen upwards. To get back to good 'ol vi mode, |
288 |
simply type vi and hit enter. |
289 |
</p> |
290 |
|
291 |
@@ -315,10 +315,10 @@ |
292 |
|
293 |
<p> |
294 |
We've covered a lot of commands, and it's time to transcribe them to |
295 |
-our cheat sheet. For the cheat sheet, you'll need a US letter or A4 |
296 |
+our cheat sheet. For the cheat sheet, you'll need a US letter or A4 |
297 |
sized piece of paper (we're going to pack a lot of info onto this |
298 |
-sheet!) Here's a picture of my cheat sheet after I've transcribed all |
299 |
-the commands that we've covered so far. Try to follow my layout if |
300 |
+sheet!) Here's a picture of my cheat sheet after I've transcribed all |
301 |
+the commands that we've covered so far. Try to follow my layout if |
302 |
possible so that we can fit everything on one sheet. |
303 |
</p> |
304 |
|
305 |
@@ -332,27 +332,27 @@ |
306 |
<body> |
307 |
|
308 |
<p> |
309 |
-Let's continue our rapid command-covering pace. In command-mode, you |
310 |
-can jump to a particularline by typing <c>G</c>. To jump to the first |
311 |
-line of a file, type <c>1G</c>. Note that <c>G</c> is capitalized. |
312 |
+Let's continue our rapid command-covering pace. In command-mode, you |
313 |
+can jump to a particularline by typing <c>G</c>. To jump to the first |
314 |
+line of a file, type <c>1G</c>. Note that <c>G</c> is capitalized. |
315 |
</p> |
316 |
|
317 |
<p> |
318 |
If you want to jump to the next occurence of a particular text |
319 |
-pattern, type <c>/<regexp></c> and hit <c>enter</c>. Replace |
320 |
-<regexp> with the regular expression you're looking for. If you |
321 |
+pattern, type <c>/<regexp></c> and hit <c>enter</c>. Replace |
322 |
+<regexp> with the regular expression you're looking for. If you |
323 |
don't know how to use regular expressions, don't fret -- typing |
324 |
-<c>/foo</c> will move to the next occurence of <e>foo</e>. The only |
325 |
+<c>/foo</c> will move to the next occurence of <e>foo</e>. The only |
326 |
thing you'll need to watch out for is when you want to refer to the |
327 |
-literal <c>^</c>, <c>.</c>, <c>$</c> or <c>\</c> characters. Prefix |
328 |
-these characters with a backslash (<c>\</c>), and you'll be set. For |
329 |
+literal <c>^</c>, <c>.</c>, <c>$</c> or <c>\</c> characters. Prefix |
330 |
+these characters with a backslash (<c>\</c>), and you'll be set. For |
331 |
example, <c>/foo\.gif</c> will search for the next occurence of |
332 |
"foo.gif". |
333 |
</p> |
334 |
|
335 |
<p> |
336 |
-To repeat the search forwards, hit <c>n</c>. To repeat the search |
337 |
-backwards, type <c>N</c>. As always, test these commands out in your |
338 |
+To repeat the search forwards, hit <c>n</c>. To repeat the search |
339 |
+backwards, type <c>N</c>. As always, test these commands out in your |
340 |
very own vi editor. You can also type <c>//</c> to repeat the last |
341 |
search. |
342 |
</p> |
343 |
@@ -369,18 +369,18 @@ |
344 |
|
345 |
<p> |
346 |
We've covered how you can use the <e>ex</e> command <c>:q</c> to quit |
347 |
-from vi. If you want to save your changes, type <c>:w</c>. If you |
348 |
+from vi. If you want to save your changes, type <c>:w</c>. If you |
349 |
want to save your changes to another file, type <c>:w filename.txt</c> |
350 |
-to save as <e>filename.txt</e>. If you want to save and quit, type |
351 |
+to save as <e>filename.txt</e>. If you want to save and quit, type |
352 |
<c>:x</c> or <c>:wq</c>. |
353 |
</p> |
354 |
|
355 |
<p> |
356 |
In vim (and other advanced vi editors, like elvis)<c>:w</c>, you can |
357 |
-have multiple buffers open at once. To open a file into a new window, |
358 |
-type <c>:sp filename.txt</c>. <path>filename.txt</path> will appear open |
359 |
-for editing in a new split window. To switch between windows, type |
360 |
-<c><CTR>w<CTR>w</c> (control-w twice). Any <c>:q</c>, |
361 |
+have multiple buffers open at once. To open a file into a new window, |
362 |
+type <c>:sp filename.txt</c>. <path>filename.txt</path> will appear open |
363 |
+for editing in a new split window. To switch between windows, type |
364 |
+<c><CTR>w<CTR>w</c> (control-w twice). Any <c>:q</c>, |
365 |
<c>:q!</c>, <c>:w</c> and <c>:x</c> commands that you enter will only |
366 |
be applied to the currently-active window. |
367 |
</p> |
368 |
@@ -394,21 +394,21 @@ |
369 |
<p> |
370 |
Now, it's time to start learning some of the simple editing commands. |
371 |
The commands that we'll cover here are considered <e>simple</e> because the |
372 |
-commands keep you in command mode. The more complex editing commands |
373 |
+commands keep you in command mode. The more complex editing commands |
374 |
automatically put you into insert mode -- a mode that allows you to |
375 |
-enter literal data from the keyboard. We'll cover those in a bit. |
376 |
+enter literal data from the keyboard. We'll cover those in a bit. |
377 |
</p> |
378 |
|
379 |
<p> |
380 |
For now, try moving over some characters and hitting <c>x</c> |
381 |
-repeatedly. You'll see that <c>x</c> will delete the current |
382 |
-character under the cursor. Now, move to the middle of the paragraph |
383 |
-somewhere in your text file, and hit <c>J</c> (capitalized). You'll |
384 |
+repeatedly. You'll see that <c>x</c> will delete the current |
385 |
+character under the cursor. Now, move to the middle of the paragraph |
386 |
+somewhere in your text file, and hit <c>J</c> (capitalized). You'll |
387 |
see that the <c>J</c> command tells vi to join the next line to the |
388 |
-end of the current line. Now, move over a character and hit |
389 |
+end of the current line. Now, move over a character and hit |
390 |
<c>r</c>, and then type in a new character; you'll see that the |
391 |
-original character has been replaced. Finally, move to any line in |
392 |
-the file and type <c>dd</c>. You'll see that <c>dd</c> deletes the |
393 |
+original character has been replaced. Finally, move to any line in |
394 |
+the file and type <c>dd</c>. You'll see that <c>dd</c> deletes the |
395 |
current line of text. |
396 |
</p> |
397 |
|
398 |
@@ -419,18 +419,18 @@ |
399 |
<body> |
400 |
|
401 |
<p> |
402 |
-You can repeat any editing command by hitting the <c>.</c> key. If |
403 |
+You can repeat any editing command by hitting the <c>.</c> key. If |
404 |
you experiment, you'll see that typing <c>dd...</c> will delete 4 |
405 |
-lines, and <c>J......</c> will join four lines. As usual, vi provides |
406 |
+lines, and <c>J......</c> will join four lines. As usual, vi provides |
407 |
with another handy shortcut. |
408 |
</p> |
409 |
|
410 |
<p> |
411 |
To delete text, you can also use the <c>d</c> command combined with |
412 |
-any movement command. For example, <c>dw</c> will delete from the |
413 |
+any movement command. For example, <c>dw</c> will delete from the |
414 |
current position to the beginning of the next word; <c>d)</c> will |
415 |
delete up until the end of the next sentence, and <c>d}</c> will |
416 |
-delete the remainder of the paragraph. Experiment with the |
417 |
+delete the remainder of the paragraph. Experiment with the |
418 |
<c>d</c> command and the other editing commands until you're |
419 |
comfortable with them. |
420 |
</p> |
421 |
@@ -443,10 +443,10 @@ |
422 |
|
423 |
<p> |
424 |
Now that we're experimenting with deletion, it would be a good time to |
425 |
-learn how to undo any changes. By pressing <c>u</c>, the original |
426 |
-version of vi allowed you to undo the last edit only. However, modern |
427 |
+learn how to undo any changes. By pressing <c>u</c>, the original |
428 |
+version of vi allowed you to undo the last edit only. However, modern |
429 |
versions of vi like vim will allow you to repeatedly press <c>u</c> to |
430 |
-continue to undo changes to your file. Try combining some <c>d</c> |
431 |
+continue to undo changes to your file. Try combining some <c>d</c> |
432 |
and <c>u</c> commands together. |
433 |
</p> |
434 |
|
435 |
@@ -457,7 +457,7 @@ |
436 |
<body> |
437 |
|
438 |
<p> |
439 |
-Time to update the cheat sheet! After adding all the commands we've |
440 |
+Time to update the cheat sheet! After adding all the commands we've |
441 |
covered so far, your cheat sheet should look like this: |
442 |
</p> |
443 |
|
444 |
@@ -475,21 +475,21 @@ |
445 |
|
446 |
<p> |
447 |
So far, we've covered how to move around in vi, perform file i/o, and |
448 |
-perform basic editing operations. However, I still haven't shown you |
449 |
-how to actually type in free-form text! This was intentional, because |
450 |
-vi's insert mode is a bit complicated at first. However, after you |
451 |
+perform basic editing operations. However, I still haven't shown you |
452 |
+how to actually type in free-form text! This was intentional, because |
453 |
+vi's insert mode is a bit complicated at first. However, after you |
454 |
become comfortable with insert mode, its complexity (and flexibility) |
455 |
will become an asset. |
456 |
</p> |
457 |
|
458 |
<p> |
459 |
In vi <e>insert mode</e>, you'll be able to enter text directly to the screen |
460 |
-just like you can in many other visual editors. Once you've entered |
461 |
-your modifications, you can hit escape to return to <e>command mode</e>. You |
462 |
-can enter insert mode by pressing <c>i</c> or <c>a</c>. If you press |
463 |
+just like you can in many other visual editors. Once you've entered |
464 |
+your modifications, you can hit escape to return to <e>command mode</e>. You |
465 |
+can enter insert mode by pressing <c>i</c> or <c>a</c>. If you press |
466 |
<c>i</c>, your text will be <e>inserted</e> before the current |
467 |
character, and if you hit <c>a</c>, your text will be <e>appended</e> |
468 |
-after the current character. Remember, after you enter your text, hit |
469 |
+after the current character. Remember, after you enter your text, hit |
470 |
<c><ESC></c> to return to command mode. |
471 |
</p> |
472 |
|
473 |
@@ -500,12 +500,12 @@ |
474 |
<body> |
475 |
|
476 |
<p> |
477 |
-Go ahead and try using the <c>a</c> and <c>i</c> commands. Hit either |
478 |
+Go ahead and try using the <c>a</c> and <c>i</c> commands. Hit either |
479 |
<c>a</c> or <c>i</c>, type some text, and then hit escape to get back |
480 |
-to command mode. After hitting <c>a</c> or <c>i</c>, try hitting |
481 |
-<c><ENTER></c>, and see what happens. Try using the arrow keys |
482 |
+to command mode. After hitting <c>a</c> or <c>i</c>, try hitting |
483 |
+<c><ENTER></c>, and see what happens. Try using the arrow keys |
484 |
and the <c><DEL></c> key to get a feel for how insert mode |
485 |
-works. By using the arrow keys and <c><DEL></c> key, you can |
486 |
+works. By using the arrow keys and <c><DEL></c> key, you can |
487 |
perform significant editing steps without repeatedly entering and |
488 |
leaving insert mode. |
489 |
</p> |
490 |
@@ -517,22 +517,22 @@ |
491 |
<body> |
492 |
|
493 |
<p> |
494 |
-Here are some other handy ways to enter insert mode. Press <c>A</c> |
495 |
+Here are some other handy ways to enter insert mode. Press <c>A</c> |
496 |
(captial) to begin appending to the <e>end</e> of the current line, |
497 |
-regardless of your current position on the line. Likewise, press |
498 |
+regardless of your current position on the line. Likewise, press |
499 |
<c>I</c> (capital) to begin inserting text at the <e>beginning</e> of |
500 |
-the current line. Press <c>o</c> to create a new blank line below the |
501 |
+the current line. Press <c>o</c> to create a new blank line below the |
502 |
current line into which you can insert text, and press <c>O</c> |
503 |
-(capital) to create a new line above the current line. To replace the |
504 |
-entire current line with a new line, press <c>cc</c>. To replace |
505 |
+(capital) to create a new line above the current line. To replace the |
506 |
+entire current line with a new line, press <c>cc</c>. To replace |
507 |
everything from the current position to the end of the line, type |
508 |
-<c>c$</c>. To replace everything from the current position to the |
509 |
+<c>c$</c>. To replace everything from the current position to the |
510 |
beginning of the line, type <c>c0</c>. |
511 |
</p> |
512 |
|
513 |
<p> |
514 |
In addition to performing a special operation, every one of these |
515 |
-commands will put you into insert mode. After typing in your text, |
516 |
+commands will put you into insert mode. After typing in your text, |
517 |
hit <c><ESC></c> to return to command mode. |
518 |
</p> |
519 |
|
520 |
@@ -544,12 +544,12 @@ |
521 |
|
522 |
<p> |
523 |
We've used the <c>c</c> (change) command a little bit so far when we |
524 |
-typed <c>cc</c>, <c>c0</c> and <c>c$</c>. <c>cc</c> is a special form |
525 |
-of the change command, similar to <c>dd</c>. the <c>c0</c> and |
526 |
+typed <c>cc</c>, <c>c0</c> and <c>c$</c>. <c>cc</c> is a special form |
527 |
+of the change command, similar to <c>dd</c>. the <c>c0</c> and |
528 |
<c>c$</c> commands are examples of using the change command in |
529 |
-combination with a movement command. In this form, <c>c</c> works |
530 |
+combination with a movement command. In this form, <c>c</c> works |
531 |
similarly to <c>d</c>, except that it leaves you in insert mode so |
532 |
-that you can enter replacement text for the deleted region. Try |
533 |
+that you can enter replacement text for the deleted region. Try |
534 |
combining some movement commands with <c>c</c> and test them out on |
535 |
your file (hint: <c>cW</c>, <c>ce</c>, <c>c(</c> .) |
536 |
</p> |
537 |
@@ -565,20 +565,20 @@ |
538 |
|
539 |
<p> |
540 |
vi <e>really</e> becomes powerful when you start using compound |
541 |
-("combo") commands, like <c>d{</c> and <c>cw</c>. In addition to |
542 |
+("combo") commands, like <c>d{</c> and <c>cw</c>. In addition to |
543 |
these commands, you can also combine a number with any movement |
544 |
command, such as <c>3w</c>, which will tell vi to jump three words to |
545 |
-the right. Here are some more movement "combo" command examples: |
546 |
+the right. Here are some more movement "combo" command examples: |
547 |
<c>12b</c>, <c>4j</c>. |
548 |
</p> |
549 |
|
550 |
<p> |
551 |
vi, in addition to allowing (number)(movement command) combinations, |
552 |
also allows <c>d</c> or <c>c</c> to be combined with a number or |
553 |
-movement command. So, <c>d3w</c> will delete the next three words, |
554 |
-<c>d2j</c> will delete the current and next two lines, etc. Test out |
555 |
+movement command. So, <c>d3w</c> will delete the next three words, |
556 |
+<c>d2j</c> will delete the current and next two lines, etc. Test out |
557 |
some <c>c</c> and <c>d</c> combo moves to get a feel for how powerful |
558 |
-and concise vi editing can be. Once these commands are second-nature, |
559 |
+and concise vi editing can be. Once these commands are second-nature, |
560 |
you'll be able to edit files at blazing speed. |
561 |
</p> |
562 |
|
563 |
@@ -589,7 +589,7 @@ |
564 |
<body> |
565 |
|
566 |
<p> |
567 |
-Time to update the cheat sheet again. Here's what it looks like so |
568 |
+Time to update the cheat sheet again. Here's what it looks like so |
569 |
far: |
570 |
</p> |
571 |
|
572 |
@@ -604,13 +604,13 @@ |
573 |
|
574 |
<p> |
575 |
So far, we've covered how to move, save and quit, perform simple edits |
576 |
-and deletions, and use insert mode. With everything listed on the |
577 |
+and deletions, and use insert mode. With everything listed on the |
578 |
cheat sheet so far, you should be able to use vi to perform almost any |
579 |
task. |
580 |
</p> |
581 |
|
582 |
<p> |
583 |
-However, vi also has many more powerful commands. In this section, |
584 |
+However, vi also has many more powerful commands. In this section, |
585 |
you'll learn how to <e>cut</e>, <e>copy</e> and <e>paste</e>, |
586 |
<e>search</e> and <e>replace</e>, and use <e>autoindent</e> features. |
587 |
These commands will help make vi more fun and productive. |
588 |
@@ -624,9 +624,9 @@ |
589 |
|
590 |
<p> |
591 |
The best way to cut and paste is to use <e>visual mode</e>, a special mode that |
592 |
-has been added to modern versions of vi, like vim and elvis. You can think |
593 |
-of visual mode as a "highlight text" mode. Once the text is highlighted, |
594 |
-it can be copied or deleted, and then pasted. If you are using gvim, you |
595 |
+has been added to modern versions of vi, like vim and elvis. You can think |
596 |
+of visual mode as a "highlight text" mode. Once the text is highlighted, |
597 |
+it can be copied or deleted, and then pasted. If you are using gvim, you |
598 |
can highlight by simply dragging the left mouse button over a particular |
599 |
region: |
600 |
</p> |
601 |
@@ -636,19 +636,19 @@ |
602 |
|
603 |
<p> |
604 |
In addition, you can also enter visual mode by hitting <c>v</c> (this |
605 |
-may be your only option if you are using vi from the console.) Then, |
606 |
+may be your only option if you are using vi from the console.) Then, |
607 |
by moving the cursor using movement commands (typically the arrow |
608 |
-keys), you'll be able to highlight a region of text. Once |
609 |
+keys), you'll be able to highlight a region of text. Once |
610 |
highlighted, we are ready to cut or copy the text. |
611 |
</p> |
612 |
|
613 |
<p> |
614 |
If you're copying the text, hit <c>y</c> (which stands for "yank"). |
615 |
-If you're cutting the text, hit <c>d</c>. You'll be placed back in |
616 |
-command mode. Now, move to the position where you'd like to insert |
617 |
+If you're cutting the text, hit <c>d</c>. You'll be placed back in |
618 |
+command mode. Now, move to the position where you'd like to insert |
619 |
the cut or copied text, and hit <c>P</c> to insert before the cursor, |
620 |
-or <c>p</c> to insert after the cursor. Voila, the cut/copy and |
621 |
-paste is complete! Test out several copy/cut and paste operations |
622 |
+or <c>p</c> to insert after the cursor. Voila, the cut/copy and |
623 |
+paste is complete! Test out several copy/cut and paste operations |
624 |
before advancing to the next section. |
625 |
</p> |
626 |
|
627 |
@@ -659,15 +659,15 @@ |
628 |
<body> |
629 |
|
630 |
<p> |
631 |
-To replace patterns of text, we use <e>ex</e> mode. If you'd like to |
632 |
+To replace patterns of text, we use <e>ex</e> mode. If you'd like to |
633 |
replace the first pattern that appears on the current line, type |
634 |
<c>:s/<regexp>/<replacement>/</c> and hit |
635 |
<c><ENTER></c>, where <regexp> is the pattern you'd like |
636 |
-to match and <replacement> is the replacement string. To |
637 |
+to match and <replacement> is the replacement string. To |
638 |
replace all matches on the current line, type |
639 |
-<c>:s/<regexp>/<replacement>/g</c> and hit enter. To |
640 |
+<c>:s/<regexp>/<replacement>/g</c> and hit enter. To |
641 |
replace every occurence of this pattern in your file (normally what |
642 |
-you want), type <c>:%s/<regexp>/<replacement>/g</c>. If |
643 |
+you want), type <c>:%s/<regexp>/<replacement>/g</c>. If |
644 |
you'd like to do a global replace, but have vi prompt you for each |
645 |
change, type <c>:%s/<regexp>/<replacement>/gc</c> (stands |
646 |
for "confirm") and hit <c><ENTER></c>. |
647 |
@@ -687,7 +687,7 @@ |
648 |
(control-d) to move one indent level to the left, and |
649 |
<c><CTR>t</c> (control-t) to move one indent level to the right. |
650 |
If autoindent wasn't enabled automatically, you can manually enable it |
651 |
-by typing in the <e>ex</e> command <c>:set autoindent</c>. You can |
652 |
+by typing in the <e>ex</e> command <c>:set autoindent</c>. You can |
653 |
also tell vi to set the tab size to your favorite setting by using the |
654 |
<c>:set tabstop</c> command; <c>:set tabstop=4</c> is quite popular. |
655 |
</p> |
656 |
@@ -699,7 +699,7 @@ |
657 |
<body> |
658 |
|
659 |
<p> |
660 |
-Well, we've reached the end of the vi tutorial! After adding all the |
661 |
+Well, we've reached the end of the vi tutorial! After adding all the |
662 |
advanced editing commands to your cheat sheet, it should look like |
663 |
this: |
664 |
</p> |
665 |
@@ -709,7 +709,7 @@ |
666 |
|
667 |
<p> |
668 |
Keep your cheat sheet handy, and begin using vi to edit files and |
669 |
-compose emails. Refer to the cheat sheet when needed; you'll find |
670 |
+compose emails. Refer to the cheat sheet when needed; you'll find |
671 |
that within the week, you'll have nearly all the commands memorized |
672 |
and your vi productivity will shoot through the roof! |
673 |
</p> |
674 |
@@ -749,7 +749,7 @@ |
675 |
<li> |
676 |
If you're looking for a good, old-fashioned book, <uri |
677 |
link="http://www.oreilly.com/catalog/vi6/">Learning the vi Editor, |
678 |
- 6th Edition</uri> would be an excellent choice. Contains good |
679 |
+ 6th Edition</uri> would be an excellent choice. Contains good |
680 |
coverage of vi and vi clones. |
681 |
</li> |
682 |
</ul> |
683 |
|
684 |
|
685 |
|
686 |
-- |
687 |
gentoo-doc-cvs@l.g.o mailing list |