Usage of VIM

Source: Internet
Author: User


1. What is the difference between VI and VIM, and what is the relationship between them?
Vim is an improved version of VI, which adds a lot more functionality than VI

2. How do I view the current system vim version? : Version

3. What do I do if I want to replace all "ABC" in the Document with "Def"? And how do you just replace the first "ABC" that appears in each line?
:%s/abc/def/g

4. When searching for a keyword, what is the line of the keyword where the cursor is positioned? In other words, is the cursor positioned to the top of the keyword that appears on the line or the bottom of the keyword appears in the row, or another situation? What do I do if I want to move from the current keyword to the next keyword? How do I move to the previous keyword?
The cursor is the line that locates the bottom keyword, press N to jump to the next keyword, n jumps to the previous keyword

5. When you finish editing the document, press ESC to enter command mode and enter the command: x what happens?
Will encrypt the file and prompt for the password

6. How to quickly move the cursor to the right or left 10 characters in normal mode?
Move right: 10 SPACEBAR

7. What does VIM + filename mean and what will happen to vim +10 filename?
Vim + filename means to open a file with vim, vim +10 filename means to jump to line tenth after opening the file

8. After opening a document with Vim, I want the cursor to jump to line 20th, what do I do? How do I jump to the last line?
Skip to Line 20th 20G
Skip to last line g

9. Vim when the document is opened, the default is not to display the line number, how do you let it display line number?
: Set Nu

After Vim opens the document, I want to replace the first ' ABC ' in line 20-50 with ' EFG ' How to do it? What if you want to replace all of them?
Replace the first ' ABC ' in line 20-50 with ' EFG ': 20,50s/abc/def/g
Replace All:%s/abc/def/g

One. Vim how to quickly delete the first 100 lines after opening a document?
: 1,100d

When Vim opens a document, how do you copy a line and paste it below line 20th?

Move the cursor to the line to be copied, copy by yy, move to 20 lines, press p to paste

Usage of VIM

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.