VIM + ctags/cs.pdf

Source: Internet
Author: User

With VIM + cssag/ctags, You can implement the sourceinsight function. In the future, you can stop using pirated souceinsight to readCode.
Add the cscope function. after vimrc (you need to select the "-- enable-cscope" option during vim compilation; otherwise, you need to re-compile Vim), the configuration is complete. Then, run the following command to generate the symbol index file of the Code:

Cscope-Rbkq

This command generates three files: csexample. Out, csexample. In. Out, csexample. Po. Out.
Cssag. out is the basic symbolic index, and the last two files are generated using the "-Q" option, which can speed up the cssag index.
The command parameters used above have the following meanings:

-R: Search for the code in the subdirectory tree when generating the index file
-B: Only generate the index file. Do not go to the cssag interface.
-K: Do not search when generating index files / USR / Include directory
-Q: Generate cscope . In . Out and cscope . Po . Out file to accelerate the indexing speed of cssag

Next, you can read the code in vim.
You cannot find C ++ classes, function definitions, and call relationships during usage. After carefully reading the cssag manual, we found that when cssag generated index files, only files of the C, Lex, and YACC types were searched (with the suffix. C ,. H ,. l ,. y), the C ++ file does not generate an index at all. However, according to the instructions in the manual, cssag supports C ++ and java files.
Therefore, according to the methods provided in the cssag manual, a file list is generated first, and then cssag generates an index for each file in the list.
For ease of use, I wrote the following script to update the index files of cssag and ctags:

#! /Bin/sh

Find.-Name "*. H"-o-name "*. c"-o-name "*. cc"> cscope. Files
Cscope-Bkq-I cscope. Files
Ctags-R

This script first uses the find command to find all the Suffixes in the current directory and subdirectory ". H ",". C "and ". CC file, and redirect the search result to the file cs.pdf. files.
Then cssag generates a symbolic index file based on all files in cssag. Files.
The last command uses the ctags command to generate a tags file and run the ": Help tags" command in VIM to query its usage. It can be used with cscope.

The home page of cssag is:Http://cscope.sourceforge.net/

there are many cssag-related plug-ins on the vim website. You can find out if you are interested. Search results here:
http://www.vim.org/scripts/script_search_results.php? KEYWORDS = cscope & script_type = & order_by = rating & direction = descending & search = SEARCH

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.