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


Book HomeLearning the vi EditorSearch this book

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.[50]

[50]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.



Library Navigation Links

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