Skip to content

Instantly share code, notes, and snippets.

@snarlysodboxer
Created December 21, 2015 21:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snarlysodboxer/7fc9a0f61d785bf2fbca to your computer and use it in GitHub Desktop.
Save snarlysodboxer/7fc9a0f61d785bf2fbca to your computer and use it in GitHub Desktop.
White space police for Ruby files
#!/bin/bash
# remove trailing whitespace
find ./ -name '*.rb' -exec sed -i "s/\s\+$//g" {} +
# switch tabs for two spaces
find ./ -name '*.rb' -exec sed -i "s/\t/ /g" {} +
# auto indent with Vim
# open any file in Vim, then:
:args ~/code/myproject/**/*.rb | argdo execute "normal gg=G" | update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment