Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
how fold all comment line?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
王军  
View profile  
 More options Nov 15 2012, 2:05 am
From: 王军 <wangjun850...@gmail.com>
Date: Thu, 15 Nov 2012 15:05:33 +0800
Local: Thurs, Nov 15 2012 2:05 am
Subject: how fold all comment line?

Hi everyone:

    I want to fold all line which are comment.

    eg.

    //aaaaaaaaaaaaaaaaaa

    //bbbbbbbbbbbbbbbbbb

    //cccccccccccccccccc

    //dddddddddddddddddd

    Can vim do this ?

Best

    Regards!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Lott  
View profile  
 More options Nov 15 2012, 2:20 am
From: Chris Lott <ch...@chrislott.org>
Date: Wed, 14 Nov 2012 22:19:59 -0900
Local: Thurs, Nov 15 2012 2:19 am
Subject: Re: how fold all comment line?

On Wed, Nov 14, 2012 at 10:05 PM, 王军 <wangjun850...@gmail.com> wrote:
> Hi everyone:

>     I want to fold all line which are comment.

>     eg.

>     //aaaaaaaaaaaaaaaaaa

Something like this?

set fdm=expr
set fde=getline(v:lnum)=~'^\s*\/\/\\\|^\s*$'?1:0

c
--
Chris Lott <ch...@chrislott.org>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "答复: how fold all comment line?" by 王军
王军  
View profile  
 More options Nov 15 2012, 4:33 am
From: 王军 <wangjun850...@gmail.com>
Date: Thu, 15 Nov 2012 17:33:09 +0800
Local: Thurs, Nov 15 2012 4:33 am
Subject: 答复: how fold all comment line?
Hi
        If do you said, only fold "//" which are at the front of line

        So I modify ,and like " set fde=getline(v:lnum)=~'\s*\/\/\\\|^\s*$'?1:0"

        Now it will fold "//" which at back of line.

        Like this "        a = b; //comment

-----邮件原件-----
发件人: vim_use@googlegroups.com [mailto:vim_use@googlegroups.com] 代表 Chris Lott
发送时间: 2012年11月15日 15:20
收件人: vim_use@googlegroups.com
主题: Re: how fold all comment line?

On Wed, Nov 14, 2012 at 10:05 PM, 王军 <wangjun850...@gmail.com> wrote:
> Hi everyone:

>     I want to fold all line which are comment.

>     eg.

>     //aaaaaaaaaaaaaaaaaa

Something like this?

set fdm=expr
set fde=getline(v:lnum)=~'^\s*\/\/\\\|^\s*$'?1:0

c
--
Chris Lott <ch...@chrislott.org>

--
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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "ç­”å¤ : how fold all comment line?" by Christian Brabandt
Christian Brabandt  
View profile  
 More options Nov 15 2012, 4:56 am
From: "Christian Brabandt" <cbli...@256bit.org>
Date: Thu, 15 Nov 2012 10:56:01 +0100
Local: Thurs, Nov 15 2012 4:56 am
Subject: Re: ç­”å¤ : how fold all comment line?
(please don't top poste)

On Thu, November 15, 2012 10:33, 王军 wrote:
> Hi
>    If do you said, only fold "//" which are at the front of line

>    So I modify ,and like " set fde=getline(v:lnum)=~'\s*\/\/\\\|^\s*$'?1:0"

you could leave out the first \s*, it doesn't matter here.

>    Now it will fold "//" which at back of line.

>    Like this "        a = b; //comment

You need to anchor your pattern to the beginning of the line, like this:
set fde=set fde=getline(v:lnum)=~'^\s*\/\/\\\|^\s*$'?1:0 fdm=expr fen

You should probably read an introduction to regular expressions, like
:h 27.4 and the following.

regards,
Christian


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »