ex Command-Line Options
While most people know ex commands only by their use within vi, the editor also exists as a separate program and can be invoked from the shell (for instance, to edit files as part of a script). Within ex, you can enter the vi or visual command to start vi. Similarly, within vi, you can enter Q to quit the vi editor and enter ex.
If you invoke ex as a standalone editor, you can include the following options:
- +[
num
] Start editing at line number
num
, or the last line of the file ifnum
is omitted.- +/
pattern
Start editing at the first line matching
pattern
. (Fails if nowrapscan is set in your .exrc startup file.)- -c
command
Run the given ex
command
at startup. Only one -c option is permitted. An older form of this option, +command
, is still supported.- -e
Run as a line editor rather than full-screen vi mode (default).
- -l
Enter LISP mode for running LISP programs (not supported in all versions).
- -r [
file
] Recover and resume editing on
file
after an aborted editor session or system crash. Without file, list files available for recovery.- -s
Silent; don’t display prompts. Useful when running a script. This behavior also can be set through the older - option.
- -t
tag
Edit the file containing
tag
and position the cursor at its definition.- -v
Run in full-screen mode (same as invoking vi).
- -w
rows
Set the window size so
rows
lines at a time are displayed; useful when editing by a slow dial-up line.- -x
Prompt for a key that tries to encrypt or decrypt a file using crypt (not supported ...
Get Mac OS X Tiger in a Nutshell 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.