Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Here is the code:

package localhost


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
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
@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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .