Yeah. It's awkward to incorporate folding into that. Syntax folding
works well when there are regions, e.g. if you included both the {{{ and
the }}} parts.

The foldexpr option is a better way to go in this case, I think. I'm not
sure the one contributed was quite right, though. Perhaps

   set foldmethod=expr
   set foldexpr=MyFoldLevel(v:lnum)
   func! MyFoldLevel(l)
     let len=strlen(matchstr(getline(a:l),'^-*'))
     if len==0
       return '='
     else
       return len
     endif
   endfunc

Completely untested.

Ben.

> My syntax file looks like the following
> 
> syntax match Lev1 /^- .*{{{1/
> syntax match Lev2 /^-- .*{{{2/    etc

>> To fold based on that definition, you can use
>>
>>   :set foldmethod=expr
>>   :set foldexpr=strlen(matchstr(getline(v:lnum),'^-*'))
>>
>> Without knowing the contents of your syntax file, it's a bit hard
>> to determine how a foldmethod=syntax verions might be folded (pun
>> intended) into your syntax highlighting specification.
>>
>> -tim

>>> - level 1
>>> -- level 2
>>> --- level 3,  etc
>>>
>>> Can use syntax folding instead since I already have a syntax file
>>> setup for highlighting? And how would I do that?




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

Reply via email to