TextMate: Working with Comments

June 10, 2008

In a recent email exchange with Allan Odgaard, creator of TextMate, I asked if he had any suggestions for tips that would make for a good screencast. Allan mentioned that on the TextMate IRC, there are often questions about working with comments. And with that, he shared a list of tips that you’ll find in the video that follows.

There are five tips on working with comments, including toggling comments on/off, commenting a subset of a line, inserting comment blocks and a short section on how to insert todo lists inside a comment block.

Summary of tips:

  • Apple-/ Togggle comment
  • Alt-Apple-/ Comment a block and comment subset of a line
  • “head” tab-key Insert comment header at top of file
  • Control-Shift-B Insert comment banner (top of declaration, function, etc)
  • “todo” tab-key Insert todo block

Note: In order for these features to work, you will need to make sure the Source and TODO bundles are enabled within TextMate (see the video for more information).

The music in the video is J.J. Cale and the song: Call Me the Breeze.
Click to hear a longer clip of J.J. Cale: [audio:/2008/jj.mp3]


Hey — just found out about this site, and THANKS MUCHLY for the great screencasts!

I do have one minor request — since I listen with headphones, so the difference between the music sound level and the voice sound level is really unpleasant.

by yachris on Jun 10, 2008 at 3:56 pm. Reply #

I apologize for the volume problem, that’s been a trouble spot for a long time. Seems getting a consistent volume for recording voice and then matching that to the music is a challenge to say the least (at least using the no-frills mic/software I have)…but something I will continue to tweak.

Thanks for the comment and glad you enjoy the videos.

by john on Jun 10, 2008 at 4:04 pm. Reply #

You’re a window$ user!
sys/time.h, not sys\time.h !!

by anonymous on Jun 21, 2008 at 5:25 pm. Reply #

Anonymous…the code in the video is a legacy application I wrote in C somewhere around 1989, it was actually written for DOS.

by john on Jun 21, 2008 at 7:53 pm. Reply #

About the TODO bundle, you’re supposed to write “TODO” at the beginning of each line, to you can use the Show TODO List command to get a list of tasks with links to the files and line numbers. FIXME, CHANGED and RADAR are also valid keywords, and you can add more on the bundle’s preferences.

by dipnlik on Dec 7, 2008 at 7:56 am. Reply #

I enjoyed this screencast very much, thankyou!
I just started coding and commenting is a really good way to learn..

However I got some questions!
What is the easiest way to insert comments next to the code? If I insert with ctrl+apple+/ the line of code becomes a comment.

If I type head and hit tab in a php-file I get the head-tags of a html-file, is there an option I missed?

Thanks again!

by klarabara on Oct 24, 2010 at 9:24 am. Reply #

Thanx a lot for the video! Is very clever when you are clueless.
And, the music is right! (the volume too)


by Kundo on Jan 11, 2011 at 10:04 pm. Reply #

Loved it. Thanks for sharing :) was very helpful.

by sumitk on Jul 6, 2011 at 2:37 am. Reply #

Nice video, I never write but I thought I would show my gratitude.
summary is definately cmd v!
Kundo gets kudos for name.. fruitful tune “_-

by meebo on Apr 30, 2012 at 6:21 pm. Reply #

Thanks much for this info (not sure how I would have found it otherwise). One minor recommendation — Apple stopped using the term “Apple key” in 2007 and instead uses “Command key”. Believe it or not, users new to the platform may not know what the “Apple key” is.

by danhoo on Jun 2, 2012 at 11:49 am. Reply #

Post a comment:


Required. Not published.