S5 version | Table of Contents (frame/ no frame) |
(22) The vi editor |
Vi has modes. Insert mode and command mode. When you first enter vi you are in command mode and anything you
type will be interpreted as a command. This of this as selecting actions from the menus in MS Word.
Vi needs to be able to address the terminal window you are working in, so the setting of the $TERM variable
is important. Some systems get confused by resizing the terminal window while vi is running.
When you are in command mode many commands which affect more than one line of the file are prefaced with a ":".
An example is :w
which writes out or saves the current file.
When you are in insert mode you can type in text, when you are in command mode you can issue commands to vi
(search for a string, save the file ...).
Basic vi commands:
vi
file_name
or vi
view
file_name
:w!
.
<esc>
ZZ
:set showmode
:q!
slide23.src last modified Jan 31, 2011 | Introduction | Table of Contents (frame/no frame) |
Printable (single file) |
© Dartmouth College |