Is there any way with TextMate to hide comments when editing code? Sometimes I want to see my code with the full comments and other times just want to see the code itself with all comments hidden. I was hoping there would be a way to toggle the display of comments, but haven't been able to find anything about this.
Asked
Active
Viewed 320 times
1 Answers
0
It is something you will need to edit on a language by language basis, but it is very doable. Inside of Bundles -> Bundle Editor -> Edit Languages
you will find the language definition that TextMate uses to highlight that particular syntax. Inside of the syntax definition you will find foldingStartMarker
and foldingStopMarker
.
You can add comment syntax to those to allow the folding off comments themselves. It might be pretty tricky for single line comments, but multiline comments, that have both a clear and unique start and stop syntax, should work fine.
For PHP, for example, we are going to want to add \/\*
to the start syntax, and \*\/
to the end syntax. You will need to reload the bundle for these changes to take effect (or restart TM).

Ben Roux
- 7,308
- 1
- 18
- 21