Skip to content

Instantly share code, notes, and snippets.

@yahooza
Last active December 8, 2017 22:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save yahooza/e4d259f4372a1612f1c5 to your computer and use it in GitHub Desktop.
Save yahooza/e4d259f4372a1612f1c5 to your computer and use it in GitHub Desktop.

Removing whitespace

Why?

"Trailing whitespace is indeed commit noise."

Sublime Text

Just drop this in one of your settings files:

"trim_trailing_white_space_on_save": true

Textmate

Open the bundle editor (⌃⌥⌘B) and open “Text” → “Menu Actions” → “Converting / Stripping” → “Remove Trailing Spaces in Document / Selection”.

Then in the drawer put callback.document.export in Semantic Class and Document / Replace Document as Input / Output.

vim

autocmd BufWritePre * :%s/\s\+$//e

PHP Storm

PyCharm

Eclipse

The IDE has a preference to remove trailing whitespace.

Preferences -> Java -> Editors -> Save Actions
  1. Check "Perform the selected actions on save"
  2. Check "Additional actions" and click the "Configure.." button.
  3. In the "Code organizing" tab, check "Remove trailing whitespace"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment