nvi—New vi

nvi is a vi clone created for the 4.4BSD Berkeley Unix release. It’s intended to be “bug-for-bug” compatible with the original, although it does have a number of extensions over the original vi.

Important Command-Line Options

-c command

Execute command at startup.

-F

Don’t copy the entire file when starting to edit.

-R

Start in read-only mode, setting the readonly option.

-s

Enter batch (script) mode. This is only for ex and is intended for running editing scripts. Prompts and nonerror messages are disabled.

-S

Run with the secure option set, disallowing access to external programs.

nvi Window Management Commands

Command

Function

bg

Hide the current window

di[splay] b[uffers]

Display all buffers, including named, unnamed, and numeric buffers

di[splay] s[creens]

Display the filenames of all backgrounded windows

Edit filename

Edit filename in a new window

Edit /tmp

Create a new window editing an empty buffer; /tmp is interpreted specially to create a new temporary file

fg filename

Uncover filename into the current window

Fg filename

Uncover filename in a new window; the current window is split

Next

Edit the next file in the argument list in a new window

Previous

Edit the previous file in the argument list in a new window

resize ±nrows

Increase or decrease the size of the current window by nrows rows

Tag tagstring

Edit the file containing tagstring in a new window

The ^W command cycles between windows, top to bottom. The :q and ZZ commands exit the current window.

You may have multiple windows ...

Get vi and Vim Editors Pocket Reference, 2nd 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.