Detailed reference http://www.runoob.com/linux/linux-vim.html
I insert
I Line Header Insertion
A Line End Insertion
FN +←, beginning of the line
FN +→, end of line
fn +↑, PAGE up
fn +↓, PAGE Down
[Ctrl] + [f] |
Screen "Down" to move one page, equivalent to [PAGE DOWN] key (common) |
[Ctrl] + [b] |
Screen "Up" to move one page, equivalent to [PAGE UP] key (common) |
Move down 30 lines, you can use the "30j" or "30↓" combination of keys, that is, plus the number of times you want to do (number), press the action!
G |
Move to the last line of this file (common) |
NG |
N is a number. Move to the nth row of this file. For example 20G moves to line 20th of this file (mates: Set Nu) |
Gg |
Move to the first line of this file, equivalent to 1G Ah! Common |
N<enter> |
N is a number. Move the cursor down n rows (common) |
N<space> |
That n means "number", for example 20. When you press the number and then press the SPACEBAR, the cursor moves the n characters of the line to the right. For example 20<space>, the cursor moves 20 character distances to the back. |
0 or function key [Home] |
This is the number "0": Move to the front of the line prompt (common) |
$ or Function key [End] |
Move to the last face of this line prompt (common) |
X Remove one character backwards
Nx |
N is a number that continuously deletes n characters backwards. For example, I want to delete the 10 characters consecutively, "10x". |
Dd |
Delete the entire row where the cursor is located (common) |
Ndd |
N is a number. Delete the down n rows where the cursor is located, for example, 20DD to delete 20 rows (common) |
d1g |
Remove all data from the first row of the cursor |
Dg |
Delete all data from the last row of the cursor |
d$ |
Delete the last character of the row where the cursor is located |
D0 |
That is 0 of the number, delete the cursor at the top of the line, and the first character |
Yy |
The row where the cursor is copied (common) |
Nyy |
N is a number. The next n rows where the cursor is copied, for example, 20yy copies 20 rows (common) |
[Ctrl]+r |
Redo the last action. Common |
P, p |
p to paste the copied data on the next line of the cursor, and p for a row on the cursor! For example, I currently have the cursor on line 20th and have copied 10 rows of data. When P is pressed, the 10 rows of data will be affixed to the original 20 lines, i.e. 21 lines. But what if we press P? Then the original 20th Guild was pushed into 30 rows. Common |
I, I |
Enter insert mode (insert modes): I is "inserting from the current cursor," and I is "inserting at the first non-whitespace space at the current line." ( Common) |
A, a |
Enter insert mode (insert modes): A is "insert from the next character where the cursor is currently located" and A is "start at the last character of the line where the cursor is located." ( Common) |
O, O |
Enter insert mode (insert modes): This is the case of the English letter O. o Insert a new line at the next line where the cursor is currently located; o Insert a new line on the previous line where the cursor is currently located! ( Common) |
R, R |
Enter Replace mode: R will only replace the one character where the cursor is located, and R will always replace the text of the cursor until ESC is pressed; ( common) |
: w [filename] |
Save edited data to another file (similar to save new file) |
: R [FileName] |
In the edited data, read the data from another file. The file "filename" will be added to the cursor row after the |
: n1,n2 w [filename] |
Store the contents of N1 to N2 into the filename file. |
:! Command |
Temporarily leave VI to command line mode to perform command display results! For example 『:! Ls/home "You can see in VI the file information under/home with LS output! |
CentOS Note-vim