Textmate + version control + (SSH or FTP) = happy Jasper

09/16/2008

It's no secret at all that I love Textmate. I find now that working without the ability to wrap a selection in brackets/quotes, the perfect indentation, amazing predefined bundles and the ability to modify/create your own bundles nearly impossible. I certainly don't see the point in working without all this great stuff! One thing I find that is fundamentally missing is FTP/SSH support. There is a way to emulate FTP support, but it's cumbersome and it just doesn't integrate with my workflow at all, so I don't use it.

Until today I've been switching to the very capable Coda, but I'm way too used to the power of Textmate's text manipulation for this to be a long term solution. With no sign of FTP or SSH support on the horizon, I got my Google on. I've found a pretty great solution that will integrate very well with my workflow, so I thought I'd share.

First off, I downloaded the FTP/SSH bundle for Textmate from fuerstnet. This gives you reload and upload over FTP and SSH, along with 2 keyboard shortcuts, direct from a Textmate project. I then set up a folder in the following way:

./project
./project/TextmateProject.tmproj
./project/.ftpssh_settings
I wont reiterate the step-by-step for setting this up, as it's on fuerstnet and it's relatively easy.

Once you've got this file structure, open your favourite version control client (I use Versions or terminal with Subversion, but only because that's what I'm used to. Git is also pretty awesome) and check out your project to the ./project folder so that the path to ./project now matches up with your path in .ftpssh_settings file.

At this point, it's pretty obvious that this method relies on the fact that you're working on 2 identical copies of 1 project - not ideal, but it works.

Once you've got your checked out files, go to your ./project folder and drag all the files in there (except TextmateProject.tmproj and .ftpssh_settings to your Textmate project drawer. Now save your project and it's ready for you to use. To edit a file on your server, open it in your Textmate drawer, make your changes, save it and use the FTP/SSH bundle to upload it (2 keyboard shortcuts: cmd-S, option-S and your file's uploaded). You'll get a tooltip to tell you that the file has uploaded successfully (if it has), and a quick check in your browser should show you that the changes have taken place.

As I said, this relies pretty closely on you having a close affiliation with a version control system, but as long as your files in ./project mirror what's on your server, it will be a relatively seamless process. I only say to use version control as it streamlines the whole thing, and makes it easier if you're modifying the files in more than one place, or you have a team working on them. It's nice and easy to set up a version repository on a local machine, and it's great for managing projects so I'd recommend it anyway!

If I've omitted anything, let me know in comments, and please, props to fuerstnet for writing the awesome bundle that makes this process possible!