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?
nmap <silent> <F4> :call OutlineToggle()<CR>
function! OutlineToggle()
if (! exists ("b:outline_mode"))
let b:outline_mode = 0
endif
if (b:outline_mode == 0)
syn region myFold2 start="foo" end="end foo;" transparent fold
keepend extend
syn sync fromstart
set foldmethod=syntax
let b:outline_mode = 1
else
let b:outline_mode = 0
endif
endfunction
Rgds,
Jeri
--
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