Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize Vim automatic completion

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

In this article, the editor introduces in detail the "Vim automatic completion how to achieve", the content is detailed, the steps are clear, and the details are handled properly. I hope this "Vim automatic completion how to achieve" article can help you solve your doubts.

In Insert mode, Vim can also achieve automatic completion without any plug-ins. The automatic completion functions mainly include automatic word completion, line automatic completion and dictionary-based automatic completion.

Word completion

CTRL+n: when you type the first letter, press CTRL+n, and the drop-down menu automatically appears. The first word is selected by default, and you can press CTRL+n,CTRL+p to select it up and down. If there is no optional word in the buffer, then the drop-down list will not have an option.

CTRL+p: same as above, except that the last word in the list is selected by default.

Line completion

CTRL+x CTRL+l: two commands are used in combination. Enter the first word of the existing line in insert mode, and then press these two keys to list the entire line.

Dictionary completion

First, add the following code to the ~ / .vimrc configuration file. Note that under the Linux,Windows user, it is C:\ Users\ $username (user name), and dict.txt is the alternate word file.

Set dictionary-=~/dict.txt dictionary+=~/dict.txt

The word in dic.txt is one word per line.

# dict.txt http://foofish.netfoofishpythonthisobject

Reopen Vim, press CTRL+x in Insert mode and CTRL+k will see the words defined in dict.txt. If you still have trouble and want to CTRL+n directly to display the list, configure the .vimrc file:

Set complete-=k complete+=k read here, this article "how to achieve Vim automatic completion" article has been introduced, want to master the knowledge of this article still need everyone to practice and use to understand, if you want to know more related articles, welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report