Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1098143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:32:09+00:00 2026-05-17T00:32:09+00:00

A colleague of mine is using a horrible source code editor that leaves strange

  • 0

A colleague of mine is using a horrible source code editor that leaves strange comments all over the code. In Visual Studio, I created a macro, that simply folds all those comment blocks so I don’t have to see them.

Now I would like to do the very same thing in vim.

This regex matches every one of those blocks:

/^.*\/\* EasyCODE.*\(\(\n.*\*\/\)\|\(\n.*\/\*.*\)\|\(\n\/\/.*\)\)*/

Now I bet there is a really nice way to fold all matches of this pattern in vim. However, I am rather new to vim and don’t know how to do this.

Could you help me there?

Edit: some examples:

These comment blocks always begin with /* EasyCODE. Sometimes the comment have a closing */ right on the end of the first line, sometimes only on the next line. The following lines might or might not contain additional “/* EasyCODE…” blocks.

One of these blocks could look like this

/* EasyCODE ) */
/* EasyCODE ( 0 
some text */
/* EasyCODE F */

or like this

/* EasyCODE V8 */
/* EasyCODE ( 0 */

or like this

/* EasyCODE > */

As I said, the above regex catches them all.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T00:32:09+00:00Added an answer on May 17, 2026 at 12:32 am

    I’m not completely clear on the details of your blocks (hence the comment about providing an example), but you could use something like this:

    :set foldmarker=/\*\ EasyCODE,\*/
    :set foldmethod=marker
    

    This will configure the ‘marker’ fold method that looks for certain markers in the code and then it will set the starting marker to /* EasyCODE and the ending marker to */. Hopefully this will give you something to get you started. If you could post a sample source file, I may be able to offer some more advice.

    :help folding
    :help 'foldmarker'
    :help 'foldmethod'
    :help fold-marker
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A colleague of mine uses a abomination text editor that routinely leaves comment blocks
the other day a colleague of mine stated that using static classes can cause
A colleague of mine states that booleans as method arguments are not acceptable .
My colleague insists on explicitly specifying the namespace in code as opposed to using
The other day I saw a colleague of mine using sort to sort a
A colleague of mine agreed to using Subversion (SVN) for our little project, but
Some months ago, a colleague of mine installed ODAC 11.106.21 in a server using
Hello I have a colleague of mine who is a procedural code developer and
A colleague of mine and I have been discussing how to declare variables in
A colleague of mine recently got bitten badly by writing out of bounds to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.