質問

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 *

役に立ちましたか?

解決

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

他のヒント

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

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

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

$ ./ctags --list-maps=CUDA
CUDA     *.cu *.cuh
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top