For this, I use an IDE, though there may be other ways.
Specifically, I use Eclipse, along with Eclim, to allow me to navigate the results in Vim and just keep Eclipse running in the background.
Hi,
I am looking for a way to search in vim editor and to find text highlighted only for pattern found in non-commented blocks/lines.
...
Is there a more productive way of searching/highlighting patterns of text that appear in a file only in non-commented blocks/lines.
The commands at :help include-search do exactly that.
:ilist foo
will list:
bar baz foo
foo bar baz
but not:
// foo does this
The "d" variants of those commands are particularly useful for programming.
This might need a bit of setup, though, but not much.
FWIW, I wrote http://www.vim.org/scripts/script.php?script_id=5214 to be able to use the quickfix list/window with :ilist, :dlist and friends.
With the trag[1] plugin you could do:
:Trag -i PATTERN
This will search all files in the current project though and not just the current buffer.