Programming tool vim + ctags + taglist + cppcomplete + cs.pdf + global in Linux

Source: Internet
Author: User
In Linux, the programming auxiliary tool vim + ctags + taglist + cppcomplete + csloud + global -- Linux general technology-Linux programming and kernel information. The following is a detailed description. Main functions of each tool:
Vim: This is a very powerful editor in Linux.
Ctags: Command for generating tag files. This is the basis of other tools.
Taglist: The function list and global parameter list are listed directly on the left side.
Cppcomplete: it must be supported by ctags. You can complete the types or function names.
Cssag: it is relatively powerful. It can jump to functions and some type definitions. In fact, cssag is used to replace the ctags function.
Global: similar to cssag and taglist, it is said that it is good for large projects.

Installation of various tools:
1) install vim, ctags, csloud, and global in the system or use yum for installation.
2) download the cssag plug-in of vim and put it in the corresponding directory, such ~ /. Vim/plugin/

2) taglist, cppcomplete is the Vim plug-in, obtained from the following address, and then put it in the vim directory.

Use of various tools:
1) Use of ctags
Run the following command on the terminal to generate the file tags:
Ctags *. cpp
To generate the tags file required by cppcomplete, run the following command:
Ctags-n-f cppcomplete. tags -- fields = + ai -- C ++-types = + p *-L cs.pdf. files
Note that the "-L cscope. files" parameter is used at the end to help ctags query related project files and generate tags by pulling the file index generated by cssag.

2) use taglist
The taglist function is used to generate the function list and global variable list of the current file in real time for indexing.
Run the following command in vim:
Tlist to enable or disable the index of the current file;
TlistSync immediately locates the function or structure definition where the current cursor is located in the index window that opens.

3) Use cppcomplete
It is easy to use, that is, when you need to complete the type of members, press F8.
The default key mapping to complete the code are:

Alt + l in insert mode will try to find the possible completions and display them in a popup menu. Also normal completions to the names in cppcomplete. tags.
Alt + j in insert mode will show the popup menu with the last results. Selecting one of the items will paste the text.
F8/F9 will work in a similar way as Ctrl + N, Ctrl + P in unextended vim so the script can be used without the popup menu.
F5 in insert mode will lookup the class and display it in a preview window

The key mapping are only tested under Windows and linux and they will not work on all platforms. Changing the mappings is easy.

4) use cscope
The simplest way to generate a cssag tag is:
Run csw.indexer in the top-level directory of your development project. it traverses all the following directories and generates two files. files, this file record needs to generate the tags file name, which can be manually modified, and the other is cssag. out.
After that, you can use Ctrl-] to jump to the search type definition.

5) Use global
Run the following command in the top directory of the project:
Gtags
Wait for it to generate all the required tags in the global format. After generation, you can use the following command to query references and associations of related types:

Search for the definition of xxxx in Gtags xxxx
Gtags-r xxxx
Gtags-s xxxx
Sometimes it cannot analyze the type normally. You can try to find the type definition by using the parameter with-s.

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.