How to move the cursor |
H or the left arrow (←) |
Move a character to the left |
J or the down arrow (arrow) |
Move the cursor down a character |
K or the up arrow (arrow) |
Move the cursor one character up |
L or right arrow (→) |
Move the cursor one character to the right |
If you place your right hand on the keyboard, you will find that hjkl is arranged together, so you can use these four buttons to move the cursor. If you want to move multiple times, for example, move 30 rows down, you can use a combination of "30j" or "30 Gbit/s", that is, after adding the number of times (number) You want to move, press the action! |
[Ctrl] + [f] |
The screen moves one Page Down, which is equivalent to a [Page Down] button (commonly used) |
[Ctrl] + [B] |
The screen moves one Page Up, which is equivalent to a [Page Up] button (commonly used) |
[Ctrl] + [d] |
Move half of the screen down |
[Ctrl] + [u] |
Move half of the screen "up" |
+ |
Move the cursor to the next column with a non-space character |
- |
Move the cursor to the previous column of a non-space character |
N <space> |
That n represents a number, for example, 20. Press the number and then press the Space key. The cursor will move the n characters in the line to the right. For example, if the value is 20 <space>, the cursor moves the distance of 20 characters to the backend. |
0 or function key [Home] |
This is the number "0": Move to the top character of this line (commonly used) |
$ Or function key [End] |
Move to the last character of this line (commonly used) |
H |
Move the cursor to the first character in the line at the top of the screen |
M |
Move the cursor to the first character in the middle of the screen |
L |
Move the cursor to the first character in the row at the bottom of the screen |
G |
Move to the last line of the file (frequently used) |
NG |
N is a number. The Nth row of the file. For example, 20 GB will be moved to the 20th rows of this file (can be used with: set nu) |
Gg |
Moving to the first line of this file is equivalent to 1 GB! (Common) |
N <Enter> |
N is a number. Move the cursor down n rows (commonly used) |
Search and replace |
/Word |
Search for a string named word under the cursor. For example, to search for the vbird string in the file, enter/vbird! (Common) |
? Word |
Search for a string named word over the cursor. |
N |
This n is an English button. Indicates "repeat the previous search action 』. For example, if we just run/vbird to search for the vbird string, press n to continue searching for the next string named vbird. If it is execution? Press n to search for a string named vbird! |
N |
This N is an English button. Opposite to n, This is the previous search action for "reverse. For example, after/vbird, press N to search for vbird "up. |
It is very helpful to use/word with n and N! You can repeat to find some keywords you are searching! |
: N1, n2s/word1/word2/g |
N1 and n2 are numbers. Search for the word1 string between line n1 and line n2 and replace it with word2! For example, if you search for vbird between 100 and 200 and replace it with VBIRD: ": 100,200 s/vbird/VBIRD/g 』. (Common) |
: 1, $ s/word1/word2/g |
Search for the word1 string from the first row to the last row and replace it with word2! (Common) |
: 1, $ s/word1/word2/gc |
Search for the word1 string from the first row to the last row and replace it with word2! The prompt characters are displayed before replacement to confirm (confirm) whether to replace! (Common) |
Delete, copy, and attach |
X, X |
In a row, x deletes a character (equivalent to a [del] Key), and X deletes a character (equivalent to a [backspace] or a backspace key) (commonly used) |
Nx |
N is a number and n characters are deleted consecutively. For example, I want to delete 10 characters in a row, "10x 』. |
Dd |
Delete the entire column of the cursor (commonly used) |
Ndd |
N is a number. Delete the n-down column where the cursor is located. For example, 20 dd deletes 20 columns (commonly used) |
D1G |
Delete all data from the cursor to the first row |
DG |
Delete all data from the cursor to the last row |
D $ |
Delete the cursor to the last character of the row |
D0 |
That is the number 0, where the cursor is deleted, to the beginning of the row. |
Yy |
Copy the row of the cursor (commonly used) |
Nyy |
N is a number. Copy the n-down column where the cursor is located. For example, if 20yy is used, 20 columns are copied (commonly used) |
Y1G |
Copy all data from the cursor column to the first column |
YG |
Copy all data from the column where the cursor is located to the last column |
Y0 |
Copy the character of the cursor to all data at the beginning of the row. |
Y $ |
Copy all data from the character with the cursor to the end of the row. |
P, P |
P: to paste the copied data to the next row of the cursor, P is to paste the row on the cursor! For example, I have already copied 10 rows of data with the cursor in 20th rows. After you press p, the 10 rows of data will be pasted after the original 20 rows, that is, from 21 rows. But what if I press P? Then the original 20th rows will be pushed to 30 rows. (Common) |
J |
Combine the cursor column with the data in the next column into the same column |
C |
Multiple data records are deleted repeatedly, for example, 10 rows are deleted down and [10cj] |
U |
Restore the previous action. (Common) |
[Ctrl] + r |
Redo the previous action. (Common) |
This u and [Ctrl] + r are very common commands! One is restoration, the other is redo once ~ With these two buttons, you can edit them! Happy! |
. |
Don't doubt! This is the decimal point! It means to repeat the previous action. If you want to repeat the deletion, repeat, and so on, just press the decimal point! (Common) |