[wingide-users] Strip trailing whitespace?

Wingware Support support at wingware.com
Mon Apr 28 07:01:16 MDT 2008


Allen Bierbaum wrote:
> I was just looking through the archives and saw this message.
> 
> Instead of binding this to a key, is it possible to add it to the
> editor context menu (right click) or some other menu?  I don't need
> this functionality often, but when I do I would like a way to call the
> rstrip command.

In Wing 3.1beta3 we added a preference to this automatically as files
are saved.  If you want to just do it on demand, add the following to
a script:

import wingapi
def rstrip_now():
   wingapi.gApplication.ExecuteCommand('rstrip-each-line')
rstrip_now.contexts = [wingapi.kContextEditor()]
rstrip_now.label = "Strip trailing white space"

This should be in a file in DIRNAME/scripts/myscript.py where DIRNAME is
your user settings dir, which is listed 5th in Wing's About box, and
of course myscript can be replaced with any other name and you can
rename the script and change the label as desired.

-- 

Stephan Deibel
Wingware | Python IDE
Advancing Software Development

www.wingware.com



More information about the wingide-users mailing list