Trim trailing spaces in GEdit
One item from the list of good coding standards which always seems to catch me out is that lines of code shouldn’t have trailing white space. Some editors offer functionality to prevent this, GEdit doesn’t by default. A quick search took me to a page of plugin’s including the ‘trailsave’ plugin. When enabled, this plugin trims off all white space from the end of lines; exactly what I want. One small gripe is that it trims off the last line of a file if it is empty, not ideal.
In the spirit of open source, I modified the code slightly and you can now get the remove-trailing-white-space-but-not-the-last-blank-line plugin from here.
Unpack the two files into your ~/.gnome2/gedit/plugins directory (create one if its not there) and start up GEdit. Select ‘Plugins’ from the Edit->Preferences menu and enable the “Save without trailing space’ plugin from that menu.
Hi, my name is Jamie Bennett. I'm a technologist, programmer, researcher, tech evangelist, open source monkey, Linux lover and self confessed gadget freak.
Works great!
bobby
7 Nov 09 at 4:18 pm
Thanks, Jamie. The Ada style check goes bonkers with trailing white spaces, so this was desperately needed. I appreciate it!
John
John Marino
18 Apr 10 at 9:36 pm
Thanks!
Vitaly
12 Oct 10 at 2:51 pm
great! exactly what i need..thanks!
cho
15 Oct 10 at 6:24 am
Thank you! This should be in gedit-plugins package!
Korshun
27 Jan 11 at 3:40 pm