Skip to content

Instantly share code, notes, and snippets.

@thomasritz
Forked from defunkt/carbon.md
Created November 5, 2009 20:55
Show Gist options
  • Save thomasritz/227368 to your computer and use it in GitHub Desktop.
Save thomasritz/227368 to your computer and use it in GitHub Desktop.

Vim

augroup DeleteTrailingWhitespaces
  autocmd!
  autocmd BufWritePre * ks|execute "%s/\\s\\+$//ge"|'s
augroup END

Emacs

(add-hook 'before-save-hook 'delete-trailing-whitespace)

Textmate

http://blogobaggins.com/2009/03/31/waging-war-on-whitespace.html

In your existing codebase

find . -name '*.rb' | xargs perl -pi -e 's/ +$//'

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