Friday, February 12, 2010

Remove trailing white-spaces in Eclipse

Often, we need to quickly remove the trailing spaces (at the end) in the line. Eclipse does not come pre-configured with a shortcut for this in (java) editor perspective (I am using Europa release 3.3.2) . However, it is very easy to create one yourself, like following:

1. On menu choose Window -> Preferences ->General ->Keys
2. Filter the shortcuts for "remove"
3. Follow the image below. I have chosen ctrl+alt+backspace as shortcut key.

That is all you need. Now, while editing any source file, just hit the combo ctrl+alt+backspace to remove the (unnecessary) white-spaces from end of lines.

1 comment:

Anonymous said...

OK, a few years on and...
Windows -> Preferences -> C/C++ -> Editor -> Save Actions
can do it automatically
(also available on Java I believe).