[TxMt] Re: [FeatReq] Undo in Find/Replace

Hans-Jörg Bibiko bibiko at eva.mpg.de
Mon Aug 25 09:32:19 UTC 2008

On 25.08.2008, at 10:56, guerom00 wrote:
> I find myself reformatting long file of datas using the Find/Replace  
> dialog
> box in combination with RegExp (very powerful !).
> But… I would love to have an undo button to undo whatever  
> replacement I just
> made. Right now, if I make a mistake in a replacement, I have to  
> close my
> file without saving and do it again from the beginning…
This could be a bit tricky. As long as your replacements are  
independent it could work.
This could work:
replace a by e
replace u by X
replace s by t

but this doesn't work (naïve expamle):
replace a by e
replace ed by XX

if you now say that replacing a by e was wrong the text becomes  
Thus I would use the normal TM undo functionality to go back. The last  
10 find/replace string are stored anyway.

If I have to do a lot of replacements I always use a script (sed,  
perl, python, etc.) doing this and creating a new doc.

An other approach is to use git or svn for revision control. After  
each replacement one commits the changes to the repository  
automatically. Then you can go back in time easily.
Or one writes a script which saves the current doc as file name plus  
time stamp and use it in a macro:
- save with time stamp
- open Find/Replace Dialog
But this of course won't work for replacements which depends on each  

Or did I misunderstand you?


More information about the textmate mailing list