Use of Ctags in Ubuntu

Source: Internet
Author: User
1. install Ctags under Ubuntu first download the source code to the http://ctags.sourceforge.net, unzip $. /configure $ make $ sudomakeinstallorsudoapt-getinstallctags2. run $ ctags-R "-R" in the source code directory to recursively create the source code, which includes the source code in all subdirectories under the source code root directory.

1. Install Ctags in Ubuntu

First download the source code to the http://ctags.sourceforge.net, unzip

$./Configure

$ Make

$ Sudo make install

Or

Sudo apt-get install ctags

2. Run the command in the source code directory.

$ Ctags-R

"-R" indicates recursive creation, that is, the source code under all subdirectories under the source code root directory. The tags index file is generated under the current directory.

Assume that the current source code directory contains the following content:

./Makefile

./Src # folder for storing source code

After ctags-R is executed

./Makefile

./Src # folder for storing source code

./Tags

The "tags" file contains a list of these objects:

Macro defined by # define

Enumerated variable value

Function Definition, prototype, and Declaration

Namespace)

Type Definition (typedefs)

Variables (including definitions and declarations)

Class, struct, enum, and union)

Class, structure, and union member variables or functions

3. vim will use the index in the tags file to locate

Run vim in the directory where the tags file is located to open the source file. c or. h.

A. move the cursor to the position of the variable or function to be viewed. Press ctrl +] to jump to the position defined by the variable or function, and press ctrl + o to return.

B. Stop the cursor at the place referenced by the header file. Press the gf key to jump to the header file. ctrl + o returns

C. Place the cursor in the position of a function or variable. gd will highlight all functions or variables in the current file and press n to view the next one.

D. gg The cursor returns to the top of the file

Install Ctags http://www.linuxidc.com/Linux/2014-03/97620.htm in Ubuntu

For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2

This article permanently updates the link address: Http://www.linuxidc.com/Linux/2014-04/101144.htm

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.