Search code examples
textmatetextmatebundles

Creating a command in a bundle to do a find in a replace in a given document


I'm looking to create a command in a textmate bundle that when run will:

  1. Search the document for a given string
  2. Replace that string with another given string

The strings will always be the same

Search for <? replace with <?php

I know I can use textmate's find and replace functionality - I'm just trying to automate a little.

This should only make changes on the current page, not the entire project.

Is this possible?


Solution

  • Yes, you can do this with a Macro.

    Simply go to Bundles -> Macros -> Start Recording, and then execute your Find and Replace as you wish it saved. Stop and Save the recording, and then you can assign it a command in the Bundle Editor.