On 19/12/08 08:27, [email protected] wrote:
>
> I am trying to create a syntax file and I am having trouble in marking
> out a comment region. The comment starts with an asterisk with the
> first non white space character preceding it (including newlines)   a
> semi-colon. The comment ends with a semi colon.
>
> For example everything between (and including) the asterisk and the
> semi colon is a comment:
> ;
>
>    *safagdgghgh;
>
>
> In contrast, in the following  case the asterisk and the semi-colon do
> not enclose a comment since the first non white space character
> preceding the asterisk is not a semi-colon
>
> 1234*abcd;
>
>
> The contents of my syntax file:
>
> syn case ignore
>
> syn region tComment     start=";\_s*\zs\*"  end="\;"
>
> hi tComment     term=bold cterm=NONE ctermfg=Red ctermbg=Black
> gui=NONE guifg=Red guibg=White
> syn sync fromstart
>
>
> With the above, the following line gets colored correctly:
> ;  *adsafasff;
>
> with everything between the asterisk and the semi-colon colored red.
>
> However, it cannot deal with  line breaks, and the following text
> remains unchanged:
>
> ;
>
> *adsafasff;
>
>
> The regexp starting the comment appears to be finding the right
> pattern..
>
> Is there any way I can handle line breaks?
>
> TIA,

What about (untested)

        syn match tComment /;\_s*\zs\*.\_{-};/
        hi link default tComment Comment

? (You may want to set ":syn sync" to a large-enough "minlines" value.


Best regards,
Tony.
-- 
Plato, by the way, wanted to banish all poets from his proposed Utopia
because they were liars.  The truth was that Plato knew philosophers
couldn't compete successfully with poets.
                -- Kilgore Trout (Philip J. Farmer) "Venus on the Half
                   Shell"

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to