Most of the commands require just a simple letter or two, but be careful to note that vi is case sensitive, and capital letters do different things from lower case letters. It is not necessary to learn all of these commands, but eventually they will become second nature. The basic operations needed to create a file are related to each of those modes, so let's look at them separately.
Letter | Action |
---|---|
Starts inserting in front of the current cursor position | |
Starts adding at the front of the line | |
Starts adding after the cursor | |
Starts adding at the end of the line | |
Starts opening a new line underneath the cursor | |
Starts opening a line above the cursor. | |
Gets out of Insert Mode |
Letter | Simple Cursor Movement | |
---|---|---|
Moves cursor left one space | Note: the Arrow keys do work locally, but sometimes mess up over a network. | |
Moves cursor down one line | ||
Moves cursor up one line | ||
Moves cursor right one space | ||
| ||
Moves the cursor a full word at a time to the right | ||
Moves the cursor back to the left a word at a time | ||
Moves the cursor to the front of a line | ||
Moves the cursor to the end of a line | ||
Moves the cursor forward a full page of text at a time | ||
Moves the cursor backward a full page of text at a time | ||
| ||
Deletes the character under the cursor | ||
Deletes the line where the cursor is located (type d twice!) | ||
Delete n consecutive lines ( n is an integer) | ||
Replaces the character under the cursor with the next thing typed | ||
Joins current line with the one below (Capital J!) | ||
Undoes the last edit operation | ||
Redo (Undoes the last undo operation) | ||
| ||
Copies or yanks a line ( 5yy yanks 5 lines) | ||
Puts the yanked text on the line below the cursor (lower case p) | ||
Puts the yanked text above the current line (capital P) | ||
Note: If vi is already in the input mode, text from that or another window may be highlited using the left mouse button, and copied into place by pressing the middle mouse button. |
Letter | Action |
---|---|
reads a file from disk into the vi editor | |
writes current file to disk | |
writes the file and quits vi | |
quits without writing (useful if you've messed up!) |