Monday, March 1, 2010

Re: Fold according to keyword before fold mark?

Hi!

On Mo, 01 Mär 2010, fkater@googlemail.com wrote:

> I look for a way to fold/unfold ALL folds belonging to the same "type"
> of fold (indicated e.g. by a leading keyword before the fold mark), so
> see only those folds of interest.

Does that work:
#v+
fu! MyFL(lnum)
if getline(a:lnum) =~ '{$'
return 'a1'
elseif getline(a:lnum) =~ '}$'
return 's1'
elseif getline(a:lnum) =~ '^[0-9/]\+$'
return '1'
elseif getline(a:lnum) =~ '^$'
return '0'
else
return '='
endif
endfu

set fdm=expr foldexpr=MyFL(v:lnum)
#v-

regards,
Christian
--
:wq

--
You received this message from the "vim_use" 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

No comments:

Post a Comment