我使用vim 7.3中的“syntax”折叠方法。在.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 list cComment相关的语法组。
cComment xxx matchgroup=cCommentStart start=+/\*+ end=+\*/+ extend fold contains
=@cCommentGroup,cCommentStartError,cSpaceError,@Spell
links to Comment
但是,花费一个小时阅读vim文档和通过谷歌搜索,我还不知道如何从这个组中删除"fold"属性。
我唯一的选择是编辑语言语法文件吗?我想拷贝系统语法文件并使用它会更好看一些,但我应该能够通过在我的 .vimrc 文件中使用命令来关闭特定的组。
:help ft-c-syntax
中找到。您还可以使用let c_no_if0_fold = 1
折叠#if 0
样式的注释。 - reasgt