Basic operations in vi



Last revision August 2, 2004

Table of Contents:
  1. Editor choices on Unix
  2. Characteristics, advantages, and disadvantages of vi
  3. Basic text editing operations in vi
  4. Regular expressions
  5. File searching with grep
  6. More about regular expressions
  7. Intermediate text editing with vi
  8. Vi Quick Reference

These pages follow the order of presentation in An Introduction to Display Editing with Vi, revised by Kroeger.

Notations in these pages

Most vi commands are one or two keystrokes, without pressing the RETURN key. When the RETURN key is actually needed, will be explicitly represented by <CR>. These keystrokes do not show on the screen. For example, the G keystroke will move you to the bottom of the file, but you will never see the letter G appear anywhere on the screen.

Many commands use a combination of the CONTROL key and one of the normal keys. This combination is represented in these pages by CTRL- followed by the key letter name, shown in uppercase, for example, CTRL-U. This means to hold down the CONTROL key like a shift key while you press the U key. Other books and references may show CONTROL key combinations using the ^ symbol, for example, ^U to stand for the combination of the CONTROL and U keys. Although these notations show the uppercase version of the key to be pressed, you are not actually trying to enter an uppercase letter. Do not press the SHIFT key at the same time.

Other commands begin with a colon character. These commands usually set some parameter or make a global change. They must be ended by pressing the RETURN key. Search patterns (beginning with a / or ?) must also be ended by pressing the RETURN key.

Comments or Questions?