Hi Jeri! On Mo, 09 Aug 2010, Jeri Raye wrote:
> Hi, > > I'm trying to make a fold region that looks for the following > - when a line contains the word "foo" that's the start of the fold > - when one or more lines later the word "end" is found that should > close the line > - or when the words "end <with one or more space char> foo" is found > that should close the line > > So the following should work: > foo > .... > end > > must be come > +--- x lines: foo > > Secondly: > foo > .... > end foo > must become > +--- y lines: foo > > Last: > <some text(not the word end)> foo <some other text> > .... > end foo > must become > +--- z lines: foo > > What happens is that my function folds everything. > What is wrong with my function? > I assume it trips over the "end" and "foo". > How to make the combination "end" and "foo" exclusive as ending-fold? How aboutusing fold-expression? Something like this: fu! MyFL1(lnum) if getline(a:lnum) =~ 'foo' return 'a1' elseif getline(a:lnum) =~ 'end' return 's1' else return '=' endif endfu set fde=MyFL1(v:lnum) regards, Christian -- 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