On Fri, Aug 04, 2006 at 04:01:38PM -0700, Mohsin wrote:
> 
> On 8/4/06, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:
> >A.J.Mechelynck wrote:
> >> Mohsin wrote:
> >>> I want to use a highlighter mode on my text file, example:
> >>>
> >>> :color_region  bold line1 col1  line2 col2
> >>> :color_region  bold 5 5 6 6
> >>> :color_region underline  5 5 6 6
[snip]
> >>
> >> Vim regexps allow you to specify line and/or column numbers. Example, to
> >> match a block defined by lines 55 to 77, virtual columns 15 to 37, and
> >> highlight it in bold-underlined text:
[snip]
> >>   :highlight User1 term=bold,underline cterm=bold,underline
> >>   gui=bold,underline
> >
> >After testing, the above regexp won't work but this one will:
> >
> >   :match User1 /\%>54l.\%<78l\&\%>14v.\%<39v/
[snip]
> >
> >Best regards,
> >Tony.
> >
> I already tried your solution, it only works for a single region at a time
> On applying the same higlighting to second region and the first one is
> un-highlighted.
> 
> Try this (the third command will unhilight the first region):
> 
>   :highlight User1 term=bold cterm=5 guibg=red
>   match User1 /\%>54l.\%<78l\&\%>14v.\%<39v/
>   match User1 /\%>84l.\%<88l\&\%>14v.\%<39v/
> 
> - mohsin.

     I think that Tony mentioned

:help /\|

in a previous post, but maybe you missed it.  I just tried

:highlight User1 term=bold,underline cterm=bold,underline gui=bold,underline
:match User1 /\%>3l.\%<7l\&\%>3v.\%<7v\|\%>12l.\%<18l\&\%<33v.\%>20v/
                                      ^^

and it marked two rectangular regions in this e-mail.  I admit that this
is just a proof of concept, not very convenient to use.  It should not
be too hard to store a List of Lists, each inner list giving the
boundaries of a rectangle (four Numbers), and then to write a function
that processes this list to :execute the appropriate :match statement.
Then another function could add or remove Lists to the outer List.

:help List      " vim 7.0 only
:help :for      " ditto

     It is also possible to use ":syn match" instead of ":match".  Each
approach has some advantages.  Without knowing how you would want to use
such a feature, I do not know which would be more appropriate.

HTH                                     --Benji Fisher

Reply via email to