vi is Unix's omnipresent, ubiquitous, cryptic command-line text editor.
There are two vi modes: Command mode and Insert mode. Table A.5 shows the commands that invoke Insert mode. Once you are in Insert mode, you get back to Command mode by pressing the Escape key.
vi Insert Commands | |
---|---|
Insert Command | Meaning |
a | Append after the cursor |
A | Append at the end of the line |
c | Begin change operation |
C | Change to the end of the line |
i | Insert before the cursor |
I | Insert at the beginning of the line |
o | Start a blank line below the current line |
O | Start a blank line above the current line |
R | Begin overwriting text |
s | Substitute a character |
S | Substitute entire line |
The normal cursor keys are not used to move around in vi. Table A.6 shows some vi movement commands.
Some vi Movement Commands | |
---|---|
Movement Command | Description |
h,j,k,l | Move left, down, up, and right (vi's cursor keys) |
Spacebar | Move right |
w,W,b,B | Go forward or backward by a word |
e,E | Go to the end of the word |
) | Go to the beginning of the next sentence |
( | Go to the beginning of the current sentence |
0 | Go to the first position in the current line |
$ | Go to the end of the current line |
/text | Search forward for text |
?text | Search backward for text |
Table A.7 shows some vi text editing commands.
Some vi Text Editing Commands | |
---|---|
Command | Meaning |
cw | Change the word |
cc | Change the line |
C | Change the text from the current position to the end of the line |
dd | Delete the current line |
D | Delete the remainder of the line |
dw | Delete the word |
x | Delete the current character |
X | Delete the previous character |
3.144.89.2