TextMate 1.5.6
Version 1.5.6 was released last weekend and while my main focus is on 2.0 (which for the records only has a stated ETA of after Leopard) a lot is still happening with TextMate bundles, so here’s a few highlights.
Edit in TextMate
While not a bundle, a popular TextMate companion is the Edit in TextMate input manager. It allows you to call TextMate from any editable Cocoa text view, edit the text, and then have it sent back when you save and close the TextMate window.
This input manager is old news and I have mentioned it before. A recent addition is that it now works with WebKit’s custom text fields used by Safari 3β.
The way this is implemented is by asking the HTML view for the DOM and then use some methods on the DOMHTMLTextAreaElement
to get and set the text (thanks to Rachael of the Omni Group for suggesting this approach). Unfortunately there is (to my knowledge) no way to know which text area is actually the active one (well… except for in OmniWeb) so a heuristic is unfortunately necessary.
The input manager is open source so improvements in form of patches are more than welcome :)
Objective-C Bundle
Joachim Mårtensson has done awesome work with this bundle improving the indispensable bracket matcher so that it now has a 99.9% accuracy. He also added completion for all the standard Cocoa frameworks.
While the code completion is not always able to find the type of expressions, it does have a few features that goes beyond normal code completion. I strongly recommend reading the help file included in the bundle (reached via Bundles → Objective-C → Help) but here’s a few examples:
-
Type
- windowW
inside an@implementation
…@end
block and then press ⌥⎋ to get a pop-up listing all thewindowWill
delegate methods. Select the one you’re about to implement and have TM insert the proper boilerplate with the correct argument types. -
Type
NSUT
followed by ⌥⎋ when filling in the last argument forstringWithContentsOfFile:encoding:
to have TM insert the proper symbolic name for the UTF-8 encoding. -
Type
NSWin
when providing the name of the notification you want to add an observer to and press ⌥⎋ to see the list of all theNSWindow
notifications.
Joachim also did a screencast demonstrating many of these features. Here’s a direct link.
SQL Bundle
The SQL bundle received a major overhaul done by Ciarán Walsh, also responsible for all the recent improvements in the PHP bundle, which deserve a screencast and a blog post of its own.
In addition to documentation lookups and the language grammar, the bundle has a new database browser for which connections are setup using a GUI (Bundles → SQL → Configure) rather than relying on environment variables (passwords are kept in the key chain).
The bundle has a command to execute current line or selection as an SQL query. Coupled with intelligent snippets for your frequent queries, this feature is extremely useful and I often do snippets for what I would write a script for in the past. For example refunding a license key is refund⇥
followed by ⌃⇧Q (when present, serial number is taken from the clipboard).
Since I was keen on getting this updated bundle into the 1.5.6 release, I did rush it a bit, and the bundle has received a few updates mainly related to PostgreSQL.
To see the list of changes since the release (assuming you have svn
installed, if not see Installing Subversion) you can run:
svn log -r7715:HEAD \
http://svn.textmate.org/trunk/Bundles/SQL.tmbundle
If you want to update the bundle I recommend replacing the bundle inside TextMate.app
. This way your checkout will be replaced with the next update of TM and you won’t be left with an outdated SQL bundle that eclipse the default one (which would be the case if you checkout to /Library
or ~/Library
and forget to remove it again or svn up
the checkout).
Assuming you installed TextMate in /Applications
and already have svn
then this is done with these lines (in a bash compatible shell):
export LC_CTYPE=en_US.UTF-8
cd /Applications/TextMate.app/Contents/SharedSupport/Bundles
rm -rf SQL.tmbundle
svn co http://svn.textmate.org/trunk/Bundles/SQL.tmbundle
TODO Bundle
Stanley Rost (Soryu) is behind the improvements in this bundle. These include nicer output which is incrementally updated with status about which folders are being scanned. TODO markers are now configured using a GUI (reachable via Bundles → TODO → Preferences) so you no longer need to edit the source code of the command to alter the markers.
The bundle also has a neat snippet: type todo⇥
in whatever language you work and a TODO list is inserted wrapped in block comment characters appropriate for your current language with the caret waiting for your first TODO.