O'Reilly logo

vi Editor Pocket Reference by Arnold Robbins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 1. vi Editor Pocket Reference

Introduction

This pocket reference is a companion to Learning the vi Editor, by Linda Lamb and Arnold Robbins. It describes the vi command-line options, command mode commands, ex commands and options, regular expressions and the use of the substitute (s) command, and other pertinent information for using vi. Also covered are the additional features in the four vi clones, nvi, elvis, vim, and vile.

The Solaris 2.6 version of vi served as the “reference” version of vi for this pocket reference.

Conventions

The following font conventions are used in this book:

Courier

Used for command names, options, and everything to be typed literally

Courier Italic

Used for replaceable text within commands

Italic

Used for replaceable text within regular text, program names, filenames, paths, for emphasis, and new terms when first defined

[ … ]

Identifies optional text; the brackets are not typed

CTRL-G

Indicates a keystroke

Command-Line Options

CommandAction
vi file

Invoke vi on file

vi file1 file2

Invoke vi on files sequentially

view file

Invoke vi on file in read-only mode

vi -R file

Invoke vi on file in read-only mode

vi -r file

Recover file and recent edits after a crash

vi -t tag

Look up tag and start editing at its definition

vi -w n

Set the window size to n; useful over a slow connection

vi + file

Open file at last line

vi +n file

Open file directly at line number n

vi -c command file

Open file, execute command, which is usually a search command or line number (POSIX)

vi +/pattern file

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required