Vim and vim
Vim-common sorting: 1.1 move the cursor
0 or home: Move to the beginning of the line (first line)
$ Or end: Move to the last character (end of line) of this line)
G: Move to the last row of the file.
NG: Row n of the object to be moved.
Gg: Move to the first line of the file, equivalent to 1G
N [Enter]: move the cursor down N rows
1.2 search and replace
/Word: Search down for a string named Word
? Word: search for a string named word
N: repeat the previous query action.
N: Repeat the previous action in the reverse direction.
: N1, n2/word1/word2/g: replace word1 between n1 and n2 with word2
: 1, $ s/word1/word2/g replace all word1 with word2
: % S/word1/word2/g replace all word1 with word2 (commonly used)
: S/word1/word2/g: replace word1 of the current row with word2
1.3 Delete, copy, and paste
Dd: Delete the entire row where the cursor is located.
Ndd: Delete the rows to which the cursor is located
Yy: copy the row where the cursor is located
Nyy: copy the n rows down the cursor
P: paste the copied content from the downstream.
U: reply to the previous operation (rollback)
1.4 Block Selection
V: select a character. The cursor is reversed (used to modify configuration files in batches)
For example, the configuration file copied from other places has an unordered indentation, for example:
First, enter the normal mode. Press "v selected code. The selected area will be reversed.
Then press "=", the format will be automatic
V: Select rows. The rows that the cursor passes are reversed.
[Crtl] + v: block selection. You can select a rectangle.
Y: copy the reverse IP address.
D: Delete the whitelist.