On 07/04/09 15:11, Dan Behman wrote:
> Well the thread about highlighting whole lines gave me the idea to use
> :signs to change the background color. So you could change the color for
> individual files.
>
> So using this script, you could color whole buffers differently:
>
> fu! DoColor(int)
> let identifier="bgColor"
> let highlight="WildMenu"
> if a:int
> call ColorBG(identifier, highlight)
> else
> call UnColorBG(identifier)
> endif
> redraw
> endfu
>
>
> fu! ColorBG(id, highlight)
> exe "sign define " . a:id . " linehl=" . a:highlight
> let lnum=1
> while lnum <= line('$')
> exe "sign place " . lnum . " line=" . lnum . " name=" . a:id . "
> buffer=" . bufnr('')
> let lnum += 1
> endwhile
> endfu
>
> fu! UnColorBG(id)
> let lnum=1
> while lnum <= line('$')
> exe "sign unplace " . lnum . " buffer=" . bufnr('')
> let lnum += 1
> endwhile
> exe "sign undefine " . a:id
> endfu
>
> Now calling :call DoColor(1), will color the active buffer and
> :call DoColor(0) will reset the Color.
>
> The only problem with this approach is, if you add lines to the buffer,
> they won't be colored until you do call DoColor(1) again and if you
> delete lines, some signs might not be deleted properly.
>
> I am not sure, if this applies to the :scs command though, as I can't
> test with cscope currently.
>
>
> Excellent thanks! I got this working by using a line like this:
>
> nmap <C-Space>g :scs find g <C-R>=expand("<cword>")<CR><CR> \| :call
> DoColor(1)<CR>
>
> A followup question - DoColor sets the highlight. So there's no way to
> only change the background color and nothing else? What I mean is I
> still want all the nice syntax highlighting in my cscope results buffer
> - I just want to change the background color to something identifiable.
> Is that possible?
>
> Thanks again!
> Dan
>
>
>
> regards,
> Christian
> --
> :wq!
>
What about
fu! DoColor(int, highlight)
let identifier="bgColor"
if a:int
call ColorBG(identifier, a:highlight)
else
call UnColorBG(identifier)
endif
redraw
endfu
?
Best regards,
Tony.
--
Spend extra time on hobby. Get plenty of rolling papers.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---