Section 7.3. ex Command-Line Options


7.3. 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 if num 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 in all versions).



-C

Same as -x , but assume the file is encrypted already (not supported in all versions).



-L

List files that were saved due to an editor or system crash (not supported in all versions).



-R

Edit files read-only; don't allow changes to be saved.

You can exit ex in several ways:



:x

Exit (save changes and quit).



:q!

Quit without saving changes.



:vi

Enter the vi editor.



MAC OS X Tiger in a Nutshell
Mac OS X Tiger in a Nutshell: A Desktop Quick Reference (In a Nutshell (OReilly))
ISBN: 0596009437
EAN: 2147483647
Year: 2003
Pages: 130

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net