How to use Vim ctags

Source: Internet
Author: User

First, with a good system to bring software Ctags most of the UNIX system has ctags software, it can work well with vim. Purpose: Generate C language tag file, implement the jump between related C files.      Usage: 1. Generate the label file in the current directory (command after running the prompt): $ctags-R. -R represents recursive, recursive, which generates a label file for the C file in the current directory and its subdirectories.        The last one. Represents the current directory.       After running the current directory will be one more file tags, is the c tag index file. If there is a JS file in the project file, it may appear
ctags:Warning:ignoring null tag in .... js./...

This error is said to be because "JS file has a special structure, not in the Ctags Default definition list", there are two methods:
1. Remove all JS files from the project, and then move back after generating the two files.
For me, the project JS file volume is too large, the division is not uniform, so use the second method.

2, Ctags can specify when to generate. tags file, only filter which language of the file, the following command is to filter only PHP files
CMD switches to the project file directory and executes:

Ctags--languages=php-  R

2. Jump 1) Use Vim to open a labeled C file 2) Ctrl +] Locate the label where the cursor is located 3) ctrl+t back to the label before the jump note: When running vim, the "tags" file must be Run in the same directory. Otherwise, run it will not find the "tags" file, but need to use ": Set tags=" command in Vim to set the "tags" file path. For a slightly larger project, you may open vim in any directory, but it is not a good idea to generate a tags file in each directory, then how to solve it? The method is to add a line to the. VIMRC:Set tags=tags;/This tells VIM to search the upper directory when the tags file is not found in the current directory.

How to use Vim ctags

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.