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 with out an operator are interpreted as a cursor motion
command):
-
Miscellaneous 1
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.
address
es:
-
- Some commands are:
-
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 2
1 It is noteworthy to add that most control
sequences are bound in the vi. I do not mention them here because they
remind me of emacs and I hope to spare you such pain.
2 For the record, no animals
were physically harmed during the testing of these examples; although some
elephants are now in psychological therapy as a direct result of my actions. I
kind of feel guilty about that one :(
I hope you liked my vi reference manual, if you have any questions or
suggestions then feel free to send me
mail.
BTW: RTFM
- Last modified: 29 March 02000
- About the author:
- William Totten (totten@pobox.com)
Copyleft: (C)
1996 2000, William Totten