Hacker News new | past | comments | ask | show | jobs | submit login

I really like Facebook's codemod.py for stuff like that: https://github.com/facebook/codemod

It has something like automatic and manual modes, so you can check (and fix) every diff during the replacement




Well you see... It's in Python, which breaks the deal for me (I despise slow startup). But interactive mode sounds interesting, that's something I'll consider implementing.


By slow startup do you mean 0.01s of wall time? This sounds more like a prejudice than a decision with a strong technical basis.


By slow startup I mean that 0.1s is the fastest small Python program using optparse, os, sys, re will start up on my system (i7 2.0, ssd). Search and replace tool will be slower. I constantly get 0.02s-0.3s results from 'gr' on my small-to-medium repositories (up to ~80k sloc). 'ack' takes more than a second usually.

Also it was written when I had HDD (not SSD) and codebase was on an encrypted image. It made enormous difference to me.


btw, here is ag, which also looks .xignore files: https://github.com/ggreer/the_silver_searcher


Yes, I've mentioned it in my post. :) It's nice, but it does not perform replaces. I could add .xignore support though.


I love this little gem. I can do in seconds what takes my colleagues an hour (they generally don't know about macros, extending their editors, regexes, etc). It showed me that solving text problems outside your text editor ends up benefiting more people.

Its a little bit different from Go Replace, giving the option to drop on your editor if the current replacement can't be appied directly (this is the great feature).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: