Hi Brett,
Thanks for excellent explanation!!

So the default OmniCPPcomplete doesn't work with C well and from your
explanation I understand that typedef type syntax wont' go well with
omni complete, Am I right?

I have compiled ctags with default options. I will re-generate tags
with the options mentioned by you and will check omnifeature with
plugin by Vissale Neang.

Once again Thanks!

On May 18, 9:41 pm, Brett Stahlman <[email protected]> wrote:
> On May 18, 1:54 am, KKde <[email protected]> wrote:
>
> > Hi,
>
> > I recently came to know about the Omnicomplete feature and I setup
> > everything as mentioned.
> > I setup tags file that is generated by exuberant ctags v5.7. When I
> > open C file I am able to see the omnifunc is set to
> > ccomplete#Complete.
> > The problem is  when I type any structure variable let say xyz and
> > then '.' and I press CTRL-X CTRL-O then I see the error Omni
> > completion pattern not found.
> > I can see in my tags there is a definition for that structure.
>
> > I am stuck how to resolve this!! Is there any way I can debug the Omni
> > completion process to find out what the problem? Or Can you please
> > tell me what I did wrong??
>
> Here are some notes I jotted down when I got this working some time
> ago. Hope it helps...
> Brett Stahlman
>
> First of all, note that with Vim 7.1, when you edit a C++ file
> (e.g., .cpp or
> .cc), 'omnifunc' is set to
>         ccomplete#Complete
> Note that this is the distributed omnicomplete function for C, written
> by
> Bram. It is defined in the following file:
> $VIMRUNTIME/autoload/ccomplete.vim
> Problem: Although the C version can display class members, it won't do
> so
> unless you declare the class variable with "class MyClass" (as opposed
> to
> simply "MyClass"). This was *extremely* disconcerting until I figured
> out what
> was going on.
> Solution: Use the omnicppcomplete plugin, by Vissale Neang. This
> plugin is C++
> aware, and may also be used for C. It understands inheritance, "this"
> pointers, namespaces, etc...
> Limitations: It's not fully functional with templates (supposedly
> because of
> limitations in exuberant ctags). So far, the only template limitation
> I've
> encountered is that "this" pointers aren't completed properly within
> method
> implementations.
>
> How-it-works: The omnicppcomplete plugin, which consists of a number
> of Vim
> script files, implements an 'omnifunc' function (using the autoload
> mechanism)
> that handles completion for <C-X><C-O>, and also defines insert mode
> mappings
> for '.', '->', and '::', to ensure that completion is performed
> automatically
> when those characters are typed, without the need for the user to hit
> <C-X><C-O>.
>         :help i_CTRL-X_CTRL-O
>         :help 'omnifunc'
>         :help complete-functions
>
> The omnicppcomplete plugin's 'omnifunc' function first attempts to
> determine
> what sort of lookup needs to be performed, based upon the surrounding
> context,
> then performs the lookup in the tags file(s) specified in the 'tags'
> option.
> Important Note: For C++ completion to work properly, the tags database
> must
> contain some information that's not available by default: i.e., you
> must run
> ctags with certain options. These option values weren't even available
> in
> older versions of ctags. Bram added support for them in a ctags patch
> around
> ctags version 5.5.4. (Current version of ctags is 5.7, and the patch
> is no
> longer required.)
>
> *** Command-line-invocation-of-ctags ***
> ctags --c++-kinds=+p --fields=+iaS --extra=+q test1.cpp
>
>
>
> > Regards,
> > Sarath
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to