解决omnicppcomplete显示"pattern not found"

  其实是tags文件有问题,确切说是生成tags文件时,使用的命令行参数有问题。

  我最开始这样:ctags -R -f ~/.vim/tags/c 。很好笑吧,我就为它折腾了半个下午。

  是在google上看了一篇帖子,改成:ctags -R -f ~/.vim/tags/c  --C-kinds=+p --fields=+aS --extra=+q就好了。

  原帖答案贴过来(是他自问自答):

I found the problem.

My tags file is NOT Ok as I thought.
Incorrect version generated with:
ctags -R --C-kinds=+p --field=+S

This generates this tags file:
-bash-3.2$ cat tags
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR Darren Hiebert /[hidden email]/
!_TAG_PROGRAM_NAME Exuberant Ctags //
!_TAG_PROGRAM_URL http://ctags.sourceforge.net        /official site/
!_TAG_PROGRAM_VERSION 5.8 //
a f1.h /^ int a; $/;" m struct:mystruct
b f1.h /^ int b;$/;" m struct:mystruct
main f1.c /^void main (void)$/;" f signature:(void)
myType f1.h /^} myType;$/;" t typeref:struct:mystruct
mystruct f1.h /^typedef struct mystruct {$/;" s
-bash-3.2$

tags that works for this particular example were generated with:
ctags -R --C-kinds=+p --fields=+aS --extra=+q

-bash-3.2$ cat tags
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR Darren Hiebert /[hidden email]/
!_TAG_PROGRAM_NAME Exuberant Ctags //
!_TAG_PROGRAM_URL http://ctags.sourceforge.net        /official site/
!_TAG_PROGRAM_VERSION 5.8 //
a f1.h /^ int a; $/;" m struct:mystruct access:public
b f1.h /^ int b;$/;" m struct:mystruct access:public
main f1.c /^void main (void)$/;" f signature:(void)
myType f1.h /^} myType;$/;" t typeref:struct:mystruct
mystruct f1.h /^typedef struct mystruct {$/;" s
mystruct::a f1.h /^ int a; $/;" m struct:mystruct access:public
mystruct::b f1.h /^ int b;$/;" m struct:mystruct access:public
-bash-3.2$

The help file in omniCppComplete plugin (in .vim/doc/ folder) calls for:
ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .

I had assumed that since I am not using C++ (simply C), that the +ia in --fields and +q in --extra would be irrelevant.

Thanks

posted on 2013-04-06 19:06  weiweishuo  阅读(2601)  评论(0编辑  收藏  举报

导航