08
May
09

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.

Advertisements

0 Responses to “Trim trailing spaces in GEdit”



  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: