Sunday, August 23, 2015

vim - how to enable searching in vim editor and finding/highlighting pattern that is only in non-commented block/line

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.

I often use *, #, g*, g# but these find every pattern also in commented blocks/lines of code.

Also, I frequently use plugins CltrP, CTags and taglist but these also have the same problem of finding every possible found pattern also in commented blocks/lines of code. Additionally, the Ctrl-] and Ctrl-T find the original point where a variable was declared (in Java).

When writing and reading through Java source code I find it necessary to search for where in the file(s) a variable has been declared, initiated and perhaps modified. Often variables/functions are modified not once and initialization might not be done same place where it has been declared.

What current I do is to find the declaration of an existing variable by using Ctrl-] then i come back using Ctrl-T. Then to see where it has been perhaps initiated and changed I use * and #. But these last two find all patterns also in commented blocks/lines (where compiler does not read and where I am not interested to scroll/read).

Is there a more productive way of searching/highlighting patterns of text that appear in a file only in non-commented blocks/lines.

Thanks in advance,
Annis

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: