Vi is probably the most powerful text editor for *NIX, but if you have ever tried to use it, you probably walked away frustrated. This article walks through all the capabilities and features of Vi - from the basics, such as saving and quitting, to the more advanced topics of searching for strings.
One of vi's most powerful features is the ability to automatically repeat a command a specified number of times, by preceding the command with a number. For example, let's suppose you needed to delete eight lines of a document. Based on what you've just learnt, you would use the
command eight times, creating the truly horrible command
What you could have done, had I informed you of it earlier,
As you'll see when you try it out, this simply executes the
command eight times, deleting eight lines from the document without needing you to run to the drugstore for an aspirin after. And this technique can be used with any of the commands you've already learned - you can use it to copy multiple lines, repeat insertions a specified number of times, and even move the cursor to specific occurrences of words within the document.
This article copyright Melonfire 2000. All rights reserved.