Loading ...
Sorry, an error occurred while loading the content.

feature request: ignore fold highlight, use normal highlighting instead

Expand Messages
  • Jaguar
    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
    Message 1 of 2 , Apr 22, 2009
    • 0 Attachment
      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.

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Jaguar
      ... 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
      Message 2 of 2 , Apr 30, 2009
      • 0 Attachment
        On Apr 22, 2:03 pm, Jaguar <jhstodd...@...> 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!
        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_dev" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      Your message has been successfully submitted and would be delivered to recipients shortly.