My First Serious TextMate Automation
Posted by Rick DeNatale Tue, 09 Oct 2007 12:15:00 GMT
I recently got assimilated by the Mac/TextMate borg. I'm slowly teaching my fingers to dance the TextMate tango and unlearning old vim habits.One resource has been James Edward Gray II's book on TextMate published by the Pragmatic Programmers. I finally sat down and got serious about writing some automations of my own.
I've got to say that I'm pretty impressed by TextMate. At the last Raleigh.rb hack night I was talking to another vim user. I'd mentioned to him that you can extend TextMate easily in Ruby, without really having experienced it. Today, I wrote a neat little TextMate command to help in building Rails database test fixtures.
It acts like a tab triggered snippet, but it's a smart little critter. If I'm editing a fixture file, say 'test/fixtures/users.yml', I can type item then tab and it will produce the skeleton yaml for a new record, with:
- A dummy name selected for overtyping.
- The id set to the next available primary key Each column name as a yaml key ...
- ... A tabstop on a value which shows the column type
For example:
Read more...









