Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ctags in sublime text

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?

like image 397
nkint Avatar asked Feb 29 '12 01:02

nkint


People also ask

What is the use of ctags?

Ctags is a tool that generates a tag file of names found in source files. In Moodle, it can be used to index PHP functions, variables, classes and so on. These tags allow definitions to be quickly and easily located by a text editor such as vim.

What are ctags files?

ctags creates a file named tags in the current directory. It summarizes the locations of various objects in the C source files named on the command line. All files with a . c or . h suffix are treated as C source files.

How do I download ctags?

Go to the following website and download the latest package labeled Source and binary for Windows: http://ctags.sourceforge.net. If the latest binary package is not available for download, go to the Download section and download the binary package for the previous version of Ctags.


1 Answers

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.

like image 96
Matt Kline Avatar answered Oct 29 '22 16:10

Matt Kline