Hi everyone I have been trying to create a syntax file for Inform7 that will include code folding. Unfortunately Vim does not seem to like the fact that Inform7 does not have explicit endings to regions - a section is ended by a new section starting.
Inform7 has sections like this: Section 1 Here is some text. Some more text. Section 2 Some other text. Section headers have a hierarchy: Sections go inside Chapters, then Parts, Books and Volumes. To be valid, a section heading must have a line of whitespace below and above it. My syntax file *almost* does the code folding correctly. I specifies how to fold like this: syn region i7VolumeFold start = /\n^[vV]olume\s/ end=/\ze\n^[vV]olume/ fold transparent contains=ALL keepend syn region i7BookFold start = /\n^[bB]ook\s/ end=/\ze\n^[bB]ook/ fold transparent contains=ALLBUT,i7VolumeFold keepend syn region i7PartFold start = /\n^[pP]art\s/ end=/\ze\n^[pP]art/ fold transparent contains=ALLBUT,i7VolumeFold,i7BookFold keepend syn region i7ChapterFold start = /\n^[cC]hapter\s/ end=/\ze \n^[cC]hapter/ fold transparent contains=ALLBUT,i7VolumeFold,i7BookFold,i7PartFold keepend syn region i7SectionFold start = /\n^[sS]ection\s/ end=/\ze \n^[sS]ection/ fold transparent contains=ALLBUT,i7VolumeFold,i7BookFold,i7PartFold,i7ChapterFold keepend You can get the full syntax file here: http://www.lesismore.co.za/viminform7.html The problem is that if you go to the end of one section (and its text) and insert a new Section heading, Vim doesn't recognise the new fold until you either reload the file or delete and re-insert the empty line directly above the new section heading. I think this is because the end match is multi-line and overlaps the start match. I have tried tens of other variations and not been able to improve the matches above. I think the problem would be solved if Vim could recognise a new section starting and use that to terminate the previous one. Looking at Python syntax files, it looks like people are using huge vimscripts to solve a similar problem - which is a bit of a hack I think. Any ideas? -- 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