Tenth. Text Editing Tool vim

Source: Internet
Author: User

1. What is the difference between VI and VIM, and what is the relationship between them?
Vim is a text editor developed from VI and can be viewed as an upgraded version of VI. Vim's main function is completely compatible with the original VI, unlike VI, VI will not display color, and vim will be based on the contents of the file display different colors, easy to read and edit. and vim with code completion, compile and error jump and other convenient programming rich features, in the programmer is widely used. (Vim and Emacs are the favorite editors for Unix-like system users.) )

2. How do I view the current system vim version?
 vim--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?
Replace all: 1, $s/abc/def/g

Replace one: 1, $s/abc/def
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?
You need to see when Vim enters the document, where the cursor is located, and the positioning keyword is based on where the cursor is located.
if using/searching for keywords, press ' n ' to move down, press SHIFT + N up, if used? Search keywords, and the former is just the opposite.

5. When you finish editing the document, press ESC to enter command mode and enter the command: x what happens?
input command: X can also save the file and exit, a bit similar: WQ, but there is a difference between the two.
: x #写入文件并退出. The file modification time is not updated unless the file is modified and the file modification time is updated.
: Wq #强制性写入文件并退出. Force write even if the file is not modified, and update the file's modification time.

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

7. What does VIM + filename mean and what will happen to vim +10 filename?
Vim + After entering the document, navigate to the last line
vim +10 After entering the document, the cursor is positioned to line 10th

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?
    jump To line 20, enter 20G
      Last line, enter 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 one: 20,50S/ABC/EFG

All Replacements: 20,50s/abc/efg/g
One. Vim how to quickly delete the first 100 lines after opening a document?
first Press ' GG ' to the first line, then enter 100d

When Vim opens a document, how do you copy a line and paste it below line 20th?
Navigate to the row you want to copy, enter yy, then enter 20G, and then enter lowercase p

Extended reading:

1. More about Vim's knowledge pointsHttp://www.lishiming.net/thread-5482-1-1.html

2. Settings for VIMHttp://www.lishiming.net/thread-5483-1-1.html

VIM Application:

1. Vim Settings Auto IndentHttp://www.lishiming.net/thread-3616-1-1.html

2. Vim quickly deletes a specified segment of charactersHttp://www.lishiming.net/thread-842-1-2.html

3. Share several shortcuts that are commonly used in vimHttp://www.lishiming.net/thread-407-1-1.html

This article from "Helin" blog, reproduced please contact the author!

Tenth. Text Editing Tool 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.