|
: |
Enter the command mode. |
|
:w /path/file |
Save the file to the name & path specified. |
|
:q |
Quit vi, only if the file is unchanged. |
|
:q! |
Force quit from vi. |
|
:wq |
Save file & quit. |
|
[ESC] |
To leave the other modes & enter the edit mode. |
|
dd |
Delete the line being displayed by the cursor. |
|
10 dd |
Delete 10 lines beginning with the lines the cursor is on. (chose number as needed) |
|
u |
Undo last action. |
|
yy |
(Yank) Copy the cursor line into buffer. |
|
10 yy |
Copy 10 lines beginning at the cursor. (chose number as needed) |
|
[SHIFT] p |
Paste copied lines into the file at the point where the cursor is. |
|
p |
Paste to line under cursor. |
|
/search |
Search forwards through text for the word "search". |
|
?search |
Search backwards through text for the word "search". |
|
n |
Repeat the last search command. |
|
N |
Repeat the last search command in the other direction. |
|
^ |
Jump to the beginning of the line. |
|
$ |
Jump to the end of the line. |
|
[CTRL] u |
Page up. |
|
[CTRL] d |
Page down. |