Skip to content

Instantly share code, notes, and snippets.

@trevorrjohn
Created February 12, 2013 03:38
Show Gist options
  • Save trevorrjohn/4760069 to your computer and use it in GitHub Desktop.
Save trevorrjohn/4760069 to your computer and use it in GitHub Desktop.
Vim regex to change old style rails hashes to new style (ie. :key => "value" to key: "value")
:%s/:\(\w*\) =>/\1:/g
@danfinnie
Copy link

For copy-pasting:

%s/:\(\w*\) =>/\1:/g

@danfinnie
Copy link

On a directory!

perl -pi -e 's/:(\w*) =>/\1:/g' `find app -type f`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment