Vim is basic, with no solid foundation.

Source: Internet
Author: User

Vim is basic, with no solid foundation.
Now vim and vim are very important, but many of us are paying attention to advanced technologies. However, vim is not efficient in editing files. Vim is very important. What I am talking about below is also frequently used and simple things. I hope to remember them all and be proficient in it. Your work will be very helpful. Tips for using vim: tip 1: In editing mode (by default, the editing mode is used to open a file with vim). After someone opens vim, move the cursor with the up, down, and left arrows, this is not necessary. Use the four letters "h j k l" to move. You are not mistaken, that is, the four letters on the keyboard, h is left, l is right (because one of them is on the leftmost and the other is on the rightmost), j is down, and k is up (I remember it like this, when playing cards, j is smaller than k, and k is the upper level, which means to climb up. There is another way to remember. Some netizens said that j is Japan, k is Korea, and the South Korean latitude is higher than the Japanese, so it is going up) Tip 2: Save and quit, wq (or wq !), X (or x !) The new method, in uppercase ZZ, can be saved and exited after two consecutive clicks (in edit mode! Tip 3: vim edits a very long piece of code and wants to jump to the end of the line. What should I do? Can I move the arrow to the end of a row? It's too slow! You can simply press $ and immediately jump to the end of this section! Press the Arabic number 0 (or press ^) and jump to the header immediately. (Of course, this is also in editing mode) Tip 4: edit mode: w: move to the first word of the next word (for example, "Hello World, HaHa", the cursor is above Hello, click w, and jump to W, which is the first word of the next word, you can try it yourself) e: jump to the end of the word B: return the first word of the previous word, or the first word of the current word, opposite to w. (Ah, Tip 4 is not a skill. If you are familiar with it, you can do it.) Tip 5: In editing mode: open a file and want to jump to the end immediately. What should I do, drag down the arrow to the end? Yes, too slow! Uppercase G, click it, and immediately to the end. The word "Bot" is used at the end! I want to jump to the first place again? You can also quickly press the lower-case gg, right, you are not mistaken, 2 lower-case g, you can quickly get to the first. Tip 5: Your mouse stays in the middle of a piece of text. What should you do if you want to delete the front of the mouse? D0: Yes, that is, d and 0. Your mouse stays in the middle of a piece of text. What should you do if you want to delete the front of the mouse? D $: That's right. Do you want to delete the next word between d and USD? Dw: Is d and w wanting to delete the previous word? Db Tip 5 is also in editing mode. Tip 6: The last line mode is changed! What should I do if I want to delete 20th rows to 30th rows in last row mode? Answer ---------: 10, 20d, yes, a colon, a 10, a comma, a 20, a d. Another example (in the last line mode )::., $ d // Delete from current row to Last Row Tip 7: edit mode, COPY command: yy // two yy edit modes, paste command: p (paste at the bottom of the cursor), uppercase P at the top tip 8: Still in editing mode: You press dd, delete a row, and press dd, delete another row, right. But what should I do if I suddenly want to restore my original appearance? Click u. That's right. It's a letter u. Then click u to delete all the rows. (Equivalent to ctrl + z in office, so I can understand it.) But what should I do if I want to restore to the deleted status? Simple? Press ctrl + r (equivalent to ctrl + y in the office, if you do not know ctrl + y in the office, check it) Tip 9: in the last line mode ::., $ s # I # I # gi: a colon, a dot, a comma, a $, A s, A #, an I, A #, an I, #, one g and one I. The description is complete! It means to convert all lowercase I in this file into uppercase I. Tip 10: In last line mode ::! Ls/etc/passwd is correct. This command means that you can view/etc/passwd without exiting vim, and then press z to return the result.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.