Install and use CTAG in VIM

Source: Internet
Author: User

The CTAG plug-in is mainly used to jump between variables and function definitions like in VC, so it is very convenient.

Download and install: http://down1.chinaunix.net/distfiles/ctags-5.2.3.tar.gz

Tar-xzvf ctags. xxxxxx

./Configure -- prefix = installed directory

Make; make install

Ctags-version test whether the installation is successful

 

Usage:

Ctags-R

"-R" indicates recursive creation, which includes the source program under all subdirectories under the source code root directory. The "tags" file contains a list of these objects:

L macro defined by # define

L enumerated variable value

L function definition, prototype, and Declaration

L namespace)

L type definition (typedefs)

L variables (including definitions and declarations)

Class, struct, Enum, and Union)

L class, structure, and union member variables or functions

Vim uses this "tags" file to locate the marked objects above. The following describes how to locate these objects:

1) Use the command line. Add the "-T" parameter when running vim, for example:

[/Home/Brimmer/src] $ vim-T foo_BAR

This command will open the file defining "foo_BAR" (variable or function or other), and position the cursor to this line.

2) use the ": Ta" command in the vim Editor, for example:

: Ta foo_BAR

3) the most convenient way is to move the cursor over the variable or function name, and then press "Ctrl-]". Return the original location with "Ctrl-o.

Note:When running vim, you must run it in the directory where the "tags" file is located. Otherwise, run the ": Set tags =" command to set the path of the "tags" file so that Vim can find the "tags" file.

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.