4

I'm using a script to remove trailing spaces and then save the file.

The problem is that all my code foldings expand when I use it. How do I change the command so it will keep the code foldings?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
Richard
  • 3,839
  • 5
  • 28
  • 34

1 Answers1

2

You can use foldingStartMarker & foldingStopMarker to indicate the folds to TextMate.

To define a block that starts with { as the last non-space character on the line and stops with } as the first non-space character on the line, we can use the following patterns:

foldingStartMarker = '\{\s*$';

foldingStopMarker = '^\s*\}';

pressing the F1 key will fold any code folds present.

Reference: http://manual.macromates.com/en/navigation_overview#collapsing_text_blocks_foldings

Brian Dillingham
  • 9,118
  • 3
  • 28
  • 47