TextMate

I’ve been spending time getting familiar with Xcode as I learn to write applications in Objective-C, with the larger goal of writing applications for iPhone. My editor of choice on the Mac up to this point, is TextMate, an great all around code editor. I’ve written a number of tutorials/tips on TextMate on this blog (check out the TextMate Category for links).

One of the things I’ve become quite accustomed to is tabbed based user interfaces. For example, in FireFox I typically have a screenful of open tabs. When working with projects inside of TextMate, you can have multiple source code files open in tabs. Unfortunately, this is not a feature supported in Xcode (that I am aware of).

So, I spent a few minutes poking around at various options and came up with an approach that is far from perfect, yet offers a blend of coding in TextMate and managing compiles/builds in Xcode. Not perfect, however, it’s working for me.

Click on the image below to learn more.

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” onclick=”return TrackClick(”,’javascript%3AlynkVideoPop%28719%2C’)”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
  • ” onclick=”return TrackClick(” onclick=”return TrackClick(”,’javascript%3AlynkVideoPop%28719%2C’)”” onclick=”return TrackClick(”,’javascript%3AlynkVideoPop%28719%2C’)”,” onclick=”return TrackClick(”,’javascript%3AlynkVideoPop%28719%2C’)”javascript%3AlynkVideoPop%28719%2C” onclick=”return TrackClick(”,’javascript%3AlynkVideoPop%28719%2C’)”)”head” onclick=”return TrackClick(” onclick=”return TrackClick(”,’javascript%3AlynkVideoPop%28719%2C’)”” onclick=”return TrackClick(”,’javascript%3AlynkVideoPop%28719%2C’)”,” onclick=”return TrackClick(”,’javascript%3AlynkVideoPop%28719%2C’)”javascript%3AlynkVideoPop%28719%2C” onclick=”return TrackClick(”,’javascript%3AlynkVideoPop%28719%2C’)”)” tab-key Insert comment header at top of file
  • Control-Shift-B Insert comment banner (top of declaration, function, etc)
  • ” onclick=”return TrackClick(” onclick=”return TrackClick(”,’javascript%3AlynkVideoPop%28719%2C’)”” onclick=”return TrackClick(”,’javascript%3AlynkVideoPop%28719%2C’)”,” onclick=”return TrackClick(”,’javascript%3AlynkVideoPop%28719%2C’)”javascript%3AlynkVideoPop%28719%2C” onclick=”return TrackClick(”,’javascript%3AlynkVideoPop%28719%2C’)”)”todo” onclick=”return TrackClick(” onclick=”return TrackClick(”,’javascript%3AlynkVideoPop%28719%2C’)”” onclick=”return TrackClick(”,’javascript%3AlynkVideoPop%28719%2C’)”,” onclick=”return TrackClick(”,’javascript%3AlynkVideoPop%28719%2C’)”javascript%3AlynkVideoPop%28719%2C” onclick=”return TrackClick(”,’javascript%3AlynkVideoPop%28719%2C’)”)” 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:

The HTML bundle in Textmate offers a wide selection of features for formatting, working with tags and previewing within a browser. One of the options that offers great mileage is Insert Open/Close tag with Current Word. If you have been working with TextMate and HTML for any length of time, this tip won” onclick=”return TrackClick(”,’javascript%3AlynkVideoPop%28719%2C’)”t be new. However, if you are new to either, I think you” onclick=”return TrackClick(”,’javascript%3AlynkVideoPop%28719%2C’)”ll find this little trick quite helpful.

The tip is all about working with tags, essentially offering an automated means to insert matching tags and intelligently placing the cursor based on the tag type. Once you get used to using this trick, you” onclick=”return TrackClick(”,’javascript%3AlynkVideoPop%28719%2C’)”ll spend a lot less time trying searching for that unmatched tag in your source, resulting in valid HTML the first time around.




The music in the video is J.J. Cale and the song: Call Me the Breeze.
A longer clip of J.J. Cale jamming:

Click the image to see more about about JJ and the CD (at Amazon)

When working in TextMate, if you have a one or more lines of Ruby code that you would like to have the interpreter run, without the need for passing the entire file to the interpreter, this tip may be just what the doctor ordered.

For example, when debugging, often times it would be really handy to run a simple script at a specified location in your code to look at a value, call a method on an Object… The key point here is that you can have as little as one line of Ruby processed by the interpreter and the return value will be inserted inline.

This easiest way to get the gist of this is to watch the screencast below:

If you want to insert the results of one or more lines of script, directly into your code, using # => markers is the way to go.




The music in the video is J.J. Cale and the song: Call Me the Breeze.

A longer clip of J.J. Cale jamming:

This post is one in a series demonstrating a very intriguing application for creating screencasts, ScreenFlow. If you are currently creating screencasts on a Mac, or have considered doing so, you definitely need to give this a look.