Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

SASS and HAML have indentation-based syntax, much like Python. Blocks of related code have the same number of spaces at the start of a line.

Here's some example code:

  height: 100%
  color: #c2c7c4
    size: 10px
    overflow: hidden
    height: 100%
      background: url('/images/foo') repeat-y
        margin-top = !drawer_top
        width: 56px
        height: 161px
        display: block

I'm using phuibonhoa's SASS bundle, and I'd like to enhance it so that the various sections can fold. For instance, I'd like to fold everything under #drawer, everything under .slider, everything under .edge, etc.

The bundle currently includes the following folding code:

foldingStartMarker = '/\*|^#|^\*|^\b|^\.';
foldingStopMarker = '\*/|^\s*$';

How can I enhance this to fold similarly-indented blocks?

share|improve this question

Try changing:

foldingStartMarker = '/\*|^#|^\*|^\b|^\.';


foldingStartMarker = '/\*|^#|^\*|^\b|^\s*\.';

That allows for an arbitrary number of spaces between the start of the line and the first . for the folding start point.

The end point is trickier. I'm afraid I don't have a good end point expression for you. This looks like it's similar to python, where blocks are grouped by indentation level. I wonder if the Python bundle could help here? They start and end fold expressions for Python are:

foldingStartMarker = '(/\*|\{|\()';
foldingStopMarker = '(\*/|\}|\))';

Not sure if those would work for you or not.

share|improve this answer

Your Answer


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.