私はvim 7.3で「シンタックス」フォールドメソッドを使用しています。.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 のドキュメントと google を使って 1 時間ツールを使っても、このグループから "fold" 属性を削除する方法を教えてくれませんでした。
言語構文ファイルを編集する唯一の方法はありますか? システム構文ファイルをコピーしてこれを使用する方が見苦しくはないと思いますが、.vimrc のコマンドで特定のグループをオフにできるはずです。