sponsor Vim development Vim logo Vim Book Ad

ProjectCTags : Generates CTAGS for versioned projects without the need to maintain project file

 script karma  Rating 9/3, Downloaded by 537    Comments, bugs, improvements  Vim wiki

created by
T. Kelter
script type
ProjectCTags is a plugin that enables you to generate CTags for a project which is under version control. These tags can then be used to Eclipse-like "Jump-To-Definition" or autocompletion of source code. Currently the plugin recognizes source code projects which are versioned with git, CVS and SVN version control systems. This plugin eases the task of generating up-to-date tag files. For people who like to maintain vim project files (Personally I do not like to do that, I just want tags for everything in my project folders), vimscript #3221 might be more appropriate. Once you have generated the tags you can use them in the following ways:

* Jump to definition of the tag (if it is located in your project) under the cursor with Ctrl-]
* Autocomplete C/C++ source code with vimscript #1520 (See vimscript #1643 for intelligent <Tab> key completion)

When you have opened a file, the plugin may either automatically update the corresponding tagfiles or it does this on your command (optional). It creates two tagfiles: One in the current folder, which contains detailed informations such as tags for local variables, and one tagfile in the project folder, which contains a less detailed overview of the globally visible tags in all source files in the versioned tree. By default it creates tags in the proper format for vimscript #1520.

The generated tags will only cover the code that is contained in your project! STL code etc is not included. If you want autocompletion for STL code you must download vimscript #2358 and insert the following into your .vimrc

set tags += "path/to/stl_tag_file"

If you have questions or suggestions about/for the plugin, feel free to contact me. And of course, if you like the plugin, vote for it in the box below :-)
install details
Just move projectCTags.vim to ~/.vim/plugin. The plugin requires CTags to be installed (http://ctags.sourceforge.net/). If CTags is not in your $PATH environment variable, then you must specify the path to the CTags executable by putting

let g:projectCTagsCTagsExe = "path/to/ctags"

into your .vimrc file. To generate and set the CTags you can then use :GenerateProjectCTags( "Tag Setting Name", "ctags options" ). It is useful to map this to a key like

map  <F3>  :call GenerateProjectCTags( "Standard", "" )<CR>
map  <F4>  :call GenerateProjectCTags( "Exclude Stuff", "--languages=C,C++ --exclude=folder1 --exclude=folder2" )<CR>

For further options, see the "projectCTags.vim" file. They are all listed and documented at the top of the file. A useful option, which should be set inside the ~/.vimrc, is:

let g:projectCTagsAutogenerateTags = 1

This will let ProjectCTags automatically regenerate the tag files when you open a C/C++ file if you have already created the tags once manually by invoking :GenerateProjectCTags() before. This will then re-use the options (second parameter of GenerateProjectCTags) which were used last time inside the project. The options are stored in a ".tags_options" file in the project folder.

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
projectCTags.vim 0.3.1 2010-12-15 7.0 T. Kelter Fixed a misformatted line-break which led to a syntax error.
projectCTags.vim 0.3 2010-11-20 7.0 T. Kelter The output generated by the plugin is now less verbose. Options were added to specify individual verbosity levels.
projectCTags.vim 0.2 2010-11-06 7.0 T. Kelter Automatically uses the correct path separator ('\') on Windows systems now (thanks to Дмитрий Франк)
projectCTags.vim 0.1 2010-10-13 7.0 T. Kelter 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.
SourceForge.net Logo