Friday 21 January 2011

ctags的指定语言类型

今天用ctags看函数的时候,居然跳转到了html文件里面。
然后man了一下,发现:

By  default,  ctags automatically selects the language of a source file, ignoring those files whose language cannot be determined
默认情况ctags会自动设置源码文件的类型

ctags --list-languages
用这个命令看下支持的语言:
Ant
Asm
Asp
Awk
Basic
BETA
C
C++
C#
Cobol
DosBatch
Eiffel
Erlang
Flex
Fortran
HTML
Java
JavaScript
Lisp
Lua
Make
MatLab
OCaml
Pascal
Perl
PHP
Python
REXX
Ruby
Scheme
Sh
SLang
SML
SQL
Tcl
Tex
Vera
Verilog
VHDL
Vim
YACC

这么多语言,看来ctags把C和html都当成源码了

[The  reason  that  .h  extensions  are  mapped  to C++ files rather than C files is because it is common to use .h extensions in C++, and no harm
 results in treating them as C++ files.]
从上面信息发现.h文件属于C++的

所以用下面这命名重新生成tags文件
ctags -R --langmap=C:.c.h --languages=C *

问题搞定,man才是王道

No comments:

Post a Comment