[TxMt] Re: Macro that uses find & replace

Allan Odgaard mailinglist at textmate.org
Fri Sep 20 11:13:52 UTC 2013


On 19 Sep 2013, at 15:00, Ross Ahmed wrote:

> Is it possible to save a macro that uses the find & replace dialogue 
> box?

Yes, the button you press in the dialog, while recording a macro, will 
cause the window’s current state to be saved (in the macro) with the 
action, as opposed to using something like Edit → Find → Find Next, 
which only put “findNext:” in the macro (using the current search 
string).

> Lets say I want to save a macro that uses find & replace with a 
> regular expression to surround any number with “**". For example, 
> the macro would replace any instances of “123" with **123**. Is this 
> possible?

1. Edit → Macros → Toggle Recording
2. Edit → Find → Find…
3. In find dialog use:
     - Find: `\d+`
     - Replace: `**$0**`
     - ✓ Regular Expression
4. Click “Replace All”
5. Edit → Macros → Toggle Recording
6. Edit → Macros → Save Macro…

When you save the macro, you can see how your actions got interpreted 
and can make minor edits to the property list in the bundle editor.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20130920/9895e895/attachment.html>


More information about the textmate mailing list