vim 使用 ctags 的问题[已解决]

Vim、Emacs配置和使用
回复
antonym55
帖子: 353
注册时间: 2007-04-03 9:52
联系:

vim 使用 ctags 的问题[已解决]

#1

帖子 antonym55 » 2007-05-17 6:30

为 vim 装了 OmniCppComplete插件,

为测试stl 的效果,使用下面的命令生成了一个stl的tag,

代码: 全选

ctags -R  --c++-kinds=+p --fields=+iaS --extra=+q  -f ~/.vim/stltags /usr/include/c++/4.1.2
并在~/.vimrc 中设置了

代码: 全选

set tags+=~/.vim/stltags
发现ctags 对没有.h的 c++头文件处理不是很好(也有可能是自己用错命令)
只有string(basic_string.h) 能自动完成, map, vector, set 等都不能正常使用。

请问这个问题该如何解决,谢谢!
上次由 antonym55 在 2007-05-18 20:56,总共编辑 1 次。
antonym55
帖子: 353
注册时间: 2007-04-03 9:52
联系:

#2

帖子 antonym55 » 2007-05-18 20:56

已解决,写信问了作者
具体解决方法请参见作者的邮件
=============
Hello,

Here is what I do, this solution works both for windows and unix system :

1) Download SGI's STL from SGI's site
( http://www.sgi.com/tech/stl/download.html)
2) With vim replace all __STL_BEGIN_NAMESPACE by "namespace std {" and
__STL_END_NAMESPACE by "}" (I use a macro to do this but maybe there
is a better way eg: the command :bufdo) from header and source files.
3) Run ctags and put the generated tags file in a directory eg:
~/MyTags/stl.tags
4) set tags+=~/MyTags/stl.tags

The main problem is that you can't tell to ctags that
__STL_BEGIN_NAMESPACE = "namespace std {" even with the option -I.
That's why you need the step 2).

Best regards,

Vissale
minjun
帖子: 47
注册时间: 2005-12-18 17:18

#3

帖子 minjun » 2007-05-25 23:35

不错的方法,多谢分享 :D :D
头像
kofshower
帖子: 1343
注册时间: 2007-03-13 11:23
联系:

#4

帖子 kofshower » 2008-06-29 7:05

不需要--language-force=c++么,我使用的时候加上这个了。生成的tag是正确的
上次由 kofshower 在 2008-06-30 12:37,总共编辑 1 次。
liu1061
帖子: 31
注册时间: 2008-06-02 12:44

#5

帖子 liu1061 » 2008-06-30 10:48

antonym55
我用这个方法生成的tags好像问题,但有不知问题在那里!
你能不能发个stl tags文件给我呀! 最近在用stl, 在vim下
没有提示真的好难做! 非常感谢!!!
回复