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 ifnumis 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
commandat 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
fileafter 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
tagand position the cursor at its definition.- -v
Run in full-screen mode (same as invoking vi).
- -w
rows Set the window size so
rowslines 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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access