I did some research and found a way to fix the problem: To stop vim from bending to the end of the file, I had to add the skip instruction for shExpr to the shExpr (in the sh.vim file, usually placed somewhere like /usr/share/vim/vim70/syntax/ ):
syn region shExpr ... start="{" skip="^function.*\_s\={" end="}" ...
This change stops the syntax file, believing that { and } belongs to the shExpr group when they really belong to the function group. Somehow I understood that.
Note. This fix only works for the following syntax:
function test { .... }
and not for this:
function test { .... }
A quick and dirty fix for the last error is to remove shExpr from the @shFunctionList cluster.
source share