Matt Pavelle

TextMate Items

Please note: this article is deprecated as I'm now using Sublime Text (and you should too).

TextMate is an excellent programmer's editor for OS X. This page archives any worthwhile macros and addons I have created for Textmate.

Matt's Cleanup Macro

A basic macro that uses regular expressions to clean up and format PHP, HTML, JS, and XML. It is simple, and it works. I add on to it and remove pieces frequently - right now it is rather sparse.

Install it by naming it appropriately and placing it in ~/Library/Application Support/TextMate/Bundles - enjoy.

[download link removed due to deprecation]

TextMate Find Command Goodies

A few quick (and undocumented) shortcuts for TextMate's excellent search functionality:

Using the Find Dialog:

  • The button with the arrow next to the Replace field to change to multi-line mode. In this mode you may hold Option and press Tab/Return to insert a tab or newline.
  • The Σ button will show how many matches there are in the current document as a preview before replacing.
  • The checkboxes can be toggled with the keyboard as follows:
    • ⌥⌘ R toggles Regular expression
    • ⌥⌘ I toggles Ignore case
    • ⌥⌘ W toggles Wrap around
  • Holding Shift or Option will change the Replace All button to In Selection

Dialog-less Keystrokes:

  • ⌘E sets the active search string to the currently selected text
    • ⌘G goes to the next occurrence of the active search string
    • ⇧⌘G goes to the previous occurrence of the active search string
  • ⇧⌘E sets the active replace string to the currently selected text
  • ⌥⌘F replaces the active search string with the active replace string and moves to the next occurrence
  • ⌃⌘F replaces all instances of the active search string with the active replace string in the document
  • ⌃⇧⌘F replaces all instances of the active search string with the active replace string in the selection

Incremental Search:

  • ⌃S activates incremental search wherein the selection will move as you type in a query
    • ⌃S skips to the next occurrence of the incremental search string
    • ⌃⇧S skips to the previous occurrence of the incremental search string