Monday, August 8, 2011

ctags, cscope and member functions

Suppose you have the following file and generated tags for ctags or
cscope database.

struct MyStruct
{
void my_function() {}
};

void my_function() {}

int main()
{
MyStruct s;
s.my_function();
}

:tselect my_function will propose to choose between both my_function
definitions.

Is there something possible to tell ctags or cscope that we know the
function we search is member of MyStruct?
Using something like :tselect MyStruc.function() or tselect
s.my_function()?

While using omnicpp for completion it seemed to be able to handle that
sort of thing (and omnicpp does use ctags database) so I thought that
maybe it was possible too for jumping to definition.
Now I use clang complete that seems more efficient, but the plugin does
not provide jumping utilities it seems (I don't know if it is the same
kind of problem).

Another little question about c++ (and more generally matching object {}
[], (), ...)
While using { }, vim has an automatic mechanism to select the matching
{ }. That's very useful but it has also one drawback. With my (default)
configuration (vim in xterm with dark background) the { under the cursor
is printed in white on green while } is printed in green on white. As I
think green on white "flash" more I'm often wrong thinking the cursor is
on } while I am on {.
If someone experiencing the same problem found a better way of handling
colors in this case I'm interested.

--
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: