feature request: ignore fold highlight, use normal highlighting instead

9 views
Skip to first unread message

Jaguar

unread,
Apr 22, 2009, 2:03:28 PM4/22/09
to vim_dev
I would like to be able to highlight folds based on the text displayed
in the fold line, instead of the "Folded" highlight.

Here's my use case:

I created a filetype called "outline". I have folding setup so that
all the lines at indent level "x" will be folded up with the line
above them at indent level "x-1". Like so:

setlocal foldmethod=expr
setlocal foldexpr=(getline(v:lnum)=~'^$')?-1:((indent(v:lnum)/4<indent
(v:lnum+1)/4)?('>'.(indent(v:lnum)/4+1)):indent(v:lnum)/4)
setlocal foldtext=(match(getline(v:foldstart)[0],'\\s')
==-1)?'»'.getline(v:foldstart):substitute(getline(v:foldstart),'\
\s','»','')

So, the following file...

Tasks:
Folding ~ done ~ implement folding for outline filetype
set foldmethod ~ done
set foldexpr ~ done
set foldtext ~ done
Highlighting ~ done ~ implement syntax highlighting for outline
filetype
Highlight based on indent ~ done
Highlight based on keyword ~ done
Fold highlight ~ open ~ Get folded lines to use the right
highlighting
Search docs for solution ~ done: failed
Search wiki for solution ~ done: failed
Search groups for solution ~ done: failed
Make new feature request ~ open
Awesomeness ~ todo ~ Vim bliss

...when folded with "zMzr" will look like this:

Tasks:
» Folding ~ done ~ implement folding for outline filetype
» Highlighting ~ done ~ implement syntax highlighting for outline
filetype
» Fold highlight ~ open ~ Get folded lines to use the right
highlighting
Awesomeness ~ todo ~ Vim bliss

This is all well and good. However, when unfolded, the keywords
"done", "open", and "todo", are highlighted differently. When folded,
the entire line is highlighted with the "Folded" highlight. With a
lot of lines with all the same highlighting, it's hard to pick out the
"done", "open", and "todo" keywords. So, what I want is for the
folded lines to be highlighted based on the foldtext, rather than the
"Folded" highlight.

Jaguar

unread,
Apr 30, 2009, 5:07:45 PM4/30/09
to vim_dev
On Apr 22, 2:03 pm, Jaguar <jhstodd...@gmail.com> wrote:
> I would like to be able to highlight folds based on the text displayed
> in the fold line, instead of the "Folded" highlight.

Another acceptable solution would be if the 'foldtext' option was as
robust as the 'statusline' option. That is, if 'foldtext' could have
options in it like 'statusline's {, and # options. The * option would
be cool too.

Thanks!
Reply all
Reply to author
Forward
0 new messages