vim text editor
1. Command line mode
Execute vim internal commands, text editing
Basic commands:
- x : Delete the character at the cursor position each time it is pressed
- #x: means to delete # (number) characters after the cursor
- X: Each time you press, delete a character before the cursor
- #X: means to delete the # characters in front of the cursor
- dd: cut the line where the cursor is located
- #dd: start cutting the line where the cursor is located # line
- yy: Copy the line where the cursor is located to the buffer
- p: Paste all characters in the buffer to the cursor position
- r: replace the character at the cursor position
- u: restore the last operation
- hjkl: the cursor moves, h left j down k up l right
2. Insert mode
text input, text editing
In command line mode, use i, o, a and other commands to enter insert mode, and esc to exit
3. Last line mode
Find, replace, save, etc.
Enter colon (:) in command line mode to enter last line mode
- List line numbers: set nu
- Cancel line number: set nonu
- Skip to #line :#
- Find characters: / Content Find from front to back : ? Content Search from back to front Press n to display the next search content
- save: w
- quit: q
- Force quit: q!