One or two modes
There are two main modes of Vim, Normal mode and insert mode.
Normal mode---insert mode can be edited like a normal editor by pressing I into insert mode
Insert mode--Normal mode by pressing ESC into normal mode, you can do a lot of things in normal mode
Ii. Common Commands
The common commands listed below are all used in normal mode
- I: Enter insert mode, press ESC to return to normal mode
- X: Delete the character where the cursor is located
- DD: Delete the current line, and put the deleted content into the Clipboard, you can directly paste, in fact, the equivalent of cutting
- YY: Copy when moving forward
- P: Paste after the current line
- P: Paste before the current line
- A: Insert after cursor
- o: Insert a new row after the current line
- O: Insert a new row after the current line
- CW: Remove the character from the cursor to the end of the word
- 0: Jumps to the first column of the row where the cursor is located
- ^: Jump to the first non-null character of the bank
- $: Jump to the end of the bank
- G_: Jumps to the last non-null character of the bank
- /pattern: Searching for pattern
- U: Cancel
- Ctrl-r: Recovery
- : E < file path >: Open
- : w: Save
- : SaveAs < file path >: Save to this file
- : Wq: Save and exit
- : q! : Exit but do not save
Vim Common operation