Setting Up Upload On Save With TextMate and Transmit
26th of October, 2006
When trying to work out how to set this up in the same way Dreamweaver handles it became obvious that this way (my way) of working wasn’t typical. Developers were using SVN but after investigating SVN further I realised it doesn’t suit my way of working or the projects I’m usually working on, upload on save does.
Setting up upload on save relies on Transmit’s DockSend feature. DockSend is primarily to enable users to drag and drop a file onto Transmit in the dock and have it upload to the correct place. This is only for users who have their sites mirrored locally and remotely (like me!). You must set it up on a favourite connection in Transmit and enable it in the options.
It works by knowing the root directory on both sides. So that when you drag a file onto the icon it just looks at it’s path back to the root and then follows that same path from the root on the server. It’s also smart enough to create new directories if it has to.
TextMate includes a bundle for the Trasmit DockSend feature. It basically performs a virtual dropping of the file onto the Transmit dock icon. To make it work on save takes a little tweaking.
It’s not exactly upload on save, it’s upload on command + S, the default shortcut for saving in nearly every app. To make it save and perform the DockSend command we need to make a macro that does both and then map command + S to that macro. So this is how it’s done.
- Open a file in a directory that you have DockSend enabled for, in TextMate.
- Select Bundles - Macros - Start Recording.
- Press command + S followed by ctrl + shift + F (the default DropSend file command)
- Select Bundles - Macros - Stop Recording.
- Select Bundles - Macros - Save Last Recording.
- Give it a name and give it the activation key equivalent of command + S.
- You’re done.
So that’s it, any file you open that’s in a folder with DockSend enabled will be automatically uploaded to the correct place. There’s is some drawback to this method as it only happens on command + S, not when you actually save by file - save.
This method is extremely fast, you don’t ever have to look at the Transmit window. Even if Transmit isn’t open, opening, connecting and uploading only takes a few seconds and you don’t have to do anything special, still just command S in TextMate.
