Hi there,

I have found a way to do it.
I add following line into the cpp.vim syntax file:
syn match comment "\v(^\s*//.*\n)+" contains=cComentGroup fold extend

Then when open a cpp file, all consecutive "//" comments will auto folded
under syntax foldmethod.

The problem:
To change a syntax file is not remmended method.
Could someone exploit a way of writing something to global or local _vimrc
file to achieve the same object?

B.R
Wayne

On Tue, Aug 10, 2010 at 10:16 AM, Wayne <[email protected]> wrote:

> Hi Jeri,
>
> Sorry, I'm not familiar with fold expression.
> I checked the url you provided,  but nothing useful found related to
> folding c++ style comment.
>
> Thanks anyway.
>
> Wayne
>
>   On Mon, Aug 9, 2010 at 7:12 PM, Jeri Raye <[email protected]> wrote:
>
>> Hi Wayne
>> Can you do something with a fold expression?
>> Assuming that a fold expression works as an extra mode when syntax
>> foldmethod is on.
>>
>> Or something like done in
>> http://vim.wikia.com/wiki/Syntax-based_folding
>>
>> I'm a complete newbie wrt to folding in vim, I'm just experimenting with
>> it.
>>
>> HTH
>> Rgds,
>> Jeri
>>
>>
>> Wayne wrote on 9-8-2010 11:35:
>>
>> Hi there,
>>>
>>> I have a c++ source file, in which there are paragraphs of comments
>>> before
>>> each function to describe it.
>>> I'm used to syntax foldmethod, which can fold the comment of style
>>> /*...*/.
>>> But it can't fold the comment like,
>>> //...
>>> //...
>>> //...
>>>
>>> I don't want to use plugin if any.
>>> Could I write something into the script file( vim_rc ) to fold these
>>> comment?
>>>
>>> Any suggestions are appreciated.
>>>
>>> BR
>>> Wayne
>>>
>>>
>> --
>> You received this message from the "vim_use" maillist.
>> Do not top-post! Type your reply below the text you are replying to.
>> For more information, visit http://www.vim.org/maillist.php
>>
>
>

-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to