[TxMt] saving without trailing spaces and tabs...

Fons Rademakers Fons.Rademakers at cern.ch
Tue Mar 21 17:07:21 UTC 2006


So what would I need to do to bind this "Text / Remove Trailing Spaces in 
Document" + "Save" to, say F3 (that is what I've F3 defined to in Nedit on 
Linux to do the same)?

Cheers, Fons.



Dan Ridley wrote:
> There's a command - Text / Remove Trailing Spaces in Document. You could 
> bind that, or your macro, to Cmd-E (right next to S on the keyboard), so 
> you could remove spaces and save by holding Cmd and tapping E-S.
> 
> If you really want to get it into one command, you can use this:
> 
> perl -pe 's/[\t ]+$//g' > "$TM_FILEPATH" && cat "$TM_FILEPATH"
> 
>  (Input: Entire Document
>   Output: Replace Document)
> 
> There are two problems with this, though:
> 
>  * TextMate will not know that you've overwritten the file, so while the 
> file contents on disk will match the file contents in TextMate, you'll 
> still get the "unsaved" bullet on your tab, and will be prompted to save 
> on close.
>  * You'll be returned to the beginning of the current line when you run it.
> 
> 
> 
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate
> 

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers at cern.ch              Phone: +41 22 7679248
WWW:    http://fons.rademakers.org           Fax:   +41 22 7669640



More information about the textmate mailing list