1. What is the difference between VI and VIM, and what is the relationship between them?

Source: Internet
Author: User

1. What is the difference between VI and VIM, and what is the relationship between them?

A: In a nutshell, the VI editor is the early UNIX text editor, more simple, does not support syntax color; the VIM editor is an improved version based on VI, more powerful than VI, and supports syntax colors. Vim is an upgraded version of VI.

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

Answer: Vim--version or Rpm-qa |grep vim

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?

A: 1, $s/abc/def/g or%s/abc/def/g, without G only replace the first "ABC" of each line

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?

A: 1. Positive search use/, cursor to the top of the line appears the keyword, n moved to the next keyword, n moved to the previous keyword

2. Inverse search use? , the cursor navigates to the lowest end of the line where the keyword appears, n moves to the next keyword, n moves to the previous keyword

5. When you finish editing the document, press ESC to enter command mode and enter the command: x what happens?

A: The command: X will save the exit, equal to the command: WQ

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

A: Move 10 characters to the left: 10h or 10←

Move 10 characters to the right: 10l or 10→

7. What does VIM + filename mean and what will happen to vim +10 filename?

A: Vim filename indicates that the file filename is opened in the Vim editor, created if it does not exist, and the cursor is positioned to the beginning of the first line. Vim +10 filename indicates that the file filename is opened in the Vim editor, created if it does not exist, if the number of rows is greater than or equal to 10 lines, the cursor is positioned to the beginning of line 10th, and if less than 10 lines the cursor is positioned to the beginning of the last line.

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?

A: Move the cursor to line 20th: 20G

Move the cursor to the 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?

Answer: Input in command mode: Set No

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?

Answer: (1) 20,50s/abc/efg/

(2) 20,50s/abc/efg/g replace 20-50 lines all ' abc ' for ' EFG '

1, $s/abc/efg/g or%s/abc/efg/g replace full text all ' abc ' for ' EFG '

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

A: Position the cursor to the first line and enter 100DD

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

A: First position the cursor to the row to be copied, then enter YY to copy the line, then enter "20G" to the 20th row, and then the lowercase letter "P" paste.


1. What is the difference between VI and VIM, and what is the relationship between them?

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.