0
I use vim to edit Informix 4GL source code which has this sort of syntax:
FUNCTION FOR ... ... END FOR END FUNCTION
I wish to fold the functions using za zM etc
This works
:set foldmarker=FUNCTION,END\ FUNCTION :set foldmethod=marker
However the keywords can also be in lower case and I'd ideally also like to fold MAIN..END MAIN, so markers are not able to do this.
I tried
:syn region myFun start="FUNCTION" end="END FUNCTION" transparent fold :set foldmethod=syntax
but it had no effect. I already have a syntax file that does color highlighting and :syn
showed myFun
included in the syntax definitions.
How can I configure case-independent syntax folding of FUNCTION...END FUNCTION and MAIN..END MAIN ?
Update: I have tried http://www.vim.org/scripts/script.php?script_id=2287 but it has some problems:
- It folds at a level of detail I don't want (
IF
,FOR
,WHILE
, ...) - It assumes
END
statements start on a new line (soIF a<b call c() END IF
folds to EOF) - It thinks
SELECT * FROM table \n FOR UPDATE
is the start of aFOR
statement
So I'd like to try creating something much simpler first.
What language is this? – digitxp – 2011-08-17T17:17:26.853
Informix 4GL. I have found a syntax file for it but it folds more than I want (IF statements), has bugs (e.g. when "END IF" on same line as "IF", or counts "SELECT * FROM table FOR UPDATE" as start of FOR loop) and doesn't fold FUNCTION! (though the file seems to have code for folding functions) – RedGrittyBrick – 2011-08-17T17:21:48.730
Did you try
set foldmethod=indent
? – romainl – 2011-08-17T20:25:53.267@romainl: I hadn't but I have now. It's not ideal for me but it is useful. Thanks. – RedGrittyBrick – 2011-08-17T23:08:07.497