Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Here is the code:

package localhost

import scala.tools.nsc.reporters._
import scala.tools.nsc.util.Position


class MyReporter extends Reporter {


  /** <p>
   *    Give message of an rejected program
   *  </p>
   */
  def info0(pos: Position, msg: String, severity: Severity, force: Boolean) = {
    severity match {
      case INFO =>
      case WARNING =>
      case ERROR => println("error on pos: " +pos+" message: "+msg)
    }
  }
}

So I want to to fold

  /** <p>
   *    Give message of an rejected program
   *  </p>
   */

to something like:

/** */

How is this possible? Thanks for your help.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

The simplest method would be this:

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

Those folded lines then appear like this:

+--  4 lines: * <p>------------------------------

With a little more work, you might be able to create a 'foldtext' expression that would create the desired folded line from elements of the first and last line of the folded region. However, :help foldtext() says that "Leading white space, "//" or "/*" and the text from the 'foldmarker' and 'commentstring' options is removed," so you may not be able to get exactly the appearance that you want.

share|improve this answer
    
Garyjohn: Slick. As a newby, I note that :foldo! opens all folds and :foldc! closes all folds –  Rolnik Jan 6 '11 at 19:47
1  
@Rolnik: You can also use zR and zM, which in common cases have the same effect and are a little faster to type. –  garyjohn Jan 6 '11 at 20:28
    
Works perfect, thanks for your fast help. –  Matthias Guenther Jan 6 '11 at 22:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.