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 /dhiebert@xxxxxxxxxx.net/
!_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 /dhiebert@xxxxxxxxxxxx.net/
!_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
On Sunday, September 30, 2012 8:32:52 PM UTC-7, happyFace wrote:
> Hi,
> I am trying to get autocompletion working for C files, specifically for structure members.
>
> I installed OmniCppComplete plugin.
> I get "-- Omni completion (^O^N^P) Pattern not found" after I type the "." for a struct variable "foo" as shown below.
> I am using vim 7.3 and exuberant ctags 5.8.
>
>
> -bash-3.2$ cat ~/.vimrc
> " This is a comment
>
> syntax on
> set path=**
> set tabstop=4
> set number
>
> " omnicppcomplete
> set nocp
> filetype plugin on
> -bash-3.2$
>
>
>
> -bash-3.2$ ls
> f1.c f1.h tags
> -bash-3.2$
>
>
> -bash-3.2$ cat f1.h
> typedef struct mystruct {
> int a;
> int b;
> } myType;
>
>
> -bash-3.2$ cat f1.c
> #include "f1.h"
>
> void main (void)
> {
> myType foo;
> foo. <-- as soon as I type the ".", I get Pattern not found!
> }
>
>
> -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 /dhiebert@xxxxxxxxx.net/
> !_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
> myType f1.h /^} myType;$/;" t typeref:struct:mystruct
> mystruct f1.h /^typedef struct mystruct {$/;" s
> mytype f1.c /^myType mytype;$/;" v
> -bash-3.2$
>
>
> -bash-3.2$ ctags --version
> Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
> Compiled: Jul 26 2009, 02:42:37
> Addresses: <dhiebert@xxxxxxxxxxxx.net>, http://ctags.sourceforge.net
> Optional compiled features: +wildcards, +regex
> -bash-3.2$
>
>
> -bash-3.2$ vim --version
> VIM - Vi IMproved 7.3 (2010 Aug 15, compiled May 17 2012 11:09:33)
> Included patches: 1-487
> Compiled by <osstools@xxxxxx.com>
> Huge version without GUI. Features included (+) or not (-):
> +arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset +cindent
> -clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
> +conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con +diff +digraphs
> -dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path
> +find_in_path +float +folding -footer +fork() +gettext -hangul_input +iconv
> +insert_expand +jumplist +keymap +langmap +libcall +linebreak +lispindent
> +listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape
> +mouse_dec +mouse_gpm -mouse_jsbterm +mouse_netterm -mouse_sysmouse
> +mouse_xterm +mouse_urxvt +multi_byte +multi_lang -mzscheme +netbeans_intg
> +path_extra +perl +persistent_undo +postscript +printer +profile +python
> -python3 +quickfix +reltime +rightleft -ruby +scrollbind +signs +smartindent
> -sniff +startuptime +statusline -sun_workshop +syntax +tag_binary
> +tag_old_static -tag_any_white +tcl +terminfo +termresponse +textobjects +title
> -toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo
> +vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp
> -xterm_clipboard -xterm_save
> system vimrc file: "$VIM/vimrc"
> user vimrc file: "$HOME/.vimrc"
> user exrc file: "$HOME/.exrc"
> fall-back for $VIM: "/tools/oss/packages/x86_64-rhel5/vim/7.3/share/vim"
> Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -I/usr/brcm/oss/include -I/usr/brcm/oss/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -I/usr/include -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_LARGEFILE64_SOURCE=1
> Linking: gcc -Wl,-E -L/usr/brcm/oss/lib64 -R/usr/brcm/oss/lib64 -L/usr/brcm/oss/lib -R/usr/brcm/oss/lib -L/usr/lib64 -R/usr/lib64 -L/usr/local/lib -Wl,--as-needed -o vim -lm -lelf -lnsl -lselinux -lncurses -lacl -lattr -lgpm -Wl,-E /tools/oss/packages/x86_64-rhel5/perl/5.8.8-64/lib/5.8.8/x86_64-linux-thread-multi/auto/DynaLoader/DynaLoader.a -L/tools/oss/packages/x86_64-rhel5/perl/5.8.8-64/lib/5.8.8/x86_64-linux-thread-multi/CORE -lperl -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc -L/tools/oss/packages/x86_64-rhel5/python/default/lib/python2.7/config -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -L/usr/lib -ltcl8.4 -ldl -lpthread -lm
> -bash-3.2$
>
> My tags file looks OK to me with the typedef and structure members, etc.
> omnicppcomplete must be working since as soon as I type ".", I get pattern not found (I don't even need to type C-x C-o).
> It is not the "typedef" that is causing me the problem because I have the same problem without it as well (struct mystruct { int a; int b; }; etc).
>
> Any idea how to debug this further? or what is wrong?
>
> Thanks
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
No comments:
Post a Comment