Vim is a text editor developed from vi. Its convenient programming functions such as code completion, compilation and error jump are especially rich and widely used in programmers

The Vim editor comes in three modes

  1. Command mode: Files cannot be edited in this state
  2. Edit mode: Edit can be done in this state
  3. Last line mode: Used for operations such as saving exit

These three modes can be switched arbitrarily

If it were a front end, these commands would have been sufficient 🤪

Vim file: If the file exists, open the file. If the file does not exist, create and open the file. I: Vim enters the "command mode" by default. At this time, you need to press I to enter the edit (insert) mode before editing. I: insert content before the cursor a: after the cursor insert content o: the next line insert content I: insert content at the beginning of a: line not insert content o: find a row insert content u: cancel v: multiple lines selected, the cursor location v: multiple lines selected, the whole row will be selected to x: delete the current cursor, forward to remove x: Delete current cursor, delete backward :w: save :q: exit :x: save and exit :q! : Forced exit Do not save :wq: Save and exit >> : Move code to the right << : Move code to the left R: Replace one character R: Replace all characters P: Paste ESC: Go into command mode DD: Delete/Cut the line where the cursor is 2DD: Delete two lines D: Start with the cursor and cut all following D0: Starting with the cursor, cut forward Shift + ZZ: equivalent to wq :wq: forced to write to the file and exit. Force a write even if the file has not been modified, and update the modification time of the file. : X: Write to the file and exit. Write only when the file is modified, and update the file modification time, otherwise the file modification time is not updated. Ctrl + R: Undo CRTL + F: Next Page CRTL + B: Previous Page Ctrl + D: Turn Half Page Ctrl + U: Turn Half Page 20G: Skip to Line 20G: Go Back to Last Line GG: Go Back to Beginning Line HJKL: Move the cursor, corresponding to bottom left up right H M L: move the cursor, corresponding to top, middle, bottom yy: copy the cursor on the line 4yy: copy 4 lines, nyy copy n lines

More reference

The Vim editor often uses command collation