Vim Editor
- Commands commonly used in the Vim editor are stored in the ~/.viminfo file
- There are 3 modes in the VIM Editor: Command mode, last line mode, and input mode, and three modes are converted as shown:
- Vim file name # Edit a file, the default will go directly into the command mode, if the file does not exist, it will be created automatically, and directly into
- Command mode, you can search for files, copy, paste, cut (delete) and other operations
- The operation in command mode is as follows:
- DD--Cut (delete) the contents of the line where the cursor is located
- 5DD--Cut (delete) 5 lines below the line of the cursor, including the cursor in the row
- YY--Copy the contents of the line where the cursor is located
- 5yy--5 lines below the line where the cursor is located, including the cursor in the row
- P-Pastes the cut or copied content to the next line in the row where the cursor is located
- U--undo the operation, click, undo the last action, press twice, undo the last action, ... until you get back to the initial state of the entry, then you will see the following information in the lower left corner of the document:
- /search Content-Specify content to search, search results, press "n" key or "n" key, you can switch between multiple results, "n" Key Down, "n" key up switch
- Shift+g--Jump to the last line
- GG--Jump to the first line?
- The command mode is the bridge between the input mode and the last line mode, that is, the input mode cannot be converted directly to the last line mode, and must first enter the command mode.
- In command mode, press any key in "A, I, O" to enter the input mode
- A--start editing at the next character at the cursor position
- I--start editing at the cursor position
- O--Create a new blank line under the cursor line to start editing
- In input mode, normal editing of text content can be done
- In input mode, press "ESC" key to return to command mode
- In command mode, press "SHIFT +;" Key to enter the last line mode
- The operation in the last row mode is as follows
- : W--Save
- : Q--Exit
- : Wq--Save and exit
- : q! --Forced exit
- : wq! --Force Save and exit
- : Set Nu--Show line number
- : $--? Skip to last row
- : 1--? jump to the first line
- : number--jumps to the specified line?
- In the last line mode, press the "ESC" key to return to the command mode
19th. How to use the VIM editor