You can learn Vim step by step based on the solution example-the following comments are drunk and explained by yourself based on the illustration and your own practices. The capabilities are limited and errors are incorrect. you can remind me to correct them. Thank you ~ Whole English whole Chinese edition thanks to FDL translation. The following are the basic steps for learning these basic Vim commands. After learning, you can follow the instructions for further study and use !!
Step 1 Note 1:
1) h j k l is the optical marking key, respectively, top left, bottom right
2) The I insert key enters the editing mode, and the ESC key exits to the normal mode.
3) x deletes the character of the current cursor, and X deletes the character before the current cursor.
4) A adds text at the end of a row, and a adds text after the current cursor
5) U executes the Undo operation. CTRL + R indicates redo
6) jump from 0 to the beginning of the line, and $ to the end of the line ^ to the beginning of the line (similar to the regular expression $ and ^)
7) w B E move a word (all characters or symbols)
8) w B E move a word (separated by spaces)
9) r enters the insert and edit mode and overwrites the edited location.
10): W save: Q Exit: Q! Force exit Step 2 Note 2:
1) f moves the cursor from the current position to the right of the character followed by the next F, containing the specified character. F is the opposite of the previous character and must be operated with the operator.
2) T and T are similar to F and F, but they stop until the left of the specified characters, that is, they do not contain the specified characters.
3) D. The delete operation works with the preceding w f t. For example, "DW" deletes the next word and "DF-" deletes the character from the current position "-", "-", "DT-" are not retained until "-" but "-" is retained "-"
4) C. Delete and enter the editing mode (similar to the combination of D and I). It can also be combined with motion such as f t w.
5) j k can be combined with C and D to delete all rows at the end or at the beginning.
6). You can repeat all the last edits. Note that the last edits are repeated in normal mode.
7) the operation and motion can be combined with numbers. "d2w" deletes the last two words word "d2t," deletes the first word that knows this line ","
8) CC and DD Delete the current row
9) V enters the visual mode
Step 3 Note 3:
1) y is followed by any motion to execute the copy operation.
2) P (Paster) paste. If it is copied as a character, paste it to the right, and paste it as a line below
3) P is the same as P operation, but the paste direction is the opposite, on the left or above
4) copy the current row by YY
5) y can also work in visual mode. At the same time, D, C, X .. text deletion operations will also copy the deleted content (note this)
6) "and a-Z characters, if you select a register for temporary storage before the copy/delete/paste command
7) The A-Z register before the copy/delete means that the overlay copy, that is, the content of multiple copy operations will be added up
8) "* operation or" + operation: select the system clipboard
9) O enters the insert mode for a new row under the current row. The O operation is similar to O, but the new row is added to Step 4. NOTE 4:
1)/is the basic search motion, which can be used in combination with operation or separately, to directly find and match the regular expression following
2 )? Same as/, but opposite to backward,/direction forward
3) n repeats the last query direction, and n repeats the opposite direction of the last query.
4) * and # Find the same object with the current cursor. The former is forward and the latter is backward. The two are only valid under Vim (Vi not support) Step 5 comment 5:
1) The M operation is followed by a-Z character to set a mark
2) 'followed by the-Z character, which can be indicated by this character
3) 'and a character can go to the first non-null position of the row
4) The A-Z is marked as a-Z globally visible only within each Buffer
5) '. indicates the last modification.
6) q followed by a-Z is used to record macros
7) @ replay macro is used followed by a character. @ replay the last macro Step 6. Note 6:
1) % exists between (and) [and ].
2) Jump h m L to the top, middle, and bottom of the screen.
3) g jumps to the end of the file, and G goes to the specified row with the row number.
4)-Or + jump directly to the previous or next line
5) Skip K to help
6) (and) Jump to the beginning and end of the current sentence
7) {And} jump to the first blank line or the last blank line
8) [[jump to the position where the first 0th columns are {(must be {0th columns)
9)] Jump to the location where the next 0th columns are} Step 7 Note 7:
1) J connects the current row and the next row in the normal mode, or all rows in the but Mode
2) R is followed by any character to replace the current character
3) C is short for C $, indicating to delete the current position to the end of the row and enter the insert mode.
4) d is short for d $, indicating that the current row ends after the deletion.
5) y is short for yy. Copy the entire row.
6) S: Delete the character of the current cursor and enter the insert mode.
7) s clears the current row and enters the insert mode.
8)> and a motion indicates indentation of one or more rows.
9) <and a motion indicates not indent
10) = and a motion to re-format text
11)> <and = work in visible mode and can be repeated. For example,> indicates indent the entire row.
Vim still has many things to learn. The functions are so powerful ~!