On Wed, July 22, 2009 4:22 pm, Jan Kaspar wrote:
> On Wed, Jul 22, 2009 at 3:27 PM, Christian Brabandt
>
> Many thanks for your code. I put it in my syntax file c.vim and
> replaced both occurencies of SignLineBG with CommentDocu which is
> defined as syn region CommentDocu start='/\*\*' end='\*/' Having
> issued :syn on, the comments get white on red background, but the
> background stops at the last character on each line. Thus, I'd tend to
> say that the script is not working properly. Or have I done something
> wrong?

Yes. The script was meant to be used interactively. So you do :1,10Color
and the first 10 lines are completly colored with the hilighting you
define in the first line. I have tested it here and it works¹

Well you want all comment regions to be colored differently, right?
Change the function ColorLine(flag) to:

,----
|fu! ColorLine()
|     for i in range(line('.'))
|       if synIDattr(synID(i,col(0), 1), 'name') !~ 'CommentDocu'
|           continue
|       endif
|       exe "sign unplace " . i . " buffer=" . bufnr(expand("%"))
|     endfo
|  endfu
|
|if InitSigns()
|    call ColorLine()
|endif
`----

Note, I haven't tested this script, but I think it should work. But
remember, the highlighting might get out of sync, if you are interested
in the syncing function, I'll can post it here, too.

regards,
Christian

__
¹)The script has the drawback, that the lines might become out of sync
when you change the buffer, therefore I have extended it to resync it,
using Auto-Events. If someone is interested, tell me and I can repost
the script.


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

Reply via email to