'Annis Monadjem' via vim_use wrote:
> 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.
>
Nothing perfectly attuned, but some notes:
* First, just in case you're not aware, :set hls will turn highlighting
on for searched patterns
* One can avoid some comments with LogiPat: :LP "your-pattern-here" &&
!"/\*" && !"\*/" && !"//" (this is line based, however)
(http://www.drchip.org/astronaut/vim/index.html#LOGIPAT)
* Dave Fishburn's SrchRplcHiGrp.vim plugin
(http://www.vim.org/script.php?script_id=848) can search and replace for
specified highlighting groups. Perhaps you could use it to do a
decorate, match/highlight your pattern not having the decoration
(perhaps with LogiPat), then remove the decoration. The decoration
should be something unlikely to occur in your file (@@@, for example).
Regards,
Chip Campbell
--
--
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.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment