Chapter 3. Moving Around in a Hurry

You will not use vi just to create new files. You’ll spend a lot of your time in vi editing existing files. You rarely want to simply open to the first line in the file and move through it line by line; you want to get to a specific place in a file and start working.

All edits start with you moving the cursor to where you want to begin the edit (or, with ex line editor commands, by identifying the line numbers to be edited). This chapter shows you how to think about movement in a variety of ways (by screens, by text, by patterns, or by line numbers). There are many ways to move in vi, since editing speed depends on getting to your destination with only a few keystrokes.

This chapter covers:

  • Movement by screens

  • Movement by text blocks

  • Movement by searches for patterns

  • Movement by line number

Get Learning the vi and Vim Editors, 7th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.