Learning the vi Editor

Learning the vi EditorSearch this book
Previous: Scope of This Handbook Preface Next: What You Need to Know Before Starting
 

The Nutshell Format

The philosophy of this handbook is to give you a good overview of what we feel are vi survival materials for the new user. Learning a new editor, especially an editor with all the options of vi, can seem like an overwhelming task. We have made an effort to present basic concepts and commands in an easy-to-read and logical manner. The following sections describe the conventions used in this handbook.

Discussion of vi Commands

[i] A picture of a keyboard button, like the one on the left, marks the main discussion of that particular keyboard command or of related commands. You will find a brief introduction to the main concept before it is broken down into task-oriented sections. The appropriate command to use in each case is then presented, along with a description of the command and the proper syntax for using it.

Typefaces

In syntax descriptions and examples, what you would actually type is shown in the Courier font, as are all command names. Variables (which you would not type literally, but would replace with an actual value when you typed the command) are shown in Courier italics. Brackets indicate that a variable is optional. For example, in the syntax line:

vi [filename]

filename would be replaced by an actual filename. The brackets indicate that the vi command can be invoked without specifying a filename at all. The brackets themselves are not typed.

Certain examples show the effect of commands typed at the UNIX shell prompt. In such examples, what you actually type is shown in Courier Bold to distinguish it from the system response. For example:

$ ls
ch01 ch02 ch03 ch04

In examples, italics are used to indicate a comment which is not to be typed. Otherwise, italics are used for emphasizing special terms and for the names of files.

Keystrokes

Special keystrokes are shown in a box. For example:

iWith a [ESC]

Throughout this handbook, you will also find columns of vi commands and their results:

KeystrokesResults
ZZ
"practice" [New file] 6 lines, 320 characters

Give the write and save command, ZZ. Your file is saved as a regular UNIX file.

In the example above, the command ZZ is shown in the left column. In the window to the right is a line (or several lines) of the screen that show the result of the command. Cursor position is shown by an underscore. In this instance, since ZZ saves and writes the file, you see the status line shown when a file is written; cursor position is not shown. Below the window is an explanation of the command and its result.

Sometimes vi commands are issued by pressing the [CTRL] key and another key simultaneously. In the text, this combination keystroke is written within a box (for example, [CTRL-G]). In examples, it is written by preceding the name of the key with a caret (^). For example, ^G means to hold down [CTRL] while pressing the g key.

Problem Checklist


Previous: Scope of This Handbook Learning the vi EditorNext: What You Need to Know Before Starting
Scope of This Handbook Book IndexWhat You Need to Know Before Starting

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System