> I tried the following
> 
> set foldmethod=expr
> strlen(matchstr(getline(v:lnum),'^-*\\ze\\s'))
> 
> but it only seems to match the single line. It doesn't fold any of the
> text below that line unless it is a lower level heading. How do I get
> it to fold the text below the heading.

Ah...I must have missed that some lines don't begin with "-"s, 
and that the subsequent lines should be indented at the same 
level.  Though absolutely hideous, you might try the following:

foldexpr=strlen(matchstr(getline(v:lnum),'^--*\\ze\\s'))>0?strlen(matchstr(getline(v:lnum),'^-\\+\\ze\\s')):'='

that's

strlen(matchstr(getline(v:lnum),'^--*\\ze\\s'))>0
?
strlen(matchstr(getline(v:lnum),'^--*\\ze\\s'))
:
'='

making use of the ternary operator to check if you've got a 
leading "-", and if not, use the indentation of the line above ("=")

-tim



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

Reply via email to