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 configure the automatic completion of vim7.2 Code

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

Share

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

This article is about how to do vim7.2 code auto-completion configuration, the editor feels very practical, so share with you to learn, I hope you can learn something after reading this article, say no more, follow the editor to have a look.

Ordeder: http://blog.csdn.net/ordeder/article/details/17473105

Installation of Tag tools:

Teg List download: http://www.vim.org/scripts/download_script.php?src_id=7701

Installation: extract to the .vim subdirectory under the home directory.

Install WinManager (adjust window layout)

Download: http://www.vim.org/scripts/download_script.php?src_id=754

Installation: extract to the .vim subdirectory under the home directory.

Step 3: use an example

1. Generate tags under the project directory:

a. Enter my source directory, such as ~ / coding/

b. Invoke command

# ctags-c++-kinds=+p-fields=+iaS-extra=+q-R

Note: if the tags generated directly with the command # ctags-R cannot complete the member names of the data structures in the source file, there will be an error:-- omnipotent completion (^ O ^ N ^ P) cannot find the pattern. Secondly, after modifying the source file (such as adding the definition of a new structure), be sure to re-ctags, otherwise the new structure can not be completed (the new function can be completed) ~

The command explains:

-R: files in the current directory and its subdirectories generate tags

-- c++-kinds=+p: add the tag of the function prototype to the C++ file

-- fields=+iaS: add inheritance information (I), access control information of class members (a), and function fingerprint (S) to the tag file

-- extra=+q: adds a class modifier to the tag. Note that without this option, class members cannot be completed

>

>

Write a function name or object name (using a combined keyboard (Ctrl+P)) to provide a completion item

4. Add the tags of the structure defined by the system header file

Such as >

Where-f: specifies the storage directory of the tags, and usr/include / usr/local/include is where some of the structures of the system are defined.

Add the tags of the system to b.vim

: set >

c. Experimental results

5.vim automatic incomplete problem: function parameters can not be displayed solution

New version of supertab installation:

Download address:

Http://www.vim.org/scripts/download_script.php?src_id=16104

Http://www.vim.org/scripts/download_script.php?src_id=16345

After downloading the above two .bva, open it with vim, and then enter the command in vim: so% to install.

Finally, notice that the following settings are added to .vimrc so that the relevant parameters of the function can be displayed:

Let g:SuperTabRetainCompletionType=2

Let GRO SuperTabDefaultCompletionType = ""

You can generate the tag of the system function using the following command

Command: ctags-I _ THROW-- file-scope=yes-- langmap=c:+.h-- languages=c,c++-- links=yes-- c-kinds=+p-- fields=+iaS-- extra=+q-R-f ~ / .vim/systags / usr/include / usr/local/include

The above is how to configure the automatic completion of vim7.2 code, and the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please 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

Development

Wechat

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

12
Report