ctags in sublime text

nkint picture nkint · Feb 29, 2012 · Viewed 11k times · Source

I've just download sublime text 2 beta 2182 under ubuntu 10.10 with Exuberant Ctags 5.8

I want to use it for c++ coding and I need some auto completition and code navigation. (I was used to eclipse with cdt)

I googled and I found ctags a cool tool that can do it, and there is a plugin support for sublime text here.

The problem is that I want create tag file from:

  1. c++ standard lib (std::vector std::map etc)

  2. all classes of the framework i'm using.

Point 1 is (i think) the same of point 2, I just only have to create a tag list of std lib in my /usr/include/c++/4.4.5/

so I've downloaded the plugin and installed it, I made a taglist in this way:

$ cd /absolute_path_of_my_cpp_framework/
$ ctags -R *

I modified /home/me/.config/sublime-text-2/Packages/CTagss/CTags.sublime-settings with this line:

"extra_tag_files" : [".gemtags", "/absolute_path_of_my_cpp_framework/tags"]

Now I open a cpp file, point the cursor on a class name of my framework and used the key binding ctrl+t ctrl+t and nothing happened. Only this message in the bar in the bottom:

can't find "class_name"

Can someone help me?

Answer

Matt Kline picture Matt Kline · Apr 30, 2012

I don't personally use Sublime Text, but assuming it uses tag files in a similar manner to vim, you need to generate additional info for C++ completion.

Use ctags with the following options:

ctags -R --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++

Info was taken from this article, which also supplies copies of the standard library headers that you can use to generate tags.