[TxMt] Re: Find and replace in macros

Allan Odgaard mailinglist at textmate.org
Wed Jun 10 20:58:58 UTC 2015


On 9 Jun 2015, at 23:32, Robert Milton wrote:

> (a) Seems to fail because the argument to findWithOptions: requires a 
> replaceString. What the macro does is set replaceString equal to 
> whatever value it received (i.e <text>) when the macro was recorded . 
> Removing the line in the macro setting replaceString produces an empty 
> set symbol, which is understandable.

I’ve fixed this for next build, so that if the replace string (or 
search string) is removed (from the macro argument) then it uses the 
current value (from the search/replace clipboard).

> (b) Seems to fail because macros don’t like findAll. When I record 
> this operation alone and replay it, all it does is put the caret at 
> the end of the document (the location may be specific to the limited 
> test I’ve done, but the point is I don’t get the multiple carets I 
> should.)

The “Find All” action is a standalone action that uses the current 
search clipboard values. So to make it work for your case, then you 
would first need to put the search string on the find clipboard (before 
calling “Find All”), for example via ⌘E or by performing a dummy 
“Find” (via the dialog).

So the steps would need to be something like:

1. ⌘C (Copy).
2. ⌘F, enter search string, enable regex, and press “Next”.
3. ⌃⌘F (Find All).
4. ⌘V (Paste).


More information about the textmate mailing list