@@ The version of the system, although vim has improved a lot compared with vi, but the initial use will still be confused, I do not know how to operate, so learn vim must first pass 2 levels. The first level is to understand the design of vim. At the beginning of vim design, the entire text editor is completed with a keyboard instead of a mouse. Almost every key on the keyboard has a fixed usage, and the producer of vim wants the user to be in normal mode ( That is, the command mode, you can only enter the command) to complete most of the editing work, this mode is designed as the default mode, beginners open vim, if you directly input the word, the result will be dripping, this is because vim enters the user The word is understood as an order. The second level is the command off. vim has more than one hundred commands for editing. If you can use the vim commands, the editing speed is really much faster than the mouse, but it is also difficult to remember them all. I want to remember The best way to do this is to practice a lot, really use vim in daily text editing, and don't give up when you encounter problems, but find a solution. Every time you solve a problem, your vim skills will rise by one level.
Learn the basic operations of vim, you can also complete our work, and continue to practice in the work, thus improving the use of vim skills.
What is vim:
vim is a powerful, highly customizable text editor similar to Vi.
Purpose: Use vim when remotely logging in to the server to modify the server code.
Three working modes: command mode, edit mode, last line mode.
vim opens the default entry mode, in which the user can enter various legal Vi commands to manage their own documents. It should be noted that the commands entered are not displayed on the screen.
Basic operation in three modes
vim The default entry is the command mode, in which the user can enter various legal Vi commands to manage their own documents. . It should be noted that the commands entered are not displayed on the screen.
···h,j,k,l→Up, Down, Left, Right
···G: The cursor moves to the last line, 1G: The cursor moves to the first One line (gg can also be implemented back to the first line)
···^ Back to the current line, ··$: End of line
···Use x to delete The content after the cursor (similar to the Delete key in the word), use X to delete the content before the cursor (similar to the Backspace key in the word)
···ctrl+f: When the content is over For a long time, check the next page, ctrl+b: view the previous page
···u: revoke, ctrl+r: reverse undo
in command mode, press "a" "(append/append) button or "i" (insert/insert) button to enter
···yy: copy, p: paste (on the next line), paste the specified number of lines: number +p,
···dd: Cut (has the function of deleting at the same time, it is deleted after cutting.)
···V: Select multiple lines
in edit mode Next, you need ESC to return to the command mode, then ":" to enter the last line mode
··· Search for the specified content: / Content of the cable,