如何使用memdelta为xdebug跟踪文件编写Vim foldexpr

如何使用memdelta为xdebug跟踪文件编写Vim foldexpr,vim,trace,xdebug,folding,Vim,Trace,Xdebug,Folding,我对Vim表达式一无所知。我有一个vim foldexpr,它附带了一个用于xdebug跟踪文件的语法文件。现有表达式如下所示: foldexpr=strlen(substitute(substitute(substitute(substitute(getline(v:lnum),'^TR.*$','',''),'\\s>=>','->',\"g\"),'^\\s.\\{20\\}\\(\\s\\+\\)\\?->.*$','\\1',''),'\\s\\s','\',\

我对Vim表达式一无所知。我有一个vim foldexpr,它附带了一个用于xdebug跟踪文件的语法文件。现有表达式如下所示:

foldexpr=strlen(substitute(substitute(substitute(substitute(getline(v:lnum),'^TR.*$','',''),'\\s>=>','->',\"g\"),'^\\s.\\{20\\}\\(\\s\\+\\)\\?->.*$','\\1',''),'\\s\\s','\',\"g\"))-2
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
'^\\s.\\{20,30\\}\\(\\s\\+\\)\\?->.*$'
对于默认跟踪文件,该操作正常,如下所示:

foldexpr=strlen(substitute(substitute(substitute(substitute(getline(v:lnum),'^TR.*$','',''),'\\s>=>','->',\"g\"),'^\\s.\\{20\\}\\(\\s\\+\\)\\?->.*$','\\1',''),'\\s\\s','\',\"g\"))-2
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
'^\\s.\\{20,30\\}\\(\\s\\+\\)\\?->.*$'
等等

但是,如果将Xdebug配置为在跟踪中显示mem delta,则跟踪文件的结果如下(请注意带有内存delta的额外列,例如+80):

有人能告诉我如何修改原始表达式,以便在第二个示例中正确地进行折叠吗?我对这件事一无所知

谢谢你读到的那部分

'^\\s.\\{20\\}\\(\\s\\+\\)\\?->.*$'
正在搜索一行的开头[
^
],然后搜索1个空格[
\\s
],然后搜索任何重复20次的字符[
\\{20\\}
],然后选择一个或多个空格以备以后使用[
\(\\s\\\\\\\\)\?
],最后搜索一个箭头加上任何其他字符,直到行的结尾[
-.$
]。如果您总是要使用额外的列,我只需将20个字符的搜索更改为30个字符,如下所示:

'^\\s.\\{30\\}\\(\\s\\+\\)\\?->.*$'
否则,您可以尝试以下范围:

foldexpr=strlen(substitute(substitute(substitute(substitute(getline(v:lnum),'^TR.*$','',''),'\\s>=>','->',\"g\"),'^\\s.\\{20\\}\\(\\s\\+\\)\\?->.*$','\\1',''),'\\s\\s','\',\"g\"))-2
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
'^\\s.\\{20,30\\}\\(\\s\\+\\)\\?->.*$'
我实际上还没有测试过这些,所以你可能需要稍微调整一下数字,但这应该会让你开始让它工作