Transferred from: http://blog.sina.com.cn/s/blog_98cf2a6f01015b220.html, thank you !!
1. Three Modes of survival: insert mode, command mode, regular mode I -- move the cursor to insert mode A -- move the cursor to insert mode ESC -- return to normal mode: -- Enter command mode from standard mode k \ J \ H \ l -- move cursor up, down, left, right X -- save in command mode exit w -- write and save in command mode do not exit q! -- Discard all the changes and exit the add, delete, modify, and query. By the way, there is another query directly in the regular mode "/" and then enter the content to be searched.
2. Struggling will survive, but many children's shoes may feel inconvenient in this place, struggle or even give up eventually. I have had this idea for many times and cannot tell clearly, how can I use it? Now it's hard to get rid of it. Some daily notes are completed using vim. I can only say a breeze-"It's better to endure tolerance and use more" (1) how can the cursor more easily beat the number 0 -- jump to the beginning of the line $ -- jump to the end of the line Gg -- not Dota loses GG, is to the initial position G -- jump to the end of the document
(2) In vim, CTRL + C and CTRL + vyy -- not "Obscenity", copy the current row p -- paste, paste it to the next row of the current row
(3) undo and redou -- pull back the operation Ctrl + r -- opposite to U. Sometimes you undo it and find that u is wrong. If you want to come back, redo it.
(4) Save the vim environment temporarily and switch back to linuxfg
3. If you have the feeling, this will not be classified. It's too lazy to think about what it is. (1) d first and then t again to the character -- delete from the current position of the cursor to a specified position, such as url = 'abdfkjdkjf', you want to change the URL value, in this way, you move the cursor to A, DT, and then the URL is left. Haha, I like this micro-operation anyway.
(2) how to interact with Linux in command mode! Ls to view the stuff in the current directory. Other commands are similar and may be unavailable.
(3) The V key is used to select the current row and move up and down. Select the required range Ctrl + v. Select the current column to move up, down, and left, what can I do if I select the required range? This can be more, such as deleting several rows in a row. After selecting X or D, you can add a annotator at the beginning of the line and add a comment at the beginning of the line, that is too much. I am so timid that I think I will not be able to perform this Microoperation. I cannot say I can use Vim. This is definitely an artifact. CTR + V at the same time, then J goes down, almost I enters the insert mode, then input '#', then ESC returns to the normal mode, done, you will find that each line has an extra '#' character at this position. Let's just say that this feature has always been a constant demand for this kind of feature. When I asked a rd who has been working in BD for a year, he told me that there was no way to add only one row and one row, this is a bit dizzy. Okay, you can install it if you do. This is not to say how BD's RD works. When I was in BD, I was a girl. When I was there, I saw her operating Vim at that speed and proficiency. I wanted to hit the wall, self-satisfied
By the way, I almost forgot. After selecting the line V, you can combine <and> forward and backward contraction and backward indentation, which is also an artifact.
(4) split screen and multi-screen operation sp -- horizontal split screen VSP -- Vertical Split screen
(5) Complete Vim Ctrl + P
(6) Find the current position. The word is done directly *. Then, the next matching position is N, and the last matching position is N.
(7) Vim global replacement % S/content to be replaced/g
(8) other set nu -- display row number set Nonu -- hide row number set list -- display space, tab, and other symbols set wrap -- automatically collapse Zo -- expand ZC -- collapse (refers to functions and the like)
4. Master? Anyway, I know this, but it is rarely used (mainly too lazy) (1) Cut m to N rows and put them under K rows N, M m K the third M is a letter, meaning move
(2) Delete multiple rows: 1, 10 days
(3) move the cursor to the beginning of the next row: +First line of the previous line :-Beginning of the current row: 0
O Insert a new row in front of the current row to replace the CW character from the cursor position to the end of a word ^ To the first position in the row that is not a blank character (the so-called blank character is a space, tab, line feed, press enter>(0, 0 is the unconditional return to the first line, regardless of whether the first line is a blank character)G _ is the opposite of 3. Return to the last character, E, which is not blank. Open the saveas file and save it as: BN and: BP. You can open many files at the same time, use these two commands to switch to the next or previous file. -> (decimal point) You can repeat the previous command N (command)-> repeat a command n times #-> Search for fixed matching characters from the current position, contrary to the n key function, DT "-> deletes all content until double quotation marks --" J-> multiple lines are selected, you can directly type J, you can connect all rows =-> after multiple rows are selected, you can directly type = to automatically indent the selected rows (this command is too nice) de from the current cursor position until the end of the current word all fold (1) set nofen (2) Zn (3) Zr
After a while, there is nothing else. If you feel that some operations are inconvenient to use, ask Google or ask the real cool people. Vim is still very powerful, most of your needs can be easily solved. Believe me, everyone is an ordinary person. Your needs are generally met by others.