Site Administration Page 4 - Vi 101 |
Now that you know how to insert text, it's time to teach you the second most confusing thing about vi - moving around within the document. In order to gain the maximum benefit from this lesson, I suggest you either open an existing document, or create a new one and enter a few lines of text into it. Make sure that you're in command mode by hitting a few times when you're done. Vi's movement keys are h = left j = down k = up l = right On some UNIX consoles, it may also be possible to use the cursor keys to accomplish movement within the document; however, I suggest that you take a few moments to memorize the list above instead, as cursor key movements can sometimes get lost over telnet connections, while the standard vi keys above will work in any situation. Care to move between words? Try to move one word forward, or to move one back. To move between paragraphs, try and while moving between sentences requires careful use of and If you need to move to a specific line in your docume nt - line 568, for example - try this To move to the beginning of the file, type while the end of the file is just a away. And vi also has an equivalent for the "Page-Up" and "Page-Down" commands common in other text editors; try to move one page forward, and to move one page back. To find out your exact position in the document [kinda like GPS, but not as cool!], try Of course, these aren't the only motion keys - there are quite a few more, but I'm afraid that you'll only hear about them in "Vi 202". For the moment, these should be sufficient for our next exercise, in which you'll be doing the tango with your keyboard. Come on, you know how this goes - two steps left, one step right, three steps back, and shake it all about... This article copyright Melonfire 2000. All rights reserved.
blog comments powered by Disqus |