I know nothing about Vim expressions. I have a vim foldexpr that comes with a syntax file for xdebug trace files. The existing expression looks like this:
foldexpr=strlen(substitute(substitute(substitute(substitute(getline(v:lnum),'^TR.*$','',''),'\\s>=>','->',\"g\"),'^\\s.\\{20\\}\\(\\s\\+\\)\\?->.*$','\\1',''),'\\s\\s','\',\"g\"))-2
That works OK for default trace files, which look like this:
0.0974 3908596 -> GenericDispatcher->dispatch() /home/tomw/source/public_html/main.php:49
0.0975 3908676 -> ReflectionClass->getMethods() /home/tomw/source/presentation/framework/routing/GenericDispatcher.php:59
0.0975 3910532 -> ReflectionFunctionAbstract->getName() /home/tomw/source/presentation/framework/routing/GenericDispatcher.php:60
etc.
However, if you configure Xdebug to show mem deltas in the trace, the trace files end up like this (note the extra column with memory deltas, eg. +80):
0.0964 3908336 +84 -> GenericDispatcher->dispatch() /home/tomw/source/public_html/main.php:49
0.0965 3908416 +80 -> ReflectionClass->getMethods() /home/tomw/source/presentation/framework/routing/GenericDispatcher.php:59
0.0965 3910272 +1856 -> ReflectionFunctionAbstract->getName() /home/tomw/source/presentation/framework/routing/GenericDispatcher.php:60
Can anyone tell me how to modify the original expression so that folding works properly in the second example? I can't make head nor tail of it.
Thanks