Posts Tagged ‘textmate’

Making Line Up / Down not suck in Textmate

Tuesday, August 5th, 2008

I think I blew Steve Conover’s mind last week.

He, like me, and every other sane rational person I’ve ever met, thinks that when you say “line up” or “line down” in a text editor, it should take the line(s) you are currently on and move them up, in their entirety. Furthermore, that if you press “line up” 5 times, the line(s) you are currently on should move up 5 lines.

Textmate, as much as I love it, does not do this, and this has long been a source of contention and strife among my colleagues at Pivotal.

This, however, is a story with a happy ending. Last week, Steve and I were pairing on Textmate, and he was complaining that line up / down wasn’t working properly. A couple hours later, I had a brilliant insight. This is how you fix Textmate’s line up / down :

Pull up textmate and type :

command-option-M
command-shift-L
command-control-up arrow
command-option-M
control-option-m

This will start recording a macro, select the current line, move the current line up, stop recording the macro, and then save the macro.

Next, name your macro “line up” in the dialog that just popped up, and give it a key equivalent of command-control-up arrow.

Congratulations, you just fixed line up!

Now let’s do the same with line down :

command-option-M
command-shift-L
command-control-down arrow
command-option-M
control-option-m

This time, name it “line down”, and give it a key equivalent of command-control-down arrow.

You of course don’t have to do all this with keyboard shortcuts, but it’s really impressive if you do :)

PhpUnit for TextMate

Friday, July 18th, 2008

Who would have thought I’d be doing php?

Anyway, yesterday I found myself doing php and really wanting it to hurt less. I downloaded a textmate bundle for phpunit from github. It wasn’t quite what I wanted, so I forked it and hacked it, and made it work a bit more like the rspec bundle.

It now has:

Commands

  • run tests (in current file)
  • run single test

Snippets

  • test

And much to my surprise, it was way easy to do. All in ruby, all with specs testing it.

This article was going to be telling all y’all to come over to my cool fork of phpunit, but I sent the original author a pull request yesterday, and I just looked, and he’s pulled all my changes. Rock!

So go forth and enjoy the goodness that an extensible editor like textmate, oss code like the phpunit bundle, and github can bring about.

PHPUnit.bundle for textmate