VI (Visual) Editor Reference manual
The vi is a text editor. It is small, powerful,
and standard on most UNIX systems. The vi often frustrates new
users with a unique distinction between its two modes: Command
Mode and Insert/Overtype Mode. This distinction,
although difficult to become accustomed to for many users, provides
great power and ability to the editor. Insert/Overtype Mode is
designed for inserting text only. All text manipulations and cursor
moving should be done from with in Command Mode.
Entering the vi
Insert/Overtype Mode
Insert/Overtype Mode is solely for entering text.
To leave one of these two modes press the [ESC] key.
if you wish to enter the ESC character or any other
control character while in insert mode: type
[CONTROL]-V and then the control sequence. The only
difference between Insert Mode and Overtype Mode is that characters
are placed in front of the text after the cursor in Insert Mode, where
as existing characters are overwritten in Overtype Mode.
Command Mode
Entering Insert Mode
vi Syntax
- vi commands follow the general form:
- n
operator
m object
- which means:
- execute
operator
n times on m
objects
. If n and/or m are
omitted, they default to 1.
- Operators which take objects are(if the operator is pressed twice
then the object is the current line)
-
#The operators <, >, and ! are line based so
the set of
objects
is diminished greatly.
- Operators which do not take objects:
-
- Objects (if given without an operator, these interpreted as a
cursor motion command):
-
Miscellaneous
ex Commands
ex syntax
- ex commands in the vi follow this general form:
- :
address
command
- which means:
- Execute command on specific lines obtained from the
address
part of the general form. If address
is omitted, current line is used. Keep in mind that the ex
is a line based editor, so all actions are line based.
- addresses:
-
- Some commands:
-
The vi environment variables
set
- You can customize your environment with this command by typing
set var=value
, this will set the specified
var
to value
for a scalar variable.
For boolean variables, use set var
to set and
set novar
to unset. You can see which variables
are set by just typing the set
by its self.
You can see a list of all variables by typing
set all
. Some environment variables are specific to
the ex editor and some are specific to the vi
editor. I have included both.
boolean variables:
scalar variables:
File Saving and Loading
Examples
vi commands:
ex commands:
Copyleft: (C) 1996 2000, William Totten
Fred Vetter