Novell LINUX ENTERPRISE SERVER 10 - INSTALLATION AND ADMINISTRATION 11-05-2007 Installation Manual page 377

Table of Contents

Advertisement

It is not possible to switch directly from insert mode to extended mode without first
switching to command mode.
vi, like other editors, has its own procedure for terminating the program. You cannot
terminate vi while in insert mode. First, exit insert mode by pressing Esc . Subsequently,
you have two options:
1. Exit without saving: To terminate the editor without saving the changes, enter : –
Q – ! in command mode. The exclamation mark (!) causes vi to ignore any changes.
2. Save and exit: There are several possibilities to save your changes and terminate
the editor. In command mode, use Shift + Z Shift + Z . To exit the program saving
all changes using the extended mode, enter : – W – Q . In extended mode, w stands
for write and q for quit.
17.4.2 vi in Action
vi can be used as a normal editor. In insert mode, enter text and delete text with the <—
and Del keys. Use the arrow keys to move the cursor.
However, these control keys often cause problems, because there are many terminal
types that use special key codes. This is where the command mode comes into play.
Press Esc to switch from insert mode to command mode. In command mode, move the
cursor with H , J , K , and L . The keys have the following functions:
H
Move one character to the left
J
Move one line down
K
Move one line up
L
Move one character to the right
The commands in command mode allow diverse variations. To execute a command
several times, simply enter the number of repetitions before entering the actual command.
For example, enter 5 L to move the cursor five characters to the right.
Working with the Shell
359

Advertisement

Table of Contents
loading

This manual is also suitable for:

Suse linux enterprise server 10

Table of Contents