Saturday, April 16, 2016

Re: question on VIM syntax: highlight an entire paragraph

2016-04-17 2:05 GMT+03:00 Jose Caballero <jcaballero.hep@gmail.com>:
>
>
>
>
>
> Is it possible to highlight an entire paragraph based on a single line
> content?
>
> I would be interested in changing the color of an entire block of
>
> configuration lines if one of those lines in the block is "enabled =
>
> False", for example.
>
>
> I am so new to this (*) that I am not even sure what would be the key
>
> words to search for it on google.... So any tip or advice is more than
>
> welcome.
>
>
> What is a "paragraph"? Also what exactly you mean by "highlight",
>
>
>
> Fair questions, I guess. I will try to be more clear.
>
> I would like to have a VIM syntax file that changes the color or entire
> paragraphs (a set of lines between two blank lines) if one of the lines in
> the paragraph matches pattern
> "enabled = False".

This is going to be slow:

" Need average length of such enabled section in place of 50
syntax sync minlines=50
syntax match PreProc /\%(\%^\|^$\n\)\@2<=\%(.\+\n\)*enabled =
False\n\%(.\+\%(\n\|\%$\)\)*\%(\n\|\%$\)\@1=/

Since syntax is highlighted from top to bottom I do not know any other
way. Would suggest using `:syntax region` if `enabled = False` was
always at the top.

>
> I hope now I explained myself better.
>
> Jose
>
> --
> --
> 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.

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

Post a Comment