Using the Vim Editor
"Vim is a highly configurable text editor built to enable efficient
text editing. It is an improved version of the vi editor distributed
with most UNIX systems.
Vim is often called a "programmer's editor," and so useful for programming
that many consider it an entire IDE . It's not just for programmers,
though. Vim is perfect for all kinds of text editing, from composing
email to editing configuration files." ( the official Vim website).
In most Linux distributions, the command "vi" is actually an alias to
Vim.
There are three basic modes of Vim: Command Mode
This is the default when you enterVvim. In command mode, most letters,
or short sequences of letters, that you type will be interpreted as commands, without
explicitly pressing Enter . If you press Esc when
you're in command mode, your terminal may beep at you. This is a very
good way to tell when you're in command mode.
Insert Mode
In insert mode, whatever you type is inserted in the file at the cursor
position. Type a (lowercase letter a, for append )
to enter insert mode from command mode; press Esc to
end insert mode, and return to command mode.
Line Mode
Use line mode to enter line oriented commands. In command mode, type
a colon ( : ). Your cursor moves to the bottom of the
screen, by a colon prompt. Type a line mode command, then press Enter .
Any sensible command from the UNIX line editor ex will work, and a few
are good to know about. These commands are indicated in this handout
by a colon in front of the command. Each time you use a line mode command,
you must type a colon to enter line mode, then type the command by the
colon prompt at the bottom of the screen, then press Enter when
you finish typing the command. (The search commands starting with / and ? work
similarly).
Click HERE to
download a vi quick reference card. Since Vim is based on vi, this
reference is still applicable.
|