VIM语法折叠:禁用折叠多行注释



我在vim 7.3中使用了"语法"foldmethod。In.vimrc:

set foldmethod=syntax

当我打开Test.cpp时,包含:

/* A function with a multi-line
 * comment. This takes at least
 * four lines and I want to be
 * able to read all of them.
 */
void TheFunction()
{
  DoStuff();
}

折叠时我看到以下内容:

+--  5 lines: A function with a multi-line---------------------------------------------
void TheFunction() 
+--  3 lines: {------------------------------------------------------------------------

我喜欢功能体折叠,但不喜欢评论折叠。我想禁用它,所以它看起来像这样:

/* A function with a multi-line
 * comment. This takes at least
 * four lines and I want to be
 * able to read all of them.
 */
void TheFunction() 
+--  3 lines: {------------------------------------------------------------------------

我该怎么做?我可以看到与以下内容相关的语法组:syn-listcComment

cComment       xxx matchgroup=cCommentStart start=+/*+ end=+*/+  extend fold contains
=@cCommentGroup,cCommentStartError,cSpaceError,@Spell
                   links to Comment

但是,使用vim文档工作了一个小时,谷歌还没有告诉我如何从这个组中删除"fold"属性。

我唯一的办法真的是编辑语言语法文件吗?我想复制系统语法文件并使用它不会那么难看,但我应该能够用.virc.中的命令关闭特定的组

'foldmethod'设置为"syntax"时,/* */ comments{ } blocks将成为一个褶皱。如果你不想评论变成折叠使用:

:let c_no_comment_fold = 1

最新更新