ctags in sublime text
Asked Answered
D

2

30

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?

Dictograph answered 29/2, 2012 at 1:23 Comment(7)
StackOverflow is more a site for programming questions, not questions about programs for programming. You might want to try SuperUserPseudocarp
i posted it here because here in stackoverflow there are 99 question about ctags in superuser only 14. by the way, i just posted it in superuserDictograph
try "extra_tag_paths" : ["/absolute_path_of_my_cpp_framework/tags"]Venation
Why not post this in the sublime forums? This does sound just like a question for that place...Knelt
open up the sublimetext console and invoke the plugin and you'll see any possible errors that might have occurred.Gremial
Hm, not sure about ctags, but have you tried github.com/quarnster/SublimeClang?Childress
clang uses llvm machine and i don't need it, and it does not fit very well with some project i have to deal withDictograph
B
7

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.

Barogram answered 30/4, 2012 at 16:53 Comment(0)
D
2

Shell Commands:

$ cd /absolute_path_of_my_cpp_framework/ (1)

$ ctags -R --languages=c++ --langmap=c++:+.inl --fields=+iaS --extra=+q --totals=yes --verbose=yes (2)

$ ctags -a -R --languages=c++ /usr/include/c++/4.4.5/ --fields=+iaS --extra=+q --totals=yes --verbose=yes (3)

$ subl . (4)

Description:

(1) Go to the root folder of your project to ensure that the tags file will be created there.

(2) Generate a new tags file for all C++ files in your project, adding support for .inl files, inheritance, access modifiers, class-qualified scoping etc.

(3) Append tags for the C++ standard lib headers to your generated tags file.

(4) Open the folder in Sublime Text.

References:

  1. http://ctags.sourceforge.net/ctags.html
  2. https://www.chromium.org/developers/sublime-text
  3. http://www.tarosys.com/2014/07/adding-another-file-type-for-ctags.html
  4. Exuberant ctags exclude directories
  5. Vim and Ctags: Ignoring certain files while generating tags
  6. https://www.topbug.net/blog/2012/03/17/generate-ctags-files-for-c-slash-c-plus-plus-source-files-and-all-of-their-included-header-files/
Damian answered 24/2, 2016 at 10:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.