Textmate and SVN
The shift was overdue. Although Coda, my dev app of choice, offers everything a hobbyist programmer would need, it fails miserably on one aspect. Namely, code folding. For a long time, this trade-off seemed to still justify the use of this app for day-to-day development needs, in light of its other features, e.g. easy integration with SVN, about which I have written in the past.
However, of late as I start to work with larger projects with a lot of embedded logic, and process flows, it has become a pain in the proverbial behind to switch from Coda to an app that will fold code. The forums and blogs are abuzz with developers’ dissatisfaction with the lack of Code folding, and the staff at Coda don’t seem to care. If only I could configure SVN with TextMate, and that too in a comprehensive, intuitive way, I could move away from Coda, forever. It seemed to be a pipe dream, i.e. till now. I have successfully set up SVN with TextMate and in a way that mirrors the ease of COMMIT, REVERT, DIFF found in Coda. Here’s a how-to.
This is what you’ll need at the get go.
- TextMate editor (of course)
- SVN Frontend (if you don’t want to finagle with the terminal). I use CornerStone.
- FileMerge (from XCode dev tools – recommended) or Changes.
- SVNMate Plugin for TextMate.
- FileMerge Plugin for TextMate.
Create a SVN repository with the software of your choice. I usually create one on an external drive (as I need access to my code offline from time to time). Note down the local or remote URL. In my case it is
file:///Volumes/ExternalHDD/CodeRepo/MyProj/.
~/Library/Application Support/Textmate/Bundles/.
Bundles->Subversion->CheckOut.
Change the default SVN status icons by going to TextMate preferences. Preferences->SVNMate and choose a set that catches your fancy.
Instead of using the TextMate SVN diff file viewer to see the changes since the last commit, use FileMerge. It is included in XCode developer tools, and is perhaps the best viewer, with split side-by-side views.
Perhaps the BEST feature so far – use TextMate tab triggers to trigger SVN events. Tab Triggers are used in TextMate by assigning a set of letters followed by a TAB key press, to trigger an associated event. You can pretty much do anything you like with Tab Triggers, from inserting pieces of Code in TextMate to SVN file commits. To set up a Trigger for an SVN Commit, go to Bundles->Bundles Editor->Commands. Choose Subversion from the list. Choose a command from the list, and in the right pane choose a method of Activation from the Drop down – Tab Trigger. To it, assign any combination of words. I chose “commitsource” for COMMIT.
If you prefer to view the differences in FileMerge instead of the inbuilt diff viewer, in the same window (Bundle Editor) choose FileMerge in the list and edit the Revision Command.