sponsor Vim development Vim logo Vim Book Ad

ProjectTag : This plugin is aimed at generating tags for a whole project.

 script karma  Rating 6/4, Downloaded by 2349  Comments, bugs, improvements  Vim wiki

created by
Hong Xu
script type
This plugin is aimed at generating tags for a whole project.
Exuberant Ctags is required for this plugin:
This plugin is quite useful when used with omnicomplete plugins, such as
OmniCppComplete(vimscript #1520),
pythoncomplete(vimscript #1542),
javacomplete(vimscript #1785).
vim must be compiled with python support for this plugin to run. At least
python 2.4 is required. Python 3.x is not supported currently.

For C/C++ projects, there's no need to generate a seperate tag file for the
included header files any more! This plugin will also parses the header files
cited in your source code, so a tag file providing information of all sources
files in your project and header files included in your sources would be

This plugin could also generate tags in background by using python
multithread library, so your editing work would not be blocked when
generating tag files.

The following is a short tutorial.

First, enter your project root directory, for example /home/user/myproject.
Then create a project file, the file name must be "project.prom". Edit this
file. Copy the following content to this file:

Replace source1,source2,... with your source file, such as main.c,

replace include_dir1,include_dir2,... with your include directories, such as
/usr/include, /usr/local/include (not required for non C/C++ project, in fact,
even for C/C++ project, it is also optional);

replace ctags_command with your ctags command, such as ctags, /usr/bin/ctags;

replace --your-tag-flags with your tag flags, such as --extra=+q.

For example, for the following source tree:

- src/
- include/

The project file could be like the following:
sources=src/main.cpp, src/foo.cpp, src/bar.cpp
tagflag=--extra=+q --c++-kinds=+p --fields=+iaS
Then save the file.

Use vim to open a source file, such as foo.cpp. Use the command
":GenProTags" to generate the tag file(this might be some kind of slow). if
you don't want to be blocked when generating the tag file, use ":GenProTagsBg"
instead. This will generate the tag file in background.

Make sure that your project path does not contain spaces, or it wouldn't work.

If you find any bug, please report it to hong@topbug.net, or submit it on the
issue tracker:


Follow xuhdev on twitter if you are interested in my development:

If you are working on a UNIX-like system, There is also an alternative way to generate a ctags file for your C/C++ source files and their included header files:

install details
Download the ProjectTag.zip file and extract it to your vim runtime
directory(~/.vim on linux and $VIM_INSTALLATION_FOLDER\vimfiles on
windows), you'd better then use helptags command to generate the help
tag(for example use ":helptags ~/.vim/doc" on Linux).

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
ProjectTag.zip 0.1.10 2011-02-03 7.0 Hong Xu Also handle the situation when ctags doesn't return 0;
Improve the error messages.
ProjectTag.zip 0.1.9 2010-12-05 7.2 Hong Xu Also recognize this kind of include: "# include","#\tinclude",etc;
move ProjectTag.py from ProjectTag/ to plugin/ProjectTag/, so please delete the "ProjectTag" directory in the old version if you are upgrading.
ProjectTag.zip 0.1.8 2010-11-30 7.2 Hong Xu Fix a vim 'tags' setting problem. Convert the document file format to unix format.
ProjectTag.zip 0.1.7 2010-11-26 7.2 Hong Xu fix a minor document bug.
ProjectTag.zip 0.1.6 2010-11-23 7.0 Hong Xu Fix a bug when "sources" contain some non-exist files.
ProjectTag.zip 0.1.5 2010-09-23 7.0 Hong Xu fix a minor bug: if current working directory is not where current file locates, this plugin would not work properly.
ProjectTag.zip 0.1.4 2010-09-22 7.0 Hong Xu Improve the performance.
ProjectTag.zip 0.1.3 2010-09-03 7.0 Hong Xu Don't enable this plugin when required python packages are not found. Improve the document.
ProjectTag.zip 0.1.2 2010-08-28 7.0 Hong Xu Don't generate tags if project not found, add GetLatestScript support.
ProjectTag.zip 0.1.1 2010-08-27 7.0 Hong Xu When searching for header files, also search for the header files in the same directory with the source file.
ProjectTag.zip 0.1 2010-08-26 7.0 Hong Xu Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.