Skip to content

Instantly share code, notes, and snippets.

@michaelficarra
Created May 17, 2012 22:47
Show Gist options
  • Save michaelficarra/2722112 to your computer and use it in GitHub Desktop.
Save michaelficarra/2722112 to your computer and use it in GitHub Desktop.
vim substitutions for cleaning up coffeescript projects
:%s/[\r \t]\+$//
:%s/() ->/->/c
:%s/if \!/unless /c
:%s/;$//c
:%s/^\(\s*\)\(@\?[a-z0-9$_]\+\)()/\1do \2/ic
:%s/\!==?/isnt/c
:%s/===\?/is/c
:%s/\([a-z0-9$_]\)(\([^)]\+\))$/\1 \2/ic
:%s/true/yes/c
:%s/false/no/c
:%s/^\(\s*\)return \(.*\n\)$/\1\2/c
:%s/ \(\.[0-9]\+\)/ 0\1/c
:%s/^\(\s*\)\(@\?[a-z0-9$_]\+\)--/\1--\2/ic
:%s/\<\(new [a-z0-9$_]\+\)()$/\1/ic
:%s/return undefined/return/c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment