Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ctags+taglist for .cu (CUDA) files

I use the vim editor (on Ubuntu). Recently, I have been working with large cuda projects and hence would like to utilize the ctags utility for code browsing. The list of supported languages for exuberant-ctags [here] (http://ctags.sourceforge.net/languages.html) doesnt contain CUDA as of yet. If anyone knows a tweak to do the same, I'd really appreciate the help.

Thanks

EDIT 1: I found the following temporary fix.

To create the tag file for CUDA files, use ctags with the following option (assuming your current directory contains all your cuda files);

$ctags --langmap=c++:+.cu *

like image 367
Abhinav Avatar asked Apr 23 '12 09:04

Abhinav


4 Answers

Since CUDA C/C++ is based on C++ you can just use C++ mode. You can add the language map using --langmap=c++:+.cu.

like image 188
Tom Avatar answered Oct 18 '22 01:10

Tom


universal-ctags(https://ctags.io) has built-in parser for cuda.

$ ./ctags --list-maps=CUDA
CUDA     *.cu *.cuh
like image 44
Masatake YAMATO Avatar answered Oct 18 '22 03:10

Masatake YAMATO


I don't know about taglist, but if you are using the Tagbar plugin (a redo of taglist), you can add the following line to .vim/autoload/tagbar.vim:

let s:known_types.cuda = type_cpp

Put it right after the line:

let s:known_types.cpp = type_cpp

like image 45
kedakeda Avatar answered Oct 18 '22 03:10

kedakeda


For taglist split window, you can add following lines

" cu language
let s:tlist_def_cu_settings = 'c++;n:namespace;v:variable;d:macro;t:typedef;' .
                         \ 'c:class;g:enum;s:struct;u:union;f:function'

below

" c++ language
let s:tlist_def_cpp_settings = 'c++;n:namespace;v:variable;d:macro;t:typedef;' .
                             \ 'c:class;g:enum;s:struct;u:union;f:function'

in taglist.vim

like image 24
Angie Chiang Avatar answered Oct 18 '22 02:10

Angie Chiang