next up previous contents
Next: Cursor and Display Control Up: Guide to VI and Previous: Basic Concepts and Terminology

Starting and Ending a Session


vi/ex start - end - switch
vi filename open a file with name filename in vi mode
view filename open a file with name filename readonly
ex filename open a file with name filename in ex mode
ex -R filename open a file with name filename readonly
vi -r filename recover editor file after a system crash in vi mode
ex -r filename recover editor file after a system crash in ex mode
~ indicate blank lines on screen (not a command)
ZZ :x :wq<ret> write contents to file and exit; if file is readonly,
  command aborts, we can save file with new name
  or force write with w! using the force flag !
:q<ret> :q!<ret> quit session without storing text
:w<ret> save text without exiting
<ctrl>L refresh screen
Q switch to ex
:vi switch to vi
n.b. - To force command execution append ! to command code
n.b. - Use ZZ with care when writing part of file with w


The vi calling sequence is:

vi [ -t tag ] [ +command ] [ -l ] [ -r ] [ -wn ] name...

The meaning of the options is:


-t tag Specifies a list of tag files. The tag files are preceded by a
  backslash ( $\backslash$) and are separated by spaces. The tag option should
  always be the first entry.
+command Tells the editor to begin by executing the specified command. A useful
  example would be +/pattern to search for a pattern.
  Command may consist of several commands seperated by | (vertical bar)
-l Sets the showmatch and lisp options to edit LISP code.
-r name Retrieves the last saved version of the named file in the event of
  an editor or system crash. If no file is specified, a list of saved
  files is produced.
-wn Sets the default window size to n. This option is useful for starting
  in a small window on dialups.


next up previous contents
Next: Cursor and Display Control Up: Guide to VI and Previous: Basic Concepts and Terminology
Marisa Luvisetto
2000-12-20