Learning the vi Editor

Learning the vi EditorSearch this book
Previous: 3.4 Movement by Line Number Chapter 4Next: 4.2 Options When Starting vi

4. Beyond the Basics

More Command Combinations
Options When Starting vi
Making Use of Buffers
Marking Your Place
Other Advanced Edits

You have already been introduced to the basic vi editing commands, i, a, c, d, and y. This chapter expands on what you already know about editing. It covers:

4.1 More Command Combinations

In Chapter 2, Simple Editing , you learned the edit commands c, d, and y, as well as how to combine them with movements and numbers (such as 2cw or 4dd). In Chapter 3, Moving Around in a Hurry , you added many more movement commands to your repertoire. Although the fact that you can combine edit commands with movement is not a new concept to you, Table 4.1 gives you a feel for the many editing options you now have.

Table 4.1: More Editing Commands
ChangeDeleteCopyfrom Cursor to ...
cHdHyHtop of screen
cLdLyLbottom of screen
c+d+y+next line
c5|d5|y5|column 5 of current line
2c)2d)2y)second sentence following
c{d{y{previous paragraph
cndnynnext pattern
cGdGyGend of file
c13Gd13Gy13Gline number 13

Notice how all of the above sequences follow the general pattern:

(number)(command)(text object)

number is the optional numeric argument. command in this case is one of c, d, or y. text object is a movement command.

The general form of a vi command is discussed in Chapter 2. You may wish to review Table 2.1 and Table 2.2 as well.

Previous: 3.4 Movement by Line Number Learning the vi EditorNext: 4.2 Options When Starting vi
3.4 Movement by Line Number Book Index4.2 Options When Starting vi

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System