Learning the vi Editor

Learning the vi EditorSearch this book
Previous: 9.1 Author and HistoryChapter 9
nvi -- New vi
Next: 9.3 Online Help and Other Documentation
 

9.2 Important Command-Line Arguments

In a pure BSD environment, nvi is installed under the names ex, vi, and view. Typically they are all links to the same executable, and nvi looks at how it is invoked to determine its behavior. (UNIX vi works this way too.) It allows the Q command from vi mode to switch into ex mode. The view variant is like vi, except that the readonly option is set initially.

nvi has a number of command-line options. The most useful are described here:

-c command

Execute command upon startup. This is the POSIX version of the historical +command syntax, but nvi is not limited to positioning commands. (The old syntax is also accepted.)

-F

Don't copy the entire file when starting to edit. This may be faster, but allows the possibility of someone else changing the file while you're working on it.

-R

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

-r

Recover specified files, or if no files are listed on the command line, list all the files that can be recovered.

-S

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

[3] As with anything labelled "secure," blind trust is usually inappropriate. Keith Bostic says, though, that you can trust nvi's secure option.

-s

Enter batch (script) mode. This is only for ex, and is intended for running editing scripts. Prompts and non-error messages are disabled. This is the POSIX version of the historic "-" argument; nvi supports both.

-t tag

Start editing at the specified tag.

-w size

Set the initial window size to size lines.


Previous: 9.1 Author and HistoryLearning the vi EditorNext: 9.3 Online Help and Other Documentation
9.1 Author and HistoryBook Index9.3 Online Help and Other Documentation

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