[TxMt] Oniguruma question.
Allan Odgaard
throw-away-1 at macromates.com
Wed Sep 20 01:34:50 UTC 2006
On 20/9/2006, at 3:07, Fritz Anderson wrote:
> [...] I am trying to automate putting spaces after the )s with the
> search RE /\)(?=\S)/, to be replaced with ') ' -- that's close-
> parenthesis, space.
Have a look at Reformat → Method Signature in the Objective-C
bundle. It doesn’t do your style by default, but you can modify the
script (I have done that locally to get my style) — then one can
just press ⌃Q on a method signature (be it in the interface or
implementation) and get it reformatted properly.
I use that a lot when pasting methods from the Cocoa documentation :)
> Doing this as a Replace All works as expected. But try pressing the
> Next button, then Replace. The substitution does not take place.
>
> Am I missing something?
The problem with the “Next” + “Replace” is the look-ahead.
The “Replace” is not connected with the previous “Next” and so
will replace the selection with the contents of the replace string,
regardless of what caused the seletion — for your regexp this will
fail, because the selection no longer matches the find pattern
(because of the look-ahead).
So all in all, it shouldn’t really work that way, but does for
technical reasons.
More information about the textmate
mailing list