Vim`s global search and replace
I have been looking for efficient solution how to refractor code with Vim for a while,
so I’d like to share it with you. That’s an extremely easy:
- Search (Tool from Vim):
:Ack OldClassName **/*.rb **/*.rake
- Apply changes on results (optional):
:cdo g/OldClassName/s/OldClassName/NewClassName/ge
- Update and save at once:
:cdo %s/OldClassName/NewClassName/ge | update
Big thanks to Sebastian for sharing this trick with me.
Check out his blog post Should You start using VIM?
Big up!