vi (vim) has 2 main modes, command mode and insert mode. In command mode, everything you type is a command, in insert mode what you type is written to the screen (file buffer). vi starts in command mode. The more complex commands start with : and appear at the bottom of the screen, you need to press ENTER to execute them.

Insert Mode

To enter insert mode you can press:

To exit insert mode you press ESCAPE

Command Mode

To move around in command mode you can use the arrow keys in modern vi implementation. Otherwise the keys to move around are:

Other useful movement commands

Some editing commands. They can be prepended by a number of times to repeat the command, i.e. 4dd will cut 4 lines.

File commands (remember to follow by ENTER)

Other miscelaneous commands

Miscelaneous commands

vi vs vim

If you decide to use plain vi (not vim) you'll lose many of the nice features.

NKB: Vi cheat sheet (last edited 2006-05-01 05:34:52 by IgnacioSolis)