I have summarized 18 extremely useful vim commands.

Source: Internet
Author: User
I have summarized 18 very useful vim commands. The most famous program editor in Linux is not vim. In normal mode, 1. dd & mdash; delete the row where the cursor is located. 2./word & mdash; specify the words in full text search. 3.G & mdash; & mdash; move the cursor to the last row of the file, and move the cursor to row 99th, that is, 99G4... I have summarized 18 very useful vim commands. The most famous program editor in Linux is not vim. In normal mode, 1. dd -- delete the row where the cursor is located 2./word -- specify the word for full-text search 3.G -- move the cursor to the last row of the file and move it to 99th, delete one character in 99G4 and lowercase x, and delete one character in uppercase X 6,: 1, $ s/word1/word2/gc -- search for word1 from the first row to the last row, replace it with word2 and ask if to replace 7,: 1, $ s/word1/word2/g before replacement -- search for word1 from the first row to the last row, replace it with word2, do not ask 8, u -- undo the previous operation 9, CTRL + r -- repeat the previous operation 10, yy -- Copy the row where the cursor is located, copy the next six rows of the cursor, is 6yy11, p -- delete the post to the next line of the cursor, paste in uppercase P to the top line of the cursor 12 in normal mode Press, a/A/I/I/o/O/r/R enter edit mode in command mode 1. ZZ -- Note: There is no colon. if the file is not modified, exit directly; if the file is modified, save it and exit 2. set nu -- set row number 3 and: s. Et nonu -- cancel row number 4,: w filename save the file as filename5, and: r filename write the filename file in the last line of the file, which is equivalent to copying the content of filename to the end of the file 6 ,: wq! -- If the file is read-only, force save and exit
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.