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

rea*_*sgt 5 c++ vim

我在vim 7.3中使用了"syntax"foldmethod.在.vimrc中:

set foldmethod=syntax
Run Code Online (Sandbox Code Playgroud)

当我打开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();
}
Run Code Online (Sandbox Code Playgroud)

折叠后我看到以下内容:

+--  5 lines: A function with a multi-line---------------------------------------------
void TheFunction() 
+--  3 lines: {------------------------------------------------------------------------
Run Code Online (Sandbox Code Playgroud)

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

/* 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: {------------------------------------------------------------------------
Run Code Online (Sandbox Code Playgroud)

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

cComment       xxx matchgroup=cCommentStart start=+/\*+ end=+\*/+  extend fold contains
=@cCommentGroup,cCommentStartError,cSpaceError,@Spell
                   links to Comment
Run Code Online (Sandbox Code Playgroud)

但是使用vim文档和google工具一小时左右并没有告诉我如何从这个组中删除"fold"属性.

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

kev*_*kev 5

'foldmethod'设置为"syntax",然后/* */ comments{ } blocks成为折叠.如果您不希望评论成为折叠使用:

:let c_no_comment_fold = 1
Run Code Online (Sandbox Code Playgroud)