Is there any way to search a string in a C/C++ source file while skipping commented lines?
Here is how I would proceed:
%s
)/
m a
(to set the mark "a")u
delm a
(it would be overwritten in the case you don't delete it, so no big deal)Of course you can do that in one big operation/function. I do not master Vim scripting good enough to give an example of that though.
I admit my solution is a bit "lazy" (and you can probably do it way better) but that's all I came to.
Hope it helps.