The automatic completion function of VIM Basic learning

Source: Internet
Author: User

This chapter we learn the automatic completion function
1. Auto-Complete priority gets the complete list from the current edit area
For example:
Let's write down the following:

Aaaaaaabbbaaab


When we enter AA again, and then we press TAB, a list containing aaaaa aabbb Aaab is popped up.
Conditions for triggering the completion mode
1. In the Insert mode


Meanwhile, ctrl+p Ctrl + N also moves up and down to select the complement list item
There are other methods of completion, as follows
These methods are all started with Ctrl + X, followed by the complement style you want

1. <c-n>- Common keyword 2. <c-x><c-n>- Current buffer 3.<c-x> <c-i>- contains the file keyword 4. <c-x><c-]>- Tag file keyword 5. <c-x><c-k >- Dictionary lookup 6. <c-x><c-l>-Complete Line Completion

For line completion
For example, let's do the following
1. Automatic (this time we do <c-x><c-l> operation, will be automatically complete for "This chapter we learn auto-complete function")

7. <c-x><c-f>- file name completion 8. <c-x><c-o>-All-round complement


When we pop up the list, what can we do with the AutoComplete list?

1. <c-n>- matches the next 2. <c-p>- matches the previous 3. <c-y>- confirm that the current match is used (previously you want to use the ENTER key to achieve the selection, has not been successful, although selected, it will be wrapped) 4. <c-e>- exit complete list 5. <c-h>-reduces one character from the current match (for example, the current input is AA, the complement list cursor is on AABBB, you use <c-h > , the input will become AABB)6. <c-l>-adds a character from the current match (for example, the current input is AA, the complement list cursor is on the AABBB, you use <c-h>  , the input will become AaB)7. {char}-inserts the character followed by the complete list item at the time of the cursor, terminating the completion


There is a small trick, that is, we use the completion of the time, as far as possible through the <c-n> to pull up the complete list, and then we pressed the <C-P>, when the cursor is in the list of 0 lines, we add or reduce the character >, the list will be automatically reduced or added

Auto-complete function of vim basic learning

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.