Indentation-based Folding for TextMate
- by Craig Walker
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:
#drawer
height: 100%
color: #c2c7c4
font:
size: 10px
.slider
overflow: hidden
height: 100%
.edge
background: url('/images/foo') repeat-y
.tab
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?