On 13-Jan-2012 20:23 -0800 (PST), Ben Fritz wrote:

> On Jan 12, 9:39 am, jimrandomh <jimrand...@gmail.com> wrote:
>> I'm currently working on a folding-related plugin. Its main function
>> is to generate good folds from syntax, spanning a function, its header
>> comment, and one blank line after, so that a folded-up file ends up
>> looking like a table of contents; each function takes exactly one
>> line, and the only stuff that ends up unfolded is header comments and
>> blank lines that serve to group them into sections. It also generates
>> good summary lines; when you fold up a function, it replaces it with
>> its prototype, and also extracts comments like //TODO and //FIXME in
>> the body and adds them to the summary.
>>
>> I would like to use color in the summary line, but I've run into
>> trouble there. I want to make todo's and fixme's bold, like in the
>> unfolded version, highlight keywords and tags, and dim some other
>> information like length that would otherwise be intrusive.
>> Unfortunately, the syntax-highlighting system just colors the whole
>> line with the 'Folded' color. Using "syntax match regex
>> containedin=Folded" doesn't seem to do anything useful, and the
>> foldtext option (which I use to call the function that generates the
>> summary line) only lets me return a string. So I don't seem to be able
>> to do this. What I'd ideally like to do, is put some special sequences
>> in foldtext's return value.
>>
>> Any ideas for how to get multicolor foldtext? And if it's currently
>> impossible, as I suspect, any chance of adding it in a future version?
> 
> This is not currently possible. I vaguely remember seeing a patch
> which added the ability to have different colored fold text, but I
> think that may have been just based on fold level or something, not
> actually different colors within a fold. I cannot seem to find the
> list of unofficial patches which used to be on this list's home page
> to verify...

Yes, that patch was for highlighting based on foldlevel. I think totally
flexible contained highlighting would be difficult to implement, and also to
configure. (Maybe a concept of nested highlight groups, (like "H1 B" or "OL >
LI" in Cascading Style Sheets) would help).

However, for the OP's purpose (and other uses of folding), it would already be
helpful if highlighting of folded text could be transparent, so that the
original syntax definitions would apply. (You cannot simply achieve this via
":hi clear Folded".) Somewhat related, I have once wished for some uses of
folding that (the first) sign contained within a closed fold could be made 
visible.

-- regards, ingo

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to