On Wed, July 22, 2009 2:12 pm, Jan Kaspar wrote:
> I'd like to give a different background color to a block of code (a class
> definition, doxygen documentation, etc). To do so, I use :highlight ...
> guibg=... command. This works, but only the part of line which contains
> some text, is eventually highlighted. This looks strange and disturbs
eyes. I'd
> like get also the part from line-end onwards highlighted. Is that
> possible?
> How?

See, if this works:


hi SignLineBG guifg=white guibg=DarkRed

fu! InitSigns()
    if has("signs")
        sign define HiLine linehl=SignLineBG
        return 1
    else
        echohl WarningMsg | echomsg "Signs Feature not available. You need at
least a Big version of vim" | echohl None
       return 0
    endif
endfu

fu! ColorLine(flag) range
    if InitSigns()
        for i in range(a:firstline, a:lastline)
            if a:flag
                exe "sign place " . i . " line=" . i . " name=HiLine buffer=" .
bufnr(expand("%"))
            else
                exe "sign unplace " . i . " buffer=" . bufnr(expand("%"))
            endif
        endfo
    endif
endfu

comm! -range Color <line1>,<line2>call ColorLine(1)
comm! -range UnColor <line1>,<line2>call ColorLine(0)

regards,
Christian


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

Reply via email to