PHP源代码中的三个大括号

Hab*_*wad 23 php vim folding curly-braces

我刚刚从php.net下载了完整的PHP源代码(PHP 5.4.0 [tar.bz2]).它们通常使用三个大括号,如下所示(以下代码片段从ext/ctype/ctype.c中提取.)

/* {{{ proto bool ctype_digit(mixed c)
   Checks for numeric character(s) */
 static PHP_FUNCTION(ctype_digit)
 {
  CTYPE(isdigit);
 }
/* }}} */
Run Code Online (Sandbox Code Playgroud)

有没有人知道为什么他们一起使用这三个大括号?

AD7*_*six 29

它们是vim折叠标记,它们易于折叠并在vim中的三个花括号之间扩展文本,在所示的示例中交替显示:

...

/* {{{ proto bool ctype_digit(mixed c)
   Checks for numeric character(s) */
static PHP_FUNCTION(ctype_digit)
{
    CTYPE(isdigit);
}
/* }}} */

...
Run Code Online (Sandbox Code Playgroud)

只是

...

/* {{{ proto bool ctype_digit(mixed c)

...
Run Code Online (Sandbox Code Playgroud)

如果你查看找到它们的文件末尾,你会经常找到这样的块:

/*
 * Local variables:
 * tab-width: 4
 * c-basic-offset: 4
 * End:
 * vim600: sw=4 ts=4 fdm=marker
 * vim<600: sw=4 ts=4
 */
Run Code Online (Sandbox Code Playgroud)

这是与vim相关的另一个更明显的指标.