Thursday, August 12, 2010

Re: folding question

> or else (untested)
>
>        syn region vhdlFold
>                \ start='\z(\<if\>\)'
>                \ end='\<end\s\+\z1'
>                \ contains=vhdlFold
>                \ fold transparent
>
> to make it recursive?
>
>
> Best regards,
> Tony.
> --

Unfortantly the adding of \ contains=vhdlFold doesn't do the trick.
I have now the following:

syntax match vhdlEndIf "end\s\+if"
syn region vhdlFold
\ start="\z(if\)"
\ end="end\s\+\z1"
\ contains=vhdlFold
\ fold transparent
\ keepend

The following text
######### Start of text #########
if
if

end if
end if
######### End of Text #########

folds into:
######### Start of text #########
+-- 4 lines: if-----------------
end if
######### End of Text #########
Notice the not included 'end if'

However if I open a c file it does include the closing bracket char '}'

The following text:
######### Start of text #########
if (c = 'a')
{
if
{
}
}
######### End of Text #########

Folds in:
######### Start of text #########
if (c = 'a')
+-- 6 lines: {-----------------
######### End of Text #########
Notice the including closing bracket }

When I look into the c.vim file in "C:\Program
Files\Vim\vim72\syntax\c.vim" on my windows XP PC I can't discover why
it works on a c-file. It might be, but I'm not sure, because of the
following code, but I can't make this work for VHDL.

Out c.vim:
######### Start of text #########
[...]
" This should be before cErrInParen to avoid problems with #define ({ xxx })
if exists("c_curly_error")
syntax match cCurlyError "}"
syntax region cBlock start="{" end="}"
contains=ALLBUT,cCurlyError,@cParenGroup,cErrInParen,cCppParen,cErrInBracket,cCppBracket,cCppString,@Spell
fold
else
syntax region cBlock start="{" end="}" transparent fold
endif
[...]
######### End of Text #########

Any idea why?

Best Regards,
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

No comments: