home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  

Book HomeBook TitleSearch this book

Chapter 8. The vi Editor

This chapter presents the following topics:

vi is pronounced “vee eye.”

Besides the original Unix vi, there are a number of freely available vi clones. Both the original vi and the clones are covered in Learning the vi Editor, listed in the Bibliography.

8.1. Review of vi Operations

This section provides a review of the following:

  • Command-line syntax

  • vi modes

  • Syntax of vi commands

  • Status-line commands

8.1.1. Command-Line Syntax

The three most common ways of starting a vi session are:

vi file
vi +n file
vi +/pattern file

You can open file for editing, optionally at line n or at the first line matching pattern. If no file is specified, vi opens with an empty buffer. See Chapter 2, for more information on command-line options for vi.

Note that vi and ex are actually the same program; thus it is worthwhile to review the material in Chapter 9, as well, in order to become familiar with the ex command set.

8.1.5. Status-Line Commands

Most commands are not echoed on the screen as you input them. However, the status line at the bottom of the screen is used to echo input for these commands:

/Search forward for a pattern.
?Search backward for a pattern.
:Invoke an ex command.

Invoke a Unix command that takes as its input an object in the buffer and replaces it with output from the command.

Commands that are input on the status line must be entered by pressing the Return key. In addition, error messages and output from the CTRL-G command are displayed on the status line.

Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.