| … | |
… | |
| 3 | <guide link = "/doc/en/vi-guide.xml"> |
3 | <guide link = "/doc/en/vi-guide.xml"> |
| 4 | <title>Learning vi -- the "cheatsheet" technique</title> |
4 | <title>Learning vi -- the "cheatsheet" technique</title> |
| 5 | <author title="Author"><mail link="drobbins@gentoo.org">Daniel Robbins</mail></author> |
5 | <author title="Author"><mail link="drobbins@gentoo.org">Daniel Robbins</mail></author> |
| 6 | <author title="Author"><mail link="stocke2@gentoo.org">Eric Stockbridge</mail></author> |
6 | <author title="Author"><mail link="stocke2@gentoo.org">Eric Stockbridge</mail></author> |
| 7 | <abstract>This guide will teach you how to use vi, using a cheat sheet method to accelerate the learning process. This will be the first guide for vi, catering to beginners.</abstract> |
7 | <abstract>This guide will teach you how to use vi, using a cheat sheet method to accelerate the learning process. This will be the first guide for vi, catering to beginners.</abstract> |
| 8 | <version>1.1</version> |
8 | <version>1.1.1</version> |
| 9 | <date>21 Apr 2003</date> |
9 | <date>19 May 2003</date> |
| 10 | |
10 | |
| 11 | <chapter> |
11 | <chapter> |
| 12 | <title>Getting Started</title> |
12 | <title>Getting Started</title> |
| 13 | <section> |
13 | <section> |
| 14 | <title>Introduction</title> |
14 | <title>Introduction</title> |
| … | |
… | |
| 67 | <body> |
67 | <body> |
| 68 | |
68 | |
| 69 | <p>There are many versions of vi, and I'm going to be showing you how to use a |
69 | <p>There are many versions of vi, and I'm going to be showing you how to use a |
| 70 | version of vi called "vim". vim is very popular and has a number of extensions |
70 | version of vi called "vim". vim is very popular and has a number of extensions |
| 71 | that make vi a lot nicer (whenever I demonstrate a vim-specific command, I'll |
71 | that make vi a lot nicer (whenever I demonstrate a vim-specific command, I'll |
| 72 | make a note of it.) If you need to install vim, you can get it from <uri href="http://www.vim.org">http://www.vim.org</uri>. |
72 | make a note of it.) If you need to install vim, you can get it from <uri href="http://www.vim.org/">www.vim.org</uri>. |
| 73 | In addition to an enhanced |
73 | In addition to an enhanced |
| 74 | command-line vi, vim also comes with gvim, a nice graphical editor which can be |
74 | command-line vi, vim also comes with gvim, a nice graphical editor which can be |
| 75 | configured to use the excellent GTK+ gui library. Here's a gvim screenshot |
75 | configured to use the excellent GTK+ gui library. Here's a gvim screenshot |
| 76 | from my system:</p> |
76 | from my system:</p> |
| 77 | |
77 | |
| 78 | <figure link="http://www.ibiblio.org/pub/Linux/distributions/gentoo/images/vishot.png" short="screenshot" caption="VIM screenshot"/> |
78 | <figure link="http://www.ibiblio.org/web-gentoo/images/vishot.png" short="screenshot" caption="VIM screenshot"/> |
| 79 | |
79 | |
| 80 | <p>If you're a vi newbie, try to get gvim running on your system. Using vi |
80 | <p>If you're a vi newbie, try to get gvim running on your system. Using vi |
| 81 | from a gui can make things a bit easier for beginners.</p> |
81 | from a gui can make things a bit easier for beginners.</p> |
| 82 | |
82 | |
| 83 | </body> |
83 | </body> |
| … | |
… | |
| 227 | cheat sheet, you'll need a US letter or A4 sized piece of paper (we're going to pack a lot of info |
227 | cheat sheet, you'll need a US letter or A4 sized piece of paper (we're going to pack a lot of info |
| 228 | onto this sheet!) Here's a picture of my cheat sheet after I've transcribed all the commands that |
228 | onto this sheet!) Here's a picture of my cheat sheet after I've transcribed all the commands that |
| 229 | we've covered so far. Try to follow my layout if possible so that we can fit everything on one |
229 | we've covered so far. Try to follow my layout if possible so that we can fit everything on one |
| 230 | sheet.</p> |
230 | sheet.</p> |
| 231 | |
231 | |
| 232 | <figure link="http://www.ibiblio.org/pub/Linux/distributions/gentoo/images/vicheat-first.png" short="First part of the cheat sheet" caption="Cheat Sheet"/> |
232 | <figure link="http://www.ibiblio.org/web-gentoo/images/vicheat-first.png" short="First part of the cheat sheet" caption="Cheat Sheet"/> |
| 233 | |
233 | |
| 234 | </body> |
234 | </body> |
| 235 | |
235 | |
| 236 | </section> |
236 | </section> |
| 237 | <section> |
237 | <section> |
| … | |
… | |
| 307 | <title>Updating the cheat sheet</title> |
307 | <title>Updating the cheat sheet</title> |
| 308 | <body> |
308 | <body> |
| 309 | <p>Time to update the cheat sheet! After adding all the commands we've covered so far, your |
309 | <p>Time to update the cheat sheet! After adding all the commands we've covered so far, your |
| 310 | cheat sheet should look like this:</p> |
310 | cheat sheet should look like this:</p> |
| 311 | |
311 | |
| 312 | <figure link="http://www.ibiblio.org/pub/Linux/distributions/gentoo/images/vicheat-edit.png" short="Cheat sheet" caption="Cheat sheet with editing commands"/> |
312 | <figure link="http://www.ibiblio.org/web-gentoo/images/vicheat-edit.png" short="Cheat sheet" caption="Cheat sheet with editing commands"/> |
| 313 | |
313 | |
| 314 | </body> |
314 | </body> |
| 315 | </section> |
315 | </section> |
| 316 | </chapter> |
316 | </chapter> |
| 317 | <chapter> |
317 | <chapter> |
| … | |
… | |
| 391 | <section> |
391 | <section> |
| 392 | <title>Updating the cheat sheet</title> |
392 | <title>Updating the cheat sheet</title> |
| 393 | <body> |
393 | <body> |
| 394 | <p>Time to update the cheat sheet again. Here's what it looks like so far:</p> |
394 | <p>Time to update the cheat sheet again. Here's what it looks like so far:</p> |
| 395 | <p> |
395 | <p> |
| 396 | <figure link="http://www.ibiblio.org/pub/Linux/distributions/gentoo/images/vicheat-compound.png" short="Cheat Sheet" caption="Cheat sheet with compound commands"/> |
396 | <figure link="http://www.ibiblio.org/web-gentoo/images/vicheat-compound.png" short="Cheat Sheet" caption="Cheat sheet with compound commands"/> |
| 397 | |
397 | |
| 398 | </p> |
398 | </p> |
| 399 | </body> |
399 | </body> |
| 400 | </section> |
400 | </section> |
| 401 | <section> |
401 | <section> |
| … | |
… | |
| 419 | of visual mode as a "highlight text" mode. Once the text is highlighted, |
419 | of visual mode as a "highlight text" mode. Once the text is highlighted, |
| 420 | it can be copied or deleted, and then pasted. If you are using gvim, you |
420 | it can be copied or deleted, and then pasted. If you are using gvim, you |
| 421 | can highlight by simply dragging the left mouse button over a particular |
421 | can highlight by simply dragging the left mouse button over a particular |
| 422 | region:</p> |
422 | region:</p> |
| 423 | <p> |
423 | <p> |
| 424 | <figure link="http://www.ibiblio.org/pub/Linux/distributions/gentoo/images/vihighlight.png" short="Highlighted text" caption="VIM with highlighted text"/> |
424 | <figure link="http://www.ibiblio.org/web-gentoo/images/vihighlight.png" short="Highlighted text" caption="VIM with highlighted text"/> |
| 425 | |
425 | |
| 426 | </p> |
426 | </p> |
| 427 | </body> |
427 | </body> |
| 428 | </section> |
428 | </section> |
| 429 | <section> |
429 | <section> |
| … | |
… | |
| 475 | <title>Our final cheat sheet</title> |
475 | <title>Our final cheat sheet</title> |
| 476 | <body> |
476 | <body> |
| 477 | <p>Well, we've reached the end of the vi tutorial! After adding all the advanced editing commands |
477 | <p>Well, we've reached the end of the vi tutorial! After adding all the advanced editing commands |
| 478 | to your cheat sheet, it should look like this:</p> |
478 | to your cheat sheet, it should look like this:</p> |
| 479 | <p> |
479 | <p> |
| 480 | <figure link="http://www.ibiblio.org/pub/Linux/distributions/gentoo/images/vicheat-final.png" short="Cheat Sheet" caption="Final cheet sheet"/> |
480 | <figure link="http://www.ibiblio.org/web-gentoo/images/vicheat-final.png" short="Cheat Sheet" caption="Final cheet sheet"/> |
| 481 | |
481 | |
| 482 | </p> |
482 | </p> |
| 483 | |
483 | |
| 484 | <p>Keep your cheat sheet handy, and begin using vi to edit files and compose emails. Refer to the |
484 | <p>Keep your cheat sheet handy, and begin using vi to edit files and compose emails. Refer to the |
| 485 | cheat sheet when needed; you'll find that within the week, you'll have nearly all the commands |
485 | cheat sheet when needed; you'll find that within the week, you'll have nearly all the commands |
| … | |
… | |
| 492 | <body> |
492 | <body> |
| 493 | <p>Here are some resources you may find helpful as you continue to learn more about vi:</p> |
493 | <p>Here are some resources you may find helpful as you continue to learn more about vi:</p> |
| 494 | <ul> |
494 | <ul> |
| 495 | <li><uri link="http://www.thomer.com/thomer/vi/vi.html">The vi Lovers Home Page</uri>, an excellent resource for all |
495 | <li><uri link="http://www.thomer.com/thomer/vi/vi.html">The vi Lovers Home Page</uri>, an excellent resource for all |
| 496 | things vi.</li> |
496 | things vi.</li> |
| 497 | <li><uri link="http://www.vim.org">The vim homepage</uri> is the place to go for all your vim needs.</li> |
497 | <li><uri link="http://www.vim.org/">The vim homepage</uri> is the place to go for all your vim needs.</li> |
| 498 | <li>If you're looking for a good, old-fashioned book, <uri link="http://www.oreilly.com/catalog/vi6/">Learning the vi Editor, 6th Edition</uri> would be an excellent choice. Contains good coverage of vi and vi clones.</li> |
498 | <li>If you're looking for a good, old-fashioned book, <uri link="http://www.oreilly.com/catalog/vi6/">Learning the vi Editor, 6th Edition</uri> would be an excellent choice. Contains good coverage of vi and vi clones.</li> |
| 499 | </ul> |
499 | </ul> |
| 500 | </body> |
500 | </body> |
| 501 | </section> |
501 | </section> |
| 502 | </chapter> |
502 | </chapter> |