Re: Creating a syntax file with folding
On 8/15/06, Charles E Campbell Jr <[EMAIL PROTECTED]> wrote: syn clear syn region xBlock transparent fold matchgroup=Delimiter start="begin" end="end" contains=xBlock Regards, Chip Campbell I do believe you are a genius. Thanks. Marius
Re: Creating a syntax file with folding
Marius Roets wrote: I am trying to create a syntax file with folding. However after pouring over the documentation for hours, I seem to be stuck. I want to, for instance, fold a begin/end block. I have created a simple syntax file with just this line: syntax region xBlock start="begin" end="end" transparent contains=xBlock,xKeyword fold As expected, this works well. However 'begin' and 'end' are keywords. ..snip.. Hmm, but they're not keywords, at least in the syntax file "with just one line" that you provided. If they are keywords, ie. you're involving more syntax, then: keywords have priority. Consequently, your region will not start. Priority: * keywords, later ones have higher priority * matches and regions, later matches and regions have priority over other matches and regions. In effect, regions' start and end patterns are special kinds of matches. So, let me guess: you want a new syntax line such as syn keyword xKeyword begin end because you wish to highlight the words "begin" and "end" differently. May I suggest using the "matchgroup" specification: ie. syn clear syn region xBlock transparent fold matchgroup=Delimiter start="begin" end="end" contains=xBlock Regards, Chip Campbell
Creating a syntax file with folding
Hi everybody, I am trying to create a syntax file with folding. However after pouring over the documentation for hours, I seem to be stuck. I want to, for instance, fold a begin/end block. I have created a simple syntax file with just this line: syntax region xBlock start="begin" end="end" transparent contains=xBlock,xKeyword fold As expected, this works well. However 'begin' and 'end' are keywords. So I add: syntax keyword xKeyword begin This breaks the fold. It no longer sees the begin. I changed it to syntax match xKeyword "\" And now it works again. Now for 'end'. I know that defining it as a keyword is problematic, so I do a match again. syntax match xKeyword "\" This breaks the fold again however. Even though every 'begin' starts a new fold, 'end' doesn't end them. I tried adding keepend to the region, but then the first 'end' ends all folds. There must be something that I am not understanding. Any help would be appreciated. I have included a file I have used to test. Thanks Marius # Test file # function myFunction begin some code; command; and ; other stuff; begin a new block; end; and some; more stuff; end;