I changed the foldingStartMarker to this: '^.*\bfunction\s*([\$|\w]\w*\s*)?\([^\)]*\)(\s*\{[^\}]*)?\s*$'; The only reason is that now I can fold this funny-named prototype function: function $() Anyway, if you want to commit this change...