User
Manuals
Drill
Fundamentals
Drill
Parameter
Part
Programs
Unix
Help For UCS
Basic Unix Commands
Unix VI Editor Commands
Machine
Setup Commands
|
UNIX VI EDITOR COMMANDS
Note: vi editor commands do not require an Enter key
to be executed except where noted.
UNIX has an editor which can be used to edit files in UNIX when needed
called the vi editor. Some basic commands for the vi editor are as
follows:
vi
This command is used to open a file in the editor. It can not be
used without defining a file name for a file in your current path
or a path and filename for a file in another directory.
Example:
# vi /ExcCnc.cmd
# vi /usr/cnc/M0/sys/ExcCnc.cmd
i
This command is used to insert data into the middle of the file being edited.
Once you have used the vi command to open the file you can use the arrow keys
to move around the file and select the location where you want to insert the
data. Then hit the Esc key followed by the "i" key. Any keystrokes
that follow with be inserted into the file.
Example:
( Esc )i
a
This command is used to add data anywhere in a file being edited. Once you have
used the vi command to open the file you can use the arrow keys to move around
the file and select the line you wish to add data to or go to the last line to
add additional lines of data. Use the arrow keys to position the cursor where
you want to add data then hit the Esc key followed by the "a" key.
Any keystrokes that follow will be added after the cursor location.
Example:
( Esc )a
d
This command is used to delete characters from a file being edited. Use the arrow
key to position the cursor directly to the right of the data you want to delete.
Next, hit the Esc key followed by the "d" key then each time you hit
the "d" key an additional character will be deleted from in front of
the cursor until the Esc key is used again.
Example:
( Esc )d
x
This command is used to delete characters from a file being edited. Use the arrow
key to position the cursor directly over the character you want to delete, hit
the Esc key followed by the "x" key, each time you hit the "x" key
an additional character will be deleted from under the cursor until the Esc key
is used again.
Example:
( Esc )x
:q!
This command is used to quit the vi editor without saving any changes made to
the file. This command can be used at any time while the editor is open. To execute
the command you must hit the Esc key followed by ":q!" And the Enter
key.
Example:
# ( Esc ):q!( Enter )
:wq!
This command is used to save changes and quit out of the vi editor. This command
can be used any time the vi editor is open. To execute the command you must hit
the Esc key followed by the ":wq!" An Enter keys.
Example:
# ( Esc ):wq!( Enter ).
|