[TxMt] Macro Recording Bug / Inconsistency

Kevin Cox kevintcox at gmail.com
Wed Dec 7 18:25:27 UTC 2005

I've been using the macro below on my laptop with TextMate for quite a
while, and just realized I didn't have it on my G5. I went to record
it and ended up having a terrible time. It seems that with newer
versions of textmate (I couldn't tell you which version I was on when
I recorded it on my laptop) when you record the macro below, it adds
an "insert text" command with whatever tag has been inserted.

The macro:
In an HTML document, type < (it inserts <>, but ignore
that), now do:
  1) Automation / Start Macro Recording
  2) Backwards delete (to delete <, which also removes >)
  3) Automation / Insert Closing Tag
  4) Automation / Stop Macro Recording

Now save this macro, give it key equivalent /, and here's the sneaky
part: set the scope to: text.html invalid.illegal.incomplete

The scope controls when the macro should "fire", and if you press
ctrl-shift P inside <>, you'll see the scope of that position, which
is what's quoted above. So only inside <> will / fire this macro,
which first removes the <> and then inserts the closing tag.

In newer versions, instead of just coming out with


it also adds

insertText: </html>     (or whichever tag you happened to be closing)

I was able to open up the recorded macro in the Property List Editor
and remove the third command, but that is not a very elegant solution.
This was working properly in the past!


More information about the textmate mailing list