specialized searching in C++

29 views
Skip to first unread message

kamaraju kusumanchi

unread,
May 5, 2016, 12:15:02 AM5/5/16
to v...@vim.org
Is it possible to search for a string foo with in the class bar while
working with C++ header files?

In C++, a class is written as

class bar
{
var1;
var2;
...
func1();
func2();
...
};

and a typical header file will contain many such classes. Obviously, I
am oversimplifying things here. But the idea is to do something like

/bar::foo

where foo will be searched with in the text enclosed by { and } that
belongs to class bar. The header file may have many other hits for
"foo" outside the class definition. But I am not interested in those.
Any ideas on how to achieve something like this?

thanks
raju
--
Kamaraju S Kusumanchi | http://raju.shoutwiki.com/wiki/Blog

Eike Rathke

unread,
May 5, 2016, 3:05:58 PM5/5/16
to v...@vim.org
Hi kamaraju,

On Thursday, 2016-05-05 00:14:28 -0400, kamaraju kusumanchi wrote:

> Is it possible to search for a string foo with in the class bar while
> working with C++ header files?
> [...]
> and a typical header file will contain many such classes. Obviously, I
> am oversimplifying things here. But the idea is to do something like
>
> /bar::foo

Let Exuberant Ctags create a tags file using the options
--c++-kinds=+p --fields=+iaS --extra=+q
and then in vim use

:ts bar::foo

to jump to the declaration or definition. The ctags options are actually
copied from those required by the OmniCppComplete plugin.

Eike

--
OpenPGP/GnuPG encrypted mail preferred in all private communication.
Key "ID" 0x65632D3A - 2265 D7F3 A7B0 95CC 3918 630B 6A6C D5B7 6563 2D3A
Better use 64-bit 0x6A6CD5B765632D3A here is why: https://evil32.com/
Care about Free Software, support the FSFE https://fsfe.org/support/?erack
Use LibreOffice! https://www.libreoffice.org/
signature.asc
Reply all
Reply to author
Forward
0 new messages